Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker deamon config path under mac os

I am using docker in Version 1.12.0 (build 10871) on Mac OS (El Capitan 10.11.4) and I want to provide a config file for the docker daemon.

Under Ubuntu you place the config under /etc/default/docker (see docs). Unfortunately, I cannot figure out where to place the config in Mac OS

Any ideas?

like image 476
Erik Avatar asked Aug 05 '16 09:08

Erik


People also ask

Where is Docker config file in Mac?

On recent versions of Docker Desktop for Mac, the files are in ~/. docker.

Where is Docker daemon configuration file?

The preferred method for configuring the Docker Engine on Windows is using a configuration file. The configuration file can be found at 'C:\ProgramData\Docker\config\daemon. json'. You can create this file if it doesn't already exist.

Where is Docker config directory?

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.

How do I run Docker daemon on macOS?

On MacOS go to the whale in the taskbar > Preferences > Daemon > Advanced. Here’s what the configuration file looks like: With this configuration the Docker daemon runs in debug mode, uses TLS, and listens for traffic routed to 192.168.59.3 on port 2376 .

How to configure the docker0 bridge?

The docker0 bridge can be configured with docker args, it will take effect after reboot. In your cloud-config, System Docker configuration is located under the rancher.system_docker key. #cloud-config rancher: system_docker: storage_driver: overlay All daemon arguments shown in the first table are also available to System Docker.

How do I view the Docker daemon log?

The Docker daemon log can be viewed by using one of the following methods: /var/log/messages, /var/log/daemon.log, or /var/log/docker.log on older Linux systems Note: It is not possible to manually generate a stack trace on Docker Desktop for Mac or Docker Desktop for Windows.

Where do I put Docker config file on Mac OS?

I am using docker in Version 1.12.0 (build 10871) on Mac OS (El Capitan 10.11.4) and I want to provide a config file for the docker daemon. Under Ubuntu you place the config under /etc/default/docker (see docs ).


2 Answers

Docker 19+

Config file is now available in ~/.docker/daemon.json (see Ed's Answer)

Docker EE/CE 17+

Docker for Mac/Windows has added a config editor to the tray icon UI to allow editing of Dockers daemon.json file that will be persisted in the VM.

To access it go to the Docker Icon > Preferences > Daemon > Advanced enter image description here

Original Answer

The Docker for Mac VM is based on Alpine Linux. The init system is based on OpenRC.

You can attach a screen session to the VM's tty (terminal) and poke around

$ screen ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/tty 

The docker daemon config is in the usual spot

moby:/etc/docker# ls -l /etc/docker/ total 8 -rw-r--r--    1 root     root            38 Aug  5 11:26 daemon.json -rw-------    1 root     root           244 Aug  5 11:26 key.json 

The /etc/init.d/docker script that manages the startup does not seem very configurable, apart from editing the script.

/host_docker_app in the VM is a mount of the data in ~/Library/Containers/com.docker.docker/Data/ from OSX. This seems like the most likely place to persist custom config but it doesn't look like there is any interface to source/load config or anything at startup from there.

It looks like changes outside of /var or /host_docker_app will not persist over reboots. There was a mechanism to persist some startup config in the old boot2docker VM image but I haven't found anything like it for the new VM.

like image 176
Matt Avatar answered Sep 22 '22 13:09

Matt


On recent versions of Docker Desktop for Mac, the files are in ~/.docker.

~/.docker/daemon.json 

Custom (ie. self-signed) certificates can be copied into

~/.docker/certs.d/{MyRegistry:port}/client.crt 
like image 30
Ed Randall Avatar answered Sep 20 '22 13:09

Ed Randall