美文网首页
docker安装

docker安装

作者: 金刚_30bf | 来源:发表于2018-06-20 21:13 被阅读0次

集群环境

[root@node206 ~]# uname -r 
3.10.0-327.el7.x86_64
[root@node206 ~]# cat /etc/system-release
CentOS Linux release 7.2.1511 (Core) 

安装文档

参考 https://docs.docker.com/install/linux/docker-ce/centos/#set-up-the-repository

安装需要的包

 yum install -y yum-utils  device-mapper-persistent-data  lvm2

配置稳定版仓库

yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

(可选) 开启edge或测试版本

yum-config-manager --enable docker-ce-edge
yum-config-manager --enable docker-ce-test

#或禁止之  
yum-config-manager --disable docker-ce-edge

安装 docker ce

yum install docker-ce

#安装指定版本的docker 
yum install docker-ce-<VERSION STRING>

至此, docker 已经安装, 但是还未启动。
用户组docker已经创建, 但是尚未有任何用户加入之。

启动及自启动

[root@node205 ~]# systemctl enable docker
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.
[root@node205 ~]# systemctl start docker

测试

docker run hello-world

会报错 :

[root@node206 ~]# docker run hello-world
Unable to find image 'hello-world:latest' locally
docker: Error response from daemon: Get https://registry-1.docker.io/v2/: dial tcp: lookup registry-1.docker.io on [::1]:53: read udp [::1]:34303->[::1]:53: read: connection refused.
See 'docker run --help'.

原因 :
这是公司内网环境, 无法直连外网, 是通过代理进行yum安装的, 但是docker拉取镜像时, 无法直接使用代理, 需要进行相应的配置, 详见下篇文章。

docker version

[root@node205 ~]# docker version
Client:
 Version:      18.03.1-ce
 API version:  1.37
 Go version:   go1.9.5
 Git commit:   9ee9f40
 Built:        Thu Apr 26 07:20:16 2018
 OS/Arch:      linux/amd64
 Experimental: false
 Orchestrator: swarm

Server:
 Engine:
  Version:      18.03.1-ce
  API version:  1.37 (minimum version 1.12)
  Go version:   go1.9.5
  Git commit:   9ee9f40
  Built:        Thu Apr 26 07:23:58 2018
  OS/Arch:      linux/amd64
  Experimental: false

相关文章

网友评论

      本文标题:docker安装

      本文链接:https://www.haomeiwen.com/subject/qlyzeftx.html