CentOS7.3安装docker

摘要: centos7.3 安装docker

要安装Docker CE,您需要64位版本的CentOS 7

  • yum安装

依次执行以下命令,如有疑问请参考官方安装手册

1
2
3
4
5
6
7
8
9
10
11
12
13
[root@paascloud-test-001 ~]# yum remove docker docker-common docker-selinux docker-engine
[root@paascloud-test-001 ~]# yum install -y yum-utils device-mapper-persistent-data lvm2
[root@paascloud-test-001 ~]# yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
[root@paascloud-test-001 ~]# yum-config-manager --enable docker-ce-edge
[root@paascloud-test-001 ~]# yum-config-manager --enable docker-ce-test
[root@paascloud-test-001 ~]# yum-config-manager --disable docker-ce-edge
[root@paascloud-test-001 ~]# yum makecache fast
[root@paascloud-test-001 ~]# yum -y install docker-ce
[root@paascloud-test-001 ~]# systemctl start docker
[root@paascloud-test-001 ~]# docker run hello-world
[root@paascloud-test-001 ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
hello-world latest 1815c82652c0 2 months ago 1.84kB
  • 本地安装

以上方案安装慢的让你想哭 从官方安装包中安装, 我这里安装版本docker-ce-17.06.0.ce-1.el7.centos.x86_64.rpm

1
2
3
4
5
[root@paascloud-test-001 ~]# yum install /usr/local/src/tool/docker-ce-17.06.0.ce-1.el7.centos.x86_64.rpm -y

Loaded plugins: fastestmirror
... 中间省略一万字
Complete!
  • 启动Docker。
1
[root@paascloud-test-001 ~]# systemctl start docker
  • 查看docker版本。
1
2
docker -v
Docker version 17.06.0-ce, build 02c1d87
  • 开机启动
1
2
[root@paascloud-test-001 ~]# systemctl enable docker
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.
评论