Docker Daemon 配置选项
在Linux操作上,docker守护进程配置文件的默认位置是/etc/docker/daemon.json。可以通过–config-file标志指定非默认位置。下面是Linux操作系统上允许的配置选项完整示例:
{
“authorization-plugins”: [],
“data-root”: “”, # docker的根目录 (默认值: “/var/lib/docker”)
“dns”: [],
“dns-opts”: [],
“dns-search”: [],
“exec-opts”: [],
“exec-root”: “”,
“experimental”: false,
“features”: {},
“storage-driver“: “”, # docker使用的存储驱动
“storage-opts”: [],
“labels”: [],
“live-restore”: true,
“log-driver“: “json-file”, # docker的日志驱动,此处的值为json-file
“log-opts”: { # docker的日志设置
“max-size”: “10m”, # docker的日志大小为10m
“max-file”:”5″, # 最大保留5个日志文件
“labels”: “somelabel”,
“env”: “os,customer”
},
“mtu”: 0,
“pidfile”: “”,
“cluster-store”: “”,
“cluster-store-opts”: {},
“cluster-advertise”: “”,
“max-concurrent-downloads”: 3,
“max-concurrent-uploads”: 5,
“default-shm-size”: “64M”,
“shutdown-timeout”: 15,
“debug”: true,
“hosts”: [],
“log-level”: “”, # 设置日志层次 (“debug”|”info”|”warn”|”error”|”fatal”) (默认值为: “info”)
“tls”: true,
“tlsverify”: true,
“tlscacert”: “”,
“tlscert”: “”,
“tlskey”: “”,
“swarm-default-advertise-addr”: “”,
“api-cors-header”: “”,
“selinux-enabled”: false,
“userns-remap”: “”,
“group”: “”,
“cgroup-parent”: “”,
“default-ulimits”: {
“nofile”: {
“Name”: “nofile”,
“Hard”: 64000,
“Soft”: 64000
}
},
“init”: false,
“init-path”: “/usr/libexec/docker-init”,
“ipv6”: false, # 是否启用ipv6网络
“iptables”: false, # 是否启用iptables规则,默认值为true
“ip-forward”: false,
“ip-masq”: false,
“userland-proxy”: false,
“userland-proxy-path”: “/usr/libexec/docker-proxy”,
“ip”: “0.0.0.0”,
“bridge”: “”,
“bip”: “”,
“fixed-cidr”: “”,
“fixed-cidr-v6”: “”,
“default-gateway”: “”,
“default-gateway-v6”: “”,
“icc”: false,
“raw-logs”: false,
“allow-nondistributable-artifacts”: [],
“registry-mirrors”: [], # 镜像仓库的镜像地址
“seccomp-profile”: “”,
“insecure-registries”: [], # 不安全镜像仓库列表
“no-new-privileges”: false,
“default-runtime”: “runc”, # docker的默认运行时环境
“oom-score-adjust”: -500,
“node-generic-resources”: [“NVIDIA-GPU=UUID1”, “NVIDIA-GPU=UUID2”],
“runtimes”: {
“cc-runtime”: {
“path”: “/usr/bin/cc-runtime”
},
“custom”: {
“path”: “/usr/local/bin/my-runc-replacement”,
“runtimeArgs”: [
“–debug”
]
}
},
“default-address-pools”:[
{“base”:”172.80.0.0/16″,”size”:24},
{“base”:”172.90.0.0/16″,”size”:24}
]
}
在编辑daemon.json后,需要通过执行下面的命令对docker进行重启。
systemctl daemon-reload
systemctl restart docker