The tools and resource center To help developers work more efficient, to provide around the whole life cycle of the developer tools and resources to https://developer.aliyun.com/…
Introduction: Install and create the Test image
! /bin/bash
repo=”centos-yum.sh” if [ ! -e $repo ]; Then # -e; Reference: Shell the if condition judgment file or directory yum install wget – y wget HTTP: / / www.eisc.cn/file/shell/centos-yum.sh; Sh centos – yum. Sh else echo “yum has switch” fi DockerInstall () {dci = RPM – qa | grep docker | wc -l if [1] $dci – lt then
Echo "Installing Docker ======="
yum -y remove docker docker-common docker-selinux docker-engine
Uninstall the old version of Docker
yum install -y yum-utils device-mapper-persistent-data lvm2
# configure the source code of yum
yum-config-manager –add-repo https://download.docker.com/l…
# Add docker yum source code
yum list docker-ce –showduplicates | sort -r
Check the docker version
cat /dev/null > /etc/docker/daemon.json ;
# Empty the file and write again
cat > /etc/docker/daemon.json << EOF { “insecure-registries”: [” registry. Local 127.0.0.1: “, “5001”, “10.10.13.42:5000]”, “registry – mirrors” : (” https://registry.docker-cn.com “), “BJP” : “172.18.18.1/24”, “data – root” : “/ var/lib/docker”, “storage – driver” : “overlay2”, “live-restore”: true, “log-opts”: {
"max-size": "500m"
}
}
EOF
IPv6 is not required in the file
Mirror accelerator configuration
Yum install -y docker-ce # yum install -y docker-ce #
Yum install docker-ce-<VERSION_STRING>
Yum install docker – ce – 18.03.1. Ce
Start docker systemctl enable docker # Start docker version # Check docker version # docker run hell-world # Start a Docker to verify that the installation succeeded else
Echo "Docker installed successfully"
fi
}
DockerInstall
dockerCangku(){
systemctl daemon-reload
systemctl restart docker.service
systemctl status docker -l
docker info
docker pull centos:7
# Pull centos7 image
}
dockerCangku