docker安装脚本

cat >> /etc/security/limits.conf <<EOF
* soft nofile 65535
* hard nofile 65536
EOF

sudo yum remove docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-engine

sudo yum install -y yum-utils

sudo yum-config-manager \
    --add-repo \
    https://download.docker.com/linux/centos/docker-ce.repo

sudo yum install -y docker-ce docker-ce-cli containerd.io

tee /etc/docker/daemon.json <<-'EOF'
{
"insecure-registries": ["http://${registry_ip}:${registry_port}"],
"max-concurrent-downloads": 3,
"max-concurrent-uploads": 5,
"log-driver": "json-file",
"log-opts": {
    "max-size": "100m",
    "max-file": "3"
    }
}
EOF

systemctl daemon-reload && systemctl restart docker

useradd docker -g docker
echo "password@2022" | passwd --stdin docker

chmod 640 /etc/sudoers,增加

> docker  ALL=(ALL)       ALL
> docker          ALL=(ALL)       NOPASSWD: ALL