https://docs.docker.com/engine/installation/linux/docker-ce/centos/linux
一、安裝Docker CE,須要一個維護版本的Centos7git
二、centos-extras庫必須啓用,這個存儲庫默認啓用,可是若是您禁用了它,您須要從新啓用它(https://wiki.centos.org/AdditionalResources/Repositories)github
yum remove docker docker-common docker-selinux
3、安裝Docker CE
yum install -y yum-utils device-mapper-persistent-data
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum install docker-ce
[root@docker ~]# yum list docker-ce --showduplicates | sort -r
* updates: mirrors.aliyun.com
Loading mirror speeds from cached hostfile
Loaded plugins: fastestmirror
Installed Packages
* extras: mirrors.aliyun.com
docker-ce.x86_64 17.09.0.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.09.0.ce-1.el7.centos @docker-ce-stable
docker-ce.x86_64 17.06.2.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.06.1.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.06.0.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.03.2.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.03.1.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.03.0.ce-1.el7.centos docker-ce-stable
* base: mirrors.aliyun.com
Available Packages
[root@docker ~]# yum install docker-ce-17.06.0.ce-1.el7.centos.x86_64
systemctl start docker
docker run hello-world
https://download.docker.com/linux/centos/7/x86_64/stable/Packages/
yum install -y /path/to/package.rpm
systemctl start docker
yum -y upgrade /path/to/package.rpm
curl -fsSL get.docker.com -o get-docker.sh
sh get-docker.sh
systemctl enable docker
卸載docker-cedocker
yum remove docker-ce
在您的主機上的鏡像、容器、卷或自定義配置文件不會自動刪除,要刪除全部圖像、容器和卷:centos
rm -rf /var/lib/docker
https://docs.docker.com/engine/installation/linux/linux-postinstall/bash
groupadd docker
usermod -aG docker $USER
https://docs.docker.com/engine/installation/linux/linux-postinstall/#troubleshootingapp
若是您的內核版本3.10小,或者缺乏一些模塊,Docker將沒法正常運行。爲了檢查內核兼容性,您能夠下載並運行check-compatibility.sh腳本curl
curl https://raw.githubusercontent.com/docker/docker/master/contrib/check-config.sh > check-config.sh
bash ./check-config.sh
要查看您的docker客戶端主機配置的是鏈接哪一個主機,請檢查您環境中DOCKER_HOST變量的值。post
env | grep DOCKER_HOST
若是這個命令返回一個值,那麼Docker客戶端主機被設置爲鏈接到運行在那臺主機上的Docker守護進程。若是未設置,則Docker客戶端被鏈接到運行在本地主機上的Docker守護進程。若是設置錯誤,請使用如下命令取消設置:url
unset DOCKER_HOST