Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
952 views
in Technique[技术] by (71.8m points)

macos - 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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...