一键安装
wget -O /etc/yum.repos.d/docker-ce.repo https://download.docker.com/linux/centos/docker-ce.repo && yum install -y docker-ce && systemctl enable docker.service && service docker start
安装
Install using the repository
SET UP THE REPOSITORY
Before you install Docker CE for the first time on a new host machine, you need to set up the Docker repository. Afterward, you can install and update Docker from the repository.Install required packages. yum-utils provides the yum-config-manager utility, and device-mapper-persistent-data and lvm2 are required by the devicemapper storage driver.
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
Use the following command to set up the stable repository. You always need the stable repository, even if you want to install builds from the edge or testing repositories as well.
sudo yum-config-manager \
–add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
INSTALL DOCKER CE
Update the yum package index.
$ sudo yum makecache fast
Install the latest version of Docker CE, or go to the next step to install a specific version.
$ sudo yum install docker-ce
检索密钥:
060A 61C5 1B55 8A7F 742B 77AA C52F EB6B 621E 9F35Install a specific version on production systems
$ sudo yum list docker-ce.x86_64 –showduplicates | sort -r
sudo yum install docker-ce-< VERSION >
Start and Verify
$ sudo systemctl start docker
sudo docker run hello-world
阿里云镜像
前往https://cr.console.aliyun.com注册
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-‘EOF’
{
“registry-mirrors”: [“https://xxxxxxx.mirror.aliyuncs.com“]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
卸载
yum remove -y docker-ce