1.安装gcc相关
sudo yum -y install gcc
sudo yum -y install gcc-c++
3.查看docker是否安装
yum list installed | grep docker
4.卸载之前版本
yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
5.安装依赖包
yum install -y yum-utils device-mapper-persistent-data lvm2
6.设置阿里云镜像源
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
7.更新yum软件包索引
yum makecache fast
8.安装docker-ce
yum -y install docker-ce
9.开机自启动docker
systemctl enable docker
systemctl start docker
10.测试,查看启动状态
docker version
systemctl status docker
11.配置镜像加速
mkdir -p /etc/docker
vim /etc/docker/daemon.json
#网易云
{
"registry-mirrors": ["http://hub-mirror.c.163.com"]
}
#阿里云
{
"registry-mirrors": ["https://[你的加速器地址].mirror.aliyuncs.com"]
}
systemctl daemon-reload
systemctl restart docker
12.查看相关启动
ps -ef|grep docker|grep -v grep
13.卸载
systemctl stop docker
yum -y remove docker-ce
rm -rf /var/lib/docker
14.GUI管理
官方地址:https://portainer.io/install.html
命令访问 : ip:9000
docker volume create portainer_data
docker run -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer