本文介绍了在mac os下的Docker deamon配置路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Mac OS(El Capitan 10.11.4)的版本1.12.0(build 10871)中使用docker,我想为docker守护程序提供配置文件。



在Ubuntu下,将配置放在

/ host_docker_app 在〜/ Library /容器/ C om.docker.docker / Data / 从OSX。这似乎是维护自定义配置的最可能的地方,但它看起来不像有任何接口来源/加载配置或从那里启动的任何东西。



看起来像 / var 或 / host_docker_app 将不会重新启动。有一种机制来保留旧的boot2docker VM映像中的一些启动配置,但是我没有找到类似于新VM的任何东西。


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?

解决方案

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

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.

这篇关于在mac os下的Docker deamon配置路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-05 12:10