Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker daemon config file on boot2docker / docker-machine / Docker Toolbox

Where can I find docker daemon config file on boot2docker machine?

According to this topic: Dockerfile: Docker build can't download packages: centos->yum, debian/ubuntu->apt-get behind intranet

I want to set '--dns' in DOCKER_OPTS, but I can't find this config file either at /etc/default or anywhere else.

like image 796
anaid Avatar asked Oct 17 '14 11:10

anaid


People also ask

Where is the Docker config file located?

In Windows containers, configs are all mounted into C:\ProgramData\Docker\configs and symbolic links are created to the desired location, which defaults to C:\<config-name> . You can set the ownership ( uid and gid ) for the config, using either the numerical ID or the name of the user or group.

Where is located Docker config JSON?

The configuration file uses JSON formatting, and properties: By default, configuration file is stored in ~/. docker/config. json .

Where is Docker daemon PID?

Another way to check for a running Docker daemon is by inspecting its process ID file. The daemon writes its process ID to /var/run/docker. pid each time it starts up.

What is Docker daemon file?

The Docker daemon ( dockerd ) listens for Docker API requests and manages Docker objects such as images, containers, networks, and volumes. A daemon can also communicate with other daemons to manage Docker services.


3 Answers

Inside boot2docker (boot2docker ssh) / docker-machine (docker-machine ssh default) , open or create the file /var/lib/boot2docker/profile and add the following line:

EXTRA_ARGS="--dns 192.168.1.145"

Also works for:

EXTRA_ARGS="--insecure-registry myinternaldocker"

After the change you need to restart the docker daemon:

sudo /etc/init.d/docker restart

Or leave boot2docker / docker-machine and restart the entire virtual machine:

boot2docker restart
# for docker machine
docker-machine restart default

Information taken from: https://groups.google.com/d/msg/docker-user/04pAX57WQ7g/_LI-z8iknxYJ

like image 71
Carlos Rafael Ramirez Avatar answered Nov 09 '22 12:11

Carlos Rafael Ramirez


If you are using a mac you have to go to a fresh terminal and run:

boot2docker ssh

This will open a new terminal, from there you have to edit or create a file

sudo vi /var/lib/boot2docker/profile

and add the DNS that you would like to add, for example:

DOCKER_OPTS="-dns 8.8.8.8 -dns 8.8.4.4"

After that you need to restart boot2docker. Here I had some issues at the beginning so I close everything and run in a terminal:

boot2docker down
boot2docker up

you can also use:

boot2docker restart

I had to do it twice. After that I started again using the normal boot2docker icon and everything worked.

like image 32
Gil Avatar answered Nov 09 '22 13:11

Gil


If you want to script things, you can do these steps on one ugly line:

boot2docker ssh 'sudo sh -c "echo \"EXTRA_ARGS=\\\"--dns 1.2.3.4\\\"\" > /var/lib/boot2docker/profile && sudo /etc/init.d/docker restart"'
like image 40
tuomassalo Avatar answered Nov 09 '22 12:11

tuomassalo