1.清除系统残余项(如果你的服务器之前没有装过 Docker,可以直接跳过)
sudo yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-selinux \
docker-engine-selinux \
docker-engine
2.下载安装 Docker 依赖
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
3.更新本地镜像
sudo yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
sudo sed -i 's+download.docker.com+mirrors.aliyun.com/docker-ce+' /etc/yum.repos.d/docker-ce.repo
sudo yum makecache fast
4.安装 Docker
sudo yum -y install docker-ce
5.启动 Docker 之前一定要关闭防火墙
systemctl stop firewalld
systemctl disable firewalld
systemctl status firewalld
6.启动 Docker
systemctl start docker
systemctl stop docker
systemctl restart docker
docker version
sudo systemctl enable docker
7.Docker 安装管理面板 Portainer
docker volume create portainer_data
docker run -d -p 9000:9000 --name portainer --restart always \
-v /var/run/docker.sock:/var/run/docker.sock \
-v portainer_data:/data \
portainer/portainer-ce
docker volume create portainer_data
docker run -d -p 9000:9000 --name portainer --restart always \
-v /var/run/docker.sock:/var/run/docker.sock \
-v portainer_data:/data \
-v /docker_data/portainer/zh_cn/public:/public \
portainer/portainer-ce