1.卸載舊版本,不管裝沒裝過,執行一下,防止版本沖突
yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
2.?yum安裝gcc相關 以及 安裝需要的軟件包
需要確保centos系統可以連接外網
yum -y install gcc
yum -y install gcc-c++yum install -y yum-utils
3.設置國內鏡像,速度會很快
全程輸入y即可
yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
4.更新yum軟件包索引
yum makecache fast
5.安裝docker engine
yum install docker-ce docker-ce-cli http://containerd.io docker-compose-plugin
6.啟動docker
systemctl start docke
7. 查看docker版本
8.測試:hello word
docker run hello-world
9. 卸載
?
systemctl stop docker
yum remove docker-ce docker-ce-clie?http://containerd.io
rm -rf /var/lib/docker
rm -rf /var/lib/containerd?
設置開機啟動
systemctl enable docker.service
關閉開機啟動
systemctl disable docker.service