0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Dockerエンジンに対してDNSサーバを指定する [docker 19.03]

Last updated at Posted at 2021-07-03

概要

Dockerエンジンに対して DNS サーバを指定する方法を検索すると幾つか情報が見つかるが、自分の環境に該当するもの・しないものがあった.

ここでは自分の環境では有効になった手順を記しておくので、閲覧者皆の環境に該当することは保証できない.

環境

OS

$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.5 LTS"

docker

$ docker version | head -n2
Client: Docker Engine - Community
 Version:           19.03.13

手順

1. docker を停止させる

$ sudo systemctl stop docker

2. /etc/docker/daemon.json を作成する

$ sudo touch /etc/docker/daemon.json

3. /etc/docker/daemon.json に対して DNSサーバを定義する

ここでは、DNS サーバが 133.180.0.182 であるものとする

$ sudo cat /etc/docker/daemon.json
{
 "dns": ["133.180.0.182"]
}

4. docker を稼働させる

$ sudo systemctl start docker

以上

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?