官网:https://docs.docker.com/engine/install/centos/
1. 安装步骤:
1.检查
sudo yum remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-engine
2. 设置存储库
sudo yum install -y yum-utils
sudo yum-config-manager \ --add-repo \ https://download.docker.com/linux/centos/docker-ce.repo
3.安装最新版本的docker引擎:
sudo yum install docker-ce docker-ce-cli containerd.io
4.启动Docker
$ sudo systemctl start docker
5.通过运行hello-world
映像来验证是否正确安装了Docker Engine 。
$ sudo docker run hello-world
6.验证:
docker -version或者docker run hello-world
7.设置docker启动时启动
sudo systemctl enable docker
若要禁用此行为,请disable
改用。
$ sudo systemctl disable docker
8.
vim /etc/docker/daemon.json
{
"registry-mirrors":["https://docker.mirrors.ustc.edu.cn"]
}
systemctl daemon-reload
systemctl restart docker
2.其他
1.非root用户
sudo groupadd docker
sudo usermod -aG docker your-user