若是你還想從頭學起 Docker,能夠看看這個系列的文章哦!html
https://www.cnblogs.com/poloyy/category/1870863.htmllinux
虛擬機安裝 centos 7.x 教程:http://www.javashuo.com/article/p-zxqpxyeu-nu.htmldocker
sudo yum remove docker \ docker-client \ docker-client-latest \ docker-common \ docker-latest \ docker-latest-logrotate \ docker-logrotate \ docker-engine
若是出現下圖就能夠了centos
有兩種方式,可供選擇app
在主機上首次安裝 Docker Engine以前,須要設置 Docker Repository,以後能夠從 Repository 安裝和更新 Docker工具
# step 1: 安裝必要的一些系統工具 sudo yum install -y yum-utils device-mapper-persistent-data lvm2 # Step 2: 添加軟件源信息,國內 Repository 更加穩定 sudo yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo # Step 3: 更新 sudo yum makecache fast
sudo yum install docker-ce docker-ce-cli containerd.io
sudo yum list docker-ce --showduplicates | sort -r
sudo yum install docker-ce-<VERSION_STRING> docker-ce-cli-<VERSION_STRING> containerd.io
sudo yum install docker-ce-19.03.13-3.el7 docker-ce-cli-19.03.13-3.el7 containerd.io
注意: 3: 是不用加的哈測試
sudo systemctl start docker
經過運行 hello-world 映像來驗證阿里雲
sudo docker run hello-world
建議使用 sudo 運行上面的命令,以便非特權用戶運行 Docker 命令以及其餘可選配置 步驟spa
可能官網的yum源太慢,下面使用阿里雲的Yum源進行安裝3d
rm -rf /etc/yum.repos.d/* wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo wget -O /etc/yum.repos.d/docker-ce.repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo yum clean all sudo yum install docker-ce docker-ce-cli containerd.io systemctl enable --now docker
直接指定最新版本的方式去安裝便可
將 下好的 rpm 包放到 Linux 任意目錄下
sudo yum install /root/package.rpm
sudo systemctl start docker
直接看下一篇文章:http://www.javashuo.com/article/p-wbwilusq-nu.html
sudo yum remove docker-ce docker-ce-cli containerd.io
備註:主機上的 Images、containers、volumes、自定義配置文件不會被刪除
sudo rm -rf /var/lib/docker