[root@localhost ~]# tee /etc/yum.repos.d/docker.repo <<-'EOF' [dockerrepo] name=Docker Repository baseurl=https://yum.dockerproject.org/repo/main/centos/7/ enabled=1 gpgcheck=1 gpgkey=https://yum.dockerproject.org/gpg EOF
[root@localhost ~]# yum install docker-engine
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.cn99.com
* extras: mirrors.cn99.com
* updates: mirrors.cn99.com
Resolving Dependencies
--> Running transaction check
---> Package docker-engine.x86_64 0:1.12.6-1.el7.centos will be installed
--> Processing Dependency: docker-engine-selinux >= 1.12.6-1.el7.centos for package: docker-engine-1.12.6-1.el7.centos.x86_64
--> Running transaction check
---> Package docker-engine-selinux.noarch 0:1.12.6-1.el7.centos will be installed
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
docker-engine x86_64 1.12.6-1.el7.centos docker-main-repo 19 M
Installing for dependencies:
docker-engine-selinux noarch 1.12.6-1.el7.centos docker-main-repo 28 k
Transaction Summary
================================================================================
Install 1 Package (+1 Dependent package)
Total size: 19 M
Installed size: 79 M
Is this ok [y/d/N]: y
Downloading packages:
warning: /var/cache/yum/x86_64/7/docker-main-repo/packages/docker-engine-1.12.6-1.el7.centos.x86_64.rpm: Header V4 RSA/SHA512 Signature, key ID 2c52609d: NOKEY
GPG key retrieval failed: [Errno 14] curl#7 - "Failed connect to yum.dockerproject.org:443; Connection refused"
[root@localhost ~]# yum remove docker
Loaded plugins: fastestmirror, langpacks
No Match for argument: docker
No Packages marked for removal
[root@localhost ~]# yum remove docker-selinux
Loaded plugins: fastestmirror, langpacks
No Match for argument: docker-selinux
No Packages marked for removal
[root@localhost ~]# cd /etc/yum
yum/ yum.repos.d/
[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# ls
CentOS-Base.repo CentOS-fasttrack.repo CentOS-Vault.repo
CentOS-CR.repo CentOS-Media.repo docker-main.repo
CentOS-Debuginfo.repo CentOS-Sources.repo docker.repo
[root@localhost yum.repos.d]# vi docker.repo
[root@localhost yum.repos.d]# vi docker-main.repo
[root@localhost yum.repos.d]# ls -ralt
total 48
-rw-r--r--. 1 root root 2893 Nov 29 13:12 CentOS-Vault.repo
-rw-r--r--. 1 root root 1331 Nov 29 13:12 CentOS-Sources.repo
-rw-r--r--. 1 root root 630 Nov 29 13:12 CentOS-Media.repo
-rw-r--r--. 1 root root 314 Nov 29 13:12 CentOS-fasttrack.repo
-rw-r--r--. 1 root root 649 Nov 29 13:12 CentOS-Debuginfo.repo
-rw-r--r--. 1 root root 1309 Nov 29 13:12 CentOS-CR.repo
-rw-r--r--. 1 root root 1664 Nov 29 13:12 CentOS-Base.repo
-rw-r--r--. 1 root root 166 Jan 14 20:37 docker-main.repo
drwxr-xr-x. 139 root root 8192 Jan 14 21:13 ..
-rw-r--r--. 1 root root 163 Jan 14 21:17 docker.repo
drwxr-xr-x. 2 root root 230 Jan 14 21:59 .
[root@localhost yum.repos.d]# rm docker-main.repo
rm: remove regular file ‘docker-main.repo’? y
[root@localhost yum.repos.d]# yum install docker-engine
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.cn99.com
* extras: mirrors.cn99.com
* updates: mirrors.cn99.com
Resolving Dependencies
--> Running transaction check
---> Package docker-engine.x86_64 0:1.12.6-1.el7.centos will be installed
--> Processing Dependency: docker-engine-selinux >= 1.12.6-1.el7.centos for package: docker-engine-1.12.6-1.el7.centos.x86_64
--> Running transaction check
---> Package docker-engine-selinux.noarch 0:1.12.6-1.el7.centos will be installed
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
docker-engine x86_64 1.12.6-1.el7.centos dockerrepo 19 M
Installing for dependencies:
docker-engine-selinux noarch 1.12.6-1.el7.centos dockerrepo 28 k
Transaction Summary
================================================================================
Install 1 Package (+1 Dependent package)
Total download size: 19 M
Installed size: 79 M
Is this ok [y/d/N]: y
Downloading packages:
warning: /var/cache/yum/x86_64/7/dockerrepo/packages/docker-engine-selinux-1.12.6-1.el7.centos.noarch.rpm: Header V4 RSA/SHA512 Signature, key ID 2c52609d: NOKEY
Public key for docker-engine-selinux-1.12.6-1.el7.centos.noarch.rpm is not installed
(1/2): docker-engine-selinux-1.12.6-1.el7.centos.noarch.rp | 28 kB 00:02
(2/2): docker-engine-1.12.6-1.el7.centos.x86_64.rpm | 19 MB 01:06
--------------------------------------------------------------------------------
Total 293 kB/s | 19 MB 01:06
Importing GPG key 0x2C52609D:
Userid : "Docker Release Tool (releasedocker) <docker@docker.com>"
Fingerprint: 5811 8e89 f3a9 1289 7c07 0adb f762 2157 2c52 609d
Is this ok [y/N]: y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : docker-engine-selinux-1.12.6-1.el7.centos.noarch 1/2
Re-declaration of boolean virt_sandbox_use_fusefs
Failed to create node
Bad boolean declaration at /etc/selinux/targeted/tmp/modules/100/virt/cil:159
/usr/sbin/semodule: Failed!
libsemanage.semanage_direct_install_info: Overriding docker module at lower priority 100 with module at priority 400.
restorecon: lstat(/var/lib/docker) failed: No such file or directory
warning: %post(docker-engine-selinux-1.12.6-1.el7.centos.noarch) scriptlet failed, exit status 255
Non-fatal POSTIN scriptlet failure in rpm package docker-engine-selinux-1.12.6-1.el7.centos.noarch
Installing : docker-engine-1.12.6-1.el7.centos.x86_64 2/2
Verifying : docker-engine-1.12.6-1.el7.centos.x86_64 1/2
Verifying : docker-engine-selinux-1.12.6-1.el7.centos.noarch 2/2
Installed:
docker-engine.x86_64 0:1.12.6-1.el7.centos
Dependency Installed:
docker-engine-selinux.noarch 0:1.12.6-1.el7.centos
Complete!
[root@localhost yum.repos.d]# systemctl enable docker.service
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.
[root@localhost yum.repos.d]# systemctl start docker
[root@localhost yum.repos.d]# service docker status
Redirecting to /bin/systemctl status docker.service
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
Active: active (running) since Sat 2017-01-14 22:04:48 EST; 14s ago
Main PID: 54164 (dockerd)
Memory: 17.4M
CGroup: /system.slice/docker.service
├─54164 /usr/bin/dockerd
└─54170 docker-containerd -l unix:///var/run/docker/libcontainerd/...
Jan 14 22:04:48 localhost.localdomain dockerd[54164]: time="2017-01-14T22:04:...
Jan 14 22:04:48 localhost.localdomain dockerd[54164]: time="2017-01-14T22:04:...
Jan 14 22:04:48 localhost.localdomain dockerd[54164]: time="2017-01-14T22:04:...
Jan 14 22:04:48 localhost.localdomain dockerd[54164]: time="2017-01-14T22:04:...
Jan 14 22:04:48 localhost.localdomain dockerd[54164]: time="2017-01-14T22:04:...
Jan 14 22:04:48 localhost.localdomain dockerd[54164]: time="2017-01-14T22:04:...
Jan 14 22:04:48 localhost.localdomain dockerd[54164]: time="2017-01-14T22:04:...
Jan 14 22:04:48 localhost.localdomain dockerd[54164]: time="2017-01-14T22:04:...
Jan 14 22:04:48 localhost.localdomain systemd[1]: Started Docker Application ...
Jan 14 22:04:48 localhost.localdomain dockerd[54164]: time="2017-01-14T22:04:...
Hint: Some lines were ellipsized, use -l to show in full.
[root@localhost yum.repos.d]# docker run --rm hello-world
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.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
For more examples and ideas, visit:
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/21818314/viewspace-2135584/
,如需转载,请注明出处,否则将追究法律责任。