[zhouhh@mainServer ~]$ sudo yum install docker-ce
Loaded plugins: fastestmirror, langpacks
Installing:
docker-ce x86_64 17.05.0.ce-1.el7.centos docker-ce-edge 19 M
Installing for dependencies:
docker-ce-selinux noarch 17.05.0.ce-1.el7.centos docker-ce-edge 28 k
[Errno 12] Timeout on https://download.docker.com/linux/centos/7/x86_64/edge/Packages/docker-ce-17.05.0.ce-1.el7.centos.x86_64.rpm
Transaction check error:
file /usr/bin/docker from install of docker-ce-17.05.0.ce-1.el7.centos.x86_64 conflicts with file from package docker-common-2:1.12.6-28.git1398f24.el7.centos.x86_64
file /usr/bin/docker-containerd from install of docker-ce-17.05.0.ce-1.el7.centos.x86_64 conflicts with file from package docker-common-2:1.12.6-28.git1398f24.el7.centos.x86_64
file /usr/bin/docker-containerd-shim from install of docker-ce-17.05.0.ce-1.el7.centos.x86_64 conflicts with file from package docker-common-2:1.12.6-28.git1398f24.el7.centos.x86_64
file /usr/bin/dockerd from install of docker-ce-17.05.0.ce-1.el7.centos.x86_64 conflicts with file from package docker-common-2:1.12.6-28.git1398f24.el7.centos.x86_64
Error Summary
如果生产系统需要稳定版本, 需要 yum list 进行查询. 但yum list只会显示二进制包, 加上.x86_64会显示包含源码包的全部的包. sort -r会按版本倒序排序.
启动测试docker
Hello world的镜像启动后会打印”Hello from Docker!”然后退出.
[zhouhh@mainServer ~]$ sudo systemctl start docker
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
78445dd45222: Pull complete
Digest: sha256:c5515758d4c5e1e838e9cd307f6c6a0d620b5e07e6f927b07d05f6d12a1ac8d7
Status: Downloaded newer image for hello-world:latest
Hello from Docker!
This message shows that your installation appears to be working correctly.
非root用户启动docker
[zhouhh@mainServer ~]$ sudo groupadd docker
[zhouhh@mainServer ~]$ sudo usermod -aG docker $USER
[zhouhh@mainServer ~]$ exit
logout
[zhouhh@mainServer ~]$ docker run hello-world
Hello from Docker!
This message shows that your installation appears to be working correctly.
[zhouhh@mainServer ~]$ sudo systemctl enable docker
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.