一、添加Docker仓库
1.安装
yum install -y yum-utils device-mapper-persistent-data lvm2
yum-config-manager的选项使用:
yum-config-manager –add-repo“仓库路径” 添加仓库
yum-config-manager –disable “仓库名" 禁用仓库
yum-config-manager –enable “仓库名” 启用仓库
2.添加Docker仓库
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
二、安装Docker CE
1.这条命令会安装最新版的Docker
yum install docker-ce
查看Docker CE的版本,从高到底排序
yum list docker-ce --showduplicates | sort -r
[root@localhost yum.repos.d]# yum list docker-ce --showduplicates | sort -r
* updates: mirrors.163.com
Loading mirror speeds from cached hostfile
Loaded plugins: fastestmirror
Installed Packages
* extras: mirrors.zju.edu.cn
docker-ce.x86_64 17.09.1.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.09.1.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
docker-ce.x86_64 17.09.1.ce-1.el7.centos docker-ce-stable
安装就是:
yum install docker-ce-17.09.1.ce
1.启动Docker
systemctl start docker
docker search whalesay #这条命令会获取一个鲸鱼的小镜像
[root@localhost yum.repos.d]# docker search whalesay
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
docker/whalesay An image for use in the Docker demo tutorial 621
mendlik/docker-whalesay Docker whalesay image from training materi... 6 [OK]
sabs1117/whalesay Whalesay with fortune phrases. 1
nikovirtala/whalesay Tiny Go web service to print Moby Dock ASC... 1 [OK]
milanfort/whalesay Modified docker/whalesay image that output... 1
swinton/whalesay whalesay, innit 1
ojenge/whalesay from docker/whalesay 1
caibar/whalesay Builds automatizados. 1 [OK]
jracionero/docker-whalesay My smarter docker whalesay 0
puneethp/whalesay Docker-Whalesay 0
firecyberice/whalesay Docker **Cloud** automated build for **amd... 0
forsingh/whalesay whalesay 0 [OK]
claytonrogers/docker-whalesay Whalesay automated build 0 [OK]
asakilan/pg-whalesay My whalesay 0
dhalljohnston/whalesay whalesay 0
whalebrew/whalesay 0
blaines/whalesay 0
tiagoferreira/whalesay Whalesay image 0
phyominhtun/whalesay My whalesay image! 0
liuzhishan/docker-whalesay docker-whalesay 0
laveshin/whalesay whalesay image 0
hongxi/whalesay-fortunes Demo, the whalesay-fortunes 0
jetolabs/whalesay whalesay with fortune cookie messages 0
nateliu/whalesay first test of whalesay 0
bjarkebard/whalesay testing whalesay 0
docker pull docker/whalesay
[root@localhost yum.repos.d]# docker pull docker/whalesay
Using default tag: latest
latest: Pulling from docker/whalesay
e190868d63f8: Pull complete
909cd34c6fd7: Pull complete
0b9bfabab7c1: Pull complete
a3ed95caeb02: Pull complete
00bf65475aba: Pull complete
c57b6bcc83e3: Pull complete
8978f6879e2f: Pull complete
8eed3712d2cf: Pull complete
Digest: sha256:178598e51a26abbc958b8a2e48825c90bc22e641de3d31e18aaf55f3258ba93b
Status: Downloaded newer image for docker/whalesay:latest
docker images
[root@localhost yum.repos.d]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
docker/whalesay latest 6b362a9f73eb 2 years ago 247MB
docker run docker/whalesay cowsay hello world
[root@localhost yum.repos.d]# docker run docker/whalesay cowsay hello world
_____________
< hello world >
-------------
\
\
\
## .
## ## ## ==
## ## ## ## ===
/""""""""""""""""___/ ===
~~~ {~~ ~~~~ ~~~ ~~~~ ~~ ~ / ===- ~~~
\______ o __/
\ \ __/
\____\______/