ast*_*tef 29 ubuntu docker ubuntu-14.04
来自docs:
Linux上配置文件的默认位置是/etc/docker/daemon.json
但我没有在我的新鲜docker安装上:
# docker --version
Docker version 17.03.1-ce, build c6d412e
# ls -la /etc/docker/
total 12
drwx------ 2 root root 4096 Apr 28 17:58 .
drwxr-xr-x 96 root root 4096 Apr 28 17:58 ..
-rw------- 1 root root 244 Apr 28 17:58 key.json
# lsb_release -cs
trusty
Run Code Online (Sandbox Code Playgroud)
huu*_*huu 41
Linux上的默认配置文件路径/etc/docker/daemon.json与您说的相同,但默认情况下不存在.您可以自己编写一个并在其中添加其他docker守护程序配置,而不是将这些配置选项传递到命令行.您甚至不必这样做,dockerd --config-file /etc/docker/daemon.json因为这是默认路径,但是对于正在检查系统的其他人来说明确它是有用的.
还要确保您设置的任何配置/etc/docker/daemon.json与传递到命令行唤醒的选项不冲突dockerd.以供参考:
配置文件中设置的选项不得与通过标志设置的选项冲突.如果文件和标志之间的选项重复,则docker守护程序无法启动,无论其值如何.
NZD*_*NZD 11
如果您在 Ubuntu 安装过程中安装了 Docker,那么 Docker 将作为快照安装。
该配置可以在 中找到/var/snap/docker/current/config/daemon.json。
参考https://github.com/docker-archive/docker-snap/issues/22#issuecomment-423361607
概括:
anonymouse64 commented on 21 Sep 2018
Modifying the daemon.json file is now supported in the version of the snap
I have published in the edge channel. The daemon is now hard-coded to read
the config file for it's settings, so you can now edit the daemon.json
located in $SNAP_DATA/config/daemon.json (on Ubuntu for example $SNAP_DATA
is /var/snap/docker/current, it may be different on your distribution) and
then restart docker for the changes to take effect with:
sudo snap restart docker
You may switch the snap to the edge channel to test this by running:
sudo snap refresh docker --edge
The changes in the edge channel should show up in stable in a short while
if you don't wish to use edge.
Run Code Online (Sandbox Code Playgroud)
现在这似乎存在于“稳定”中。我正在使用 Ubunu 20.04,我daemon.json在/var/snap/docker/current/config/daemon.json.
我将“log-driver”更改为“local”,docker 在重新启动后将其拾取:
docker info --format '{{.LoggingDriver}}'
json-file
nano /var/snap/docker/current/config/daemon.json
# added line: "log-driver":"local",
snap restart docker
docker info --format '{{.LoggingDriver}}'
local
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
25486 次 |
| 最近记录: |