标签:dockerd daemon.json docker配置文件
通常我们修改Docker的守护进程的一些特性是通过在/lib/systemd/system/docker.service这个配置文件的ExecStart后面增加启动参数,但是如果要设置的特性比较多,显然这个参数会很长。所以还是通过修改配置文件更加直观和方便。
配置文件在哪里:
在我们使用的这个Docker版本中,默认的配置文件是/etc/docker/daemon.json,但是这个文件并不存在,不过这个目录是存在的。
既然没有那个文件,我们就建立一个。这个文件的格式是JSON格式,其实没有什么难得,只要了解这个格式就可以写。大体格式如下:
[
{
"ITME1": "VALUE",
"ITEM2": {
"ITME2-1": "VALUE",
"ITEM2-2": "VALUE",
"ITEM2-3": {
"ITEM2-3-1": "VALUE",
}
}
}
]你只要知道格式,具体的值需要的时候再查询就行。下面是一个全的LINUX平台下的配置文件,来源于官网:
{
"api-cors-header": "",
"authorization-plugins": [],
"bip": "",
"bridge": "",
"cgroup-parent": "",
"cluster-store": "",
"cluster-store-opts": {},
"cluster-advertise": "",
"debug": true,
"default-gateway": "",
"default-gateway-v6": "",
"default-runtime": "runc",
"default-ulimits": {},
"disable-legacy-registry": false,
"dns": [],
"dns-opts": [],
"dns-search": [],
"exec-opts": [],
"exec-root": "",
"fixed-cidr": "",
"fixed-cidr-v6": "",
"graph": "",
"group": "",
"hosts": [],
"icc": false,
"insecure-registries": [],
"ip": "0.0.0.0",
"iptables": false,
"ipv6": false,
"ip-forward": false,
"ip-masq": false,
"labels": [],
"live-restore": true,
"log-driver": "",
"log-level": "",
"log-opts": {},
"max-concurrent-downloads": 3,
"max-concurrent-uploads": 5,
"mtu": 0,
"oom-score-adjust": -500,
"pidfile": "",
"raw-logs": false,
"registry-mirrors": [],
"runtimes": {
"runc": {
"path": "runc"
},
"custom": {
"path": "/usr/local/bin/my-runc-replacement",
"runtimeArgs": [
"--debug"
]
}
},
"selinux-enabled": false,
"storage-driver": "",
"storage-opts": [],
"swarm-default-advertise-addr": "",
"tls": true,
"tlscacert": "",
"tlscert": "",
"tlskey": "",
"tlsverify": true,
"userland-proxy": false,
"userns-remap": ""
"registry-mirrors": ["https://y49g0r41.mirror.aliyuncs.com"]
}配置的时候你只需要挑选你需要的,不用全写进去。然后在dockerd命令后面使用--confige-file 知名配置文件就好,重复的就被覆盖了,不重复的则保持默认。
本文出自 “小恶魔的家” 博客,请务必保留此出处http://littledevil.blog.51cto.com/9445436/1910423
标签:dockerd daemon.json docker配置文件
原文地址:http://littledevil.blog.51cto.com/9445436/1910423