1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
|
{
// docker 自身相关
// 修改 /var/lib/docker 的 docker root 目录, 可以使用 docker info 确认
// 也是可以用软链接的
"data-root": "/data/docker",
"storage-driver": "overlay2", // 默认即 overlay2
"storage-opts": [
"overlay2.override_kernel_check=true"
],
"hosts":["tcp://0.0.0.0:2375","unix:///var/run/docker.socket"],
"selinux-enabled":false,
// 早期是 cgroupfs, 推荐 systemd
"exec-opts": ["native.cgroupdriver=systemd"],
"pidfile": "",
"tls": true,
"tlscacert": "",
"tlscert": "",
"tlskey": "",
"tlsverify": true, // 远程访问管理 api 时要求 tls 校验证书
//=============================================================
// 集群相关
"swarm-default-advertise-addr": "",
"cluster-advertise": "",
"cluster-store": "",
"cluster-store-opts": {},
//=============================================================
// 仓库相关
// 会将所有未指定源的仓库(即docker-hub)请求都走镜像站
"registry-mirrors": [
"https://registry.cn-hangzhou.aliyuncs.com", // 这个镜像是可用的
],
// 可信的内部仓库, 可以使用 http or https
"insecure-registries": ["localhost:5000", "registry.wait"],
"max-concurrent-downloads": 20, // 增加下载并发数
"max-concurrent-uploads": 10,
"max-download-attempts": 5,
//=============================================================
// 网络相关
"dns": ["8.8.8.8", "8.8.4.4"], // 容器内使用的 dns
"dns-opts": [],
"dns-search": [],
"mtu": 1500,
"default-address-pools": [
{
"base": "172.30.0.0/16",
"size": 24
},
{
"base": "172.31.0.0/16",
"size": 24
}
],
"default-gateway": "",
"default-gateway-v6": "",
"ip": "0.0.0.0",
"ip-forward": false,
"ip-masq": false,
// 为了避免和 firewalld 冲突, 可以关闭 docker 配置 iptable, 改为手工配置规则的方式
"iptables": false,
"ip6tables": false,
"ipv6": false,
//=============================================================
// 容器实例相关
// 重启 docker daemon 时, 不停止容器实例
// 理解为暂时托管给 systemd, 再次启动后又重新接管
// 但是有一些限制, 如大版本升级时, 可能接管不了, 还是需要手工重启容器
// 不支持 swarm 模式, 对日志输出似乎也有一些影响
// 在修改或升级 docker daemon 后, 容器状态不会重启更新, 所以可能会导致状态差异;
// 不经常变更和升级的生产环境可以开启
"live-restore": true,
"containerd": "/run/containerd/containerd.sock",
"containerd-namespace": "docker",
"containerd-plugin-namespace": "docker-plugins",
// 容器日志
"log-driver": "json-file",
"log-level": "",
"log-opts": {
"max-size": "100m",
"max-file": "10",
"cache-disabled": "false",
"cache-max-file": "5",
"cache-max-size": "20m",
"cache-compress": "true",
"env": "os,customer",
"labels": "somelabel"
},
"raw-logs": false,
"runtimes": {
"cc-runtime": {
"path": "/usr/bin/cc-runtime"
},
"custom": {
"path": "/usr/local/bin/my-runc-replacement",
"runtimeArgs": [
"--debug"
]
}
},
"shutdown-timeout": 15,
//=============================================================
"allow-nondistributable-artifacts": [],
"api-cors-header": "",
"authorization-plugins": [],
"bip": "",
"bridge": "",
"debug": true,
"cgroup-parent": "",
"default-cgroupns-mode": "private",
"default-runtime": "runc",
"default-shm-size": "64M",
"default-ulimits": {
"nofile": {
"Hard": 64000,
"Name": "nofile",
"Soft": 64000
}
},
"exec-root": "",
"experimental": false,
"features": {},
"fixed-cidr": "",
"fixed-cidr-v6": "",
"group": "",
"icc": false, // 禁用容器间通信
"init": false,
"init-path": "/usr/libexec/docker-init",
"labels": [],
"no-new-privileges": false,
"node-generic-resources": [
"NVIDIA-GPU=UUID1",
"NVIDIA-GPU=UUID2"
],
"oom-score-adjust": -500,
"seccomp-profile": "",
"userland-proxy": false, // 优化网络性能
"userland-proxy-path": "/usr/libexec/docker-proxy",
"userns-remap": ""
}
|