daemon.json配置优化
#注意json不支持注释
#vim /etc/docker/daemon.json
{
"registry-mirrors": [
"https://docker.m.daocloud.io",
"https://dockerhub.icu",
"https://docker.anyhub.us.kg",
"https://docker.1panel.live"
],
#开启远程:https://docs.docker.com/config/daemon/remote-access/ 或者 ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:2375 -H fd:// --containerd=/run/containerd/containerd.sock
"hosts": ["unix:///var/run/docker.sock", "tcp://10.0.0.10:2375"],
"insecure-registries": ["harbor.seb.org"],
"exec-opts": ["native.cgroupdriver=systemd"],
"graph": "/data/docker",
#指定docker数据目录,新版24.0.0不支持,实现:ExecStart=/usr/bin/dockerd --data-root=/data/docker
#更改数据目录后新目录里面没东西,只需拷贝原目录文件过来即可
"max-concurrent-downloads": 10,
"max-concurrent-uploads": 5,
"log-opts": {
"max-size": "300m",
#指定容器日志文件的最大值
"max-file": "2"
#指定容器日志文件的个数,循环写入日志文件,即一个日志满,会写入第二个文件
},
"live-restore": true,
#代理 https://docs.docker.com/network/proxy/
"proxies": {
"default": {
"httpProxy": "http://proxy.example.com:3128",
"httpsProxy": "https://proxy.example.com:3129",
"noProxy": "*.test.example.com,.example.org,127.0.0.0/8"
}
"tcp://docker-daemon1.example.com": {
"noProxy": "*.internal.example.net"
}
#systemctl daemon-reload ;systemctl restart docker.service