Linux CentOS7 安装Docker

安装Docker

wget -qO- https://get.docker.com/|sh

[root@localhost ~]# wget -qO- https://get.docker.com/|sh
# Executing docker install script, commit: fc04d2c
+ sh -c 'yum install -y -q yum-utils'
+ sh -c 'yum-config-manager --add-repo https://download.docker.com/linux/centos/                                                                   docker-ce.repo'
Loaded plugins: fastestmirror
adding repo from: https://download.docker.com/linux/centos/docker-ce.repo
grabbing file https://download.docker.com/linux/centos/docker-ce.repo to /etc/yu                                                                   m.repos.d/docker-ce.repo
repo saved to /etc/yum.repos.d/docker-ce.repo
+ '[' edge '!=' stable ']'
+ sh -c 'yum-config-manager --enable docker-ce-edge'
Loaded plugins: fastestmirror
============================= repo: docker-ce-edge =============================
[docker-ce-edge]
async = True
bandwidth = 0
base_persistdir = /var/lib/yum/repos/x86_64/7
baseurl = https://download.docker.com/linux/centos/7/x86_64/edge
cache = 0
cachedir = /var/cache/yum/x86_64/7/docker-ce-edge
check_config_file_age = True
compare_providers_priority = 80
cost = 1000
deltarpm_metadata_percentage = 100
deltarpm_percentage =
enabled = 1
enablegroups = True
exclude =
failovermethod = priority
ftp_disable_epsv = False
gpgcadir = /var/lib/yum/repos/x86_64/7/docker-ce-edge/gpgcadir
gpgcakey =
gpgcheck = True
gpgdir = /var/lib/yum/repos/x86_64/7/docker-ce-edge/gpgdir
gpgkey = https://download.docker.com/linux/centos/gpg
hdrdir = /var/cache/yum/x86_64/7/docker-ce-edge/headers
http_caching = all
includepkgs =
ip_resolve =
keepalive = True
keepcache = False
mddownloadpolicy = sqlite
mdpolicy = group:small
mediaid =
metadata_expire = 21600
metadata_expire_filter = read-only:present
metalink =
minrate = 0
mirrorlist =
mirrorlist_expire = 86400
name = Docker CE Edge - x86_64
old_base_cache_dir =
password =
persistdir = /var/lib/yum/repos/x86_64/7/docker-ce-edge
pkgdir = /var/cache/yum/x86_64/7/docker-ce-edge/packages
proxy = False
proxy_dict =
proxy_password =
proxy_username =
repo_gpgcheck = False
retries = 10
skip_if_unavailable = False
ssl_check_cert_permissions = True
sslcacert =
sslclientcert =
sslclientkey =
sslverify = True
throttle = 0
timeout = 30.0
ui_id = docker-ce-edge/x86_64
ui_repoid_vars = releasever,
   basearch
username =

+ sh -c 'yum makecache'
Loaded plugins: fastestmirror
base                                                     | 3.6 kB     00:00
docker-ce-edge                                           | 2.9 kB     00:00
docker-ce-stable                                         | 2.9 kB     00:00
extras                                                   | 3.4 kB     00:00
updates                                                  | 3.4 kB     00:00
(1/6): docker-ce-edge/x86_64/primary_db                    |  14 kB   00:00
(2/6): docker-ce-edge/x86_64/filelists_db                  | 8.3 kB   00:00
(3/6): docker-ce-edge/x86_64/other_db                      |  61 kB   00:00
(4/6): docker-ce-stable/x86_64/primary_db                  |  11 kB   00:01
(5/6): docker-ce-stable/x86_64/other_db                    |  65 kB   00:00
(6/6): docker-ce-stable/x86_64/filelists_db                | 6.9 kB   00:03
Loading mirror speeds from cached hostfile
 * base: mirrors.163.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.cn99.com
Metadata Cache Created
+ sh -c 'yum install -y -q docker-ce'
http://mirrors.shu.edu.cn/centos/7.4.1708/extras/x86_64/Packages/pigz-2.3.3-1.el                                                                   7.centos.x86_64.rpm: [Errno 12] Timeout on http://mirrors.shu.edu.cn/centos/7.4.                                                                   1708/extras/x86_64/Packages/pigz-2.3.3-1.el7.centos.x86_64.rpm: (28, 'Operation                                                                    too slow. Less than 1000 bytes/sec transferred the last 30 seconds')
Trying other mirror.
https://download.docker.com/linux/centos/7/x86_64/edge/Packages/docker-ce-18.02.                                                                   0.ce-1.el7.centos.x86_64.rpm: [Errno 12] Timeout on https://download.docker.com/                                                                   linux/centos/7/x86_64/edge/Packages/docker-ce-18.02.0.ce-1.el7.centos.x86_64.rpm                                                                   : (28, 'Operation too slow. Less than 1000 bytes/sec transferred the last 30 sec                                                                   onds')
Trying other mirror.
warning: /var/cache/yum/x86_64/7/docker-ce-edge/packages/docker-ce-18.02.0.ce-1.                                                                   el7.centos.x86_64.rpm: Header V4 RSA/SHA512 Signature, key ID 621e9f35: NOKEY
Public key for docker-ce-18.02.0.ce-1.el7.centos.x86_64.rpm is not installed
Importing GPG key 0x621E9F35:
 Userid     : "Docker Release (CE rpm) <docker@docker.com>"
 Fingerprint: 060a 61c5 1b55 8a7f 742b 77aa c52f eb6b 621e 9f35
 From       : https://download.docker.com/linux/centos/gpg
If you would like to use Docker as a non-root user, you should now consider
adding your user to the "docker" group with something like:

  sudo usermod -aG docker your-user

Remember that you will have to log out and back in for this to take effect!

WARNING: Adding a user to the "docker" group will grant the ability to run
         containers which can be used to obtain root privileges on the
         docker host.
         Refer to https://docs.docker.com/engine/security/security/#docker-daemo                                                                   n-attack-surface
         for more information.

提示:warning: /var/cache/yum/x86_64/7/docker-ce-edge/packages/docker-ce-18.02.0.ce-1. el7.centos.x86_64.rpm: Header V4 RSA/SHA512 Signature, key ID 621e9f35: NOKEY Public key for docker-ce-18.02.0.ce-1.el7.centos.x86_64.rpm is not installed

本意:docker-ce-18.02.0.ce-1.el7.centos.x86_64.rpm 公钥未安装,key没有导入

 

[root@localhost ~]# wget  https://get.docker.com/gpg
--2018-03-01 23:30:16--  https://get.docker.com/gpg
Resolving get.docker.com (get.docker.com)... 54.192.212.188, 54.192.212.223, 54.                                                                   192.212.14, ...
Connecting to get.docker.com (get.docker.com)|54.192.212.188|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 975 [binary/octet-stream]
Saving to: ‘gpg’

100%[======================================>] 975         --.-K/s   in 0s

2018-03-01 23:30:18 (122 MB/s) - ‘gpg’ saved [975/975]

[root@localhost ~]# rpmkeys --import ./gpg

 

启动docker

[root@localhost ~]# systemctl start docker.service

查看docker

[root@localhost ~]# docker version
Client:
 Version:       18.02.0-ce
 API version:   1.36
 Go version:    go1.9.3
 Git commit:    fc4de44
 Built: Wed Feb  7 21:14:12 2018
 OS/Arch:       linux/amd64
 Experimental:  false
 Orchestrator:  swarm

Server:
 Engine:
  Version:      18.02.0-ce
  API version:  1.36 (minimum version 1.12)
  Go version:   go1.9.3
  Git commit:   fc4de44
  Built:        Wed Feb  7 21:17:42 2018
  OS/Arch:      linux/amd64
  Experimental: false

可以看到docker的客户端和服务端的信息,则docker服务启动成功

 

posted on 2018-03-05 11:49  婵婵  阅读(3238)  评论(0编辑  收藏  举报

导航