Docker安装
root~]# tee /etc/yum.repos.d/docker.repo <<-'EOF'
> [dockerrepo]
> name=Docker Repository
> baseurl=https://yum.dockerproject.org/repo/main/centos/$releasever/
> enabled=1
> gpgcheck=1
> gpgkey=https://yum.dockerproject.org/gpg
> EOF
[dockerrepo]
name=Docker Repository
baseurl=https://yum.dockerproject.org/repo/main/centos/$releasever/
enabled=1
gpgcheck=1
gpgkey=https://yum.dockerproject.org/gpg
root~]# yum install -y docker-engine
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.cn99.com
* extras: mirrors.cn99.com
* updates: mirrors.cn99.com
dockerrepo | 2.9 kB 00:00:00
dockerrepo/7/primary_db | 34 kB 00:00:00
正在解决依赖关系
--> 正在检查事务
---> 软件包 docker-engine.x86_64.0.17.05.0.ce-1.el7.centos 将被 安装
--> 正在处理依赖关系 docker-engine-selinux >= 17.05.0.ce-1.el7.centos,它被软件包 docker-engine-17.05.0.ce-1.el7.centos.x86_64 需要
--> 正在处理依赖关系 libcgroup,它被软件包 docker-engine-17.05.0.ce-1.el7.centos.x86_64 需要
--> 正在处理依赖关系 libseccomp.so.2()(64bit),它被软件包 docker-engine-17.05.0.ce-1.el7.centos.x86_64 需要
--> 正在检查事务
---> 软件包 docker-engine-selinux.noarch.0.17.05.0.ce-1.el7.centos 将被 安装
--> 正在处理依赖关系 policycoreutils-python,它被软件包 docker-engine-selinux-17.05.0.ce-1.el7.centos.noarch 需要
---> 软件包 libcgroup.x86_64.0.0.41-15.el7 将被 安装
---> 软件包 libseccomp.x86_64.0.2.3.1-3.el7 将被 安装
--> 正在检查事务
---> 软件包 policycoreutils-python.x86_64.0.2.5-22.el7 将被 安装
--> 正在处理依赖关系 setools-libs >= 3.3.8-2,它被软件包 policycoreutils-python-2.5-22.el7.x86_64 需要
--> 正在处理依赖关系 libsemanage-python >= 2.5-9,它被软件包 policycoreutils-python-2.5-22.el7.x86_64 需要
--> 正在处理依赖关系 audit-libs-python >= 2.1.3-4,它被软件包 policycoreutils-python-2.5-22.el7.x86_64 需要
--> 正在处理依赖关系 python-IPy,它被软件包 policycoreutils-python-2.5-22.el7.x86_64 需要
--> 正在处理依赖关系 libqpol.so.1(VERS_1.4)(64bit),它被软件包 policycoreutils-python-2.5-22.el7.x86_64 需要
--> 正在处理依赖关系 libqpol.so.1(VERS_1.2)(64bit),它被软件包 policycoreutils-python-2.5-22.el7.x86_64 需要
--> 正在处理依赖关系 libapol.so.4(VERS_4.0)(64bit),它被软件包 policycoreutils-python-2.5-22.el7.x86_64 需要
--> 正在处理依赖关系 checkpolicy,它被软件包 policycoreutils-python-2.5-22.el7.x86_64 需要
--> 正在处理依赖关系 libqpol.so.1()(64bit),它被软件包 policycoreutils-python-2.5-22.el7.x86_64 需要
--> 正在处理依赖关系 libapol.so.4()(64bit),它被软件包 policycoreutils-python-2.5-22.el7.x86_64 需要
--> 正在检查事务
---> 软件包 audit-libs-python.x86_64.0.2.8.1-3.el7 将被 安装
---> 软件包 checkpolicy.x86_64.0.2.5-6.el7 将被 安装
---> 软件包 libsemanage-python.x86_64.0.2.5-11.el7 将被 安装
---> 软件包 python-IPy.noarch.0.0.75-6.el7 将被 安装
---> 软件包 setools-libs.x86_64.0.3.3.8-2.el7 将被 安装
--> 解决依赖关系完成
依赖关系解决
==================================================================================================================
Package 架构 版本 源 大小
==================================================================================================================
正在安装:
docker-engine x86_64 17.05.0.ce-1.el7.centos dockerrepo 19 M
为依赖而安装:
audit-libs-python x86_64 2.8.1-3.el7 base 75 k
checkpolicy x86_64 2.5-6.el7 base 294 k
docker-engine-selinux noarch 17.05.0.ce-1.el7.centos dockerrepo 28 k
libcgroup x86_64 0.41-15.el7 base 65 k
libseccomp x86_64 2.3.1-3.el7 base 56 k
libsemanage-python x86_64 2.5-11.el7 base 112 k
policycoreutils-python x86_64 2.5-22.el7 base 454 k
python-IPy noarch 0.75-6.el7 base 32 k
setools-libs x86_64 3.3.8-2.el7 base 619 k
事务概要
==================================================================================================================
安装 1 软件包 (+9 依赖软件包)
总下载量:21 M
安装大小:76 M
Downloading packages:
(1/10): libcgroup-0.41-15.el7.x86_64.rpm | 65 kB 00:00:00
(2/10): libseccomp-2.3.1-3.el7.x86_64.rpm | 56 kB 00:00:00
(3/10): libsemanage-python-2.5-11.el7.x86_64.rpm | 112 kB 00:00:00
(4/10): checkpolicy-2.5-6.el7.x86_64.rpm | 294 kB 00:00:00
(5/10): policycoreutils-python-2.5-22.el7.x86_64.rpm | 454 kB 00:00:00
(6/10): python-IPy-0.75-6.el7.noarch.rpm | 32 kB 00:00:00
(7/10): audit-libs-python-2.8.1-3.el7.x86_64.rpm | 75 kB 00:00:00
(8/10): setools-libs-3.3.8-2.el7.x86_64.rpm | 619 kB 00:00:00
warning: /var/cache/yum/x86_64/7/dockerrepo/packages/docker-engine-selinux-17.05.0.ce-1.el7.centos.noarch.rpm: Header V4 RSA/SHA512 Signature, key ID 2c52609d: NOKEY
docker-engine-selinux-17.05.0.ce-1.el7.centos.noarch.rpm 的公钥尚未安装
(9/10): docker-engine-selinux-17.05.0.ce-1.el7.centos.noarch.rpm | 28 kB 00:00:01
(10/10): docker-engine-17.05.0.ce-1.el7.centos.x86_64.rpm | 19 MB 00:00:04
------------------------------------------------------------------------------------------------------------------
总计 5.0 MB/s | 21 MB 00:00:04
从 https://yum.dockerproject.org/gpg 检索密钥
导入 GPG key 0x2C52609D:
用户ID : "Docker Release Tool (releasedocker) <docker@docker.com>"
指纹 : 5811 8e89 f3a9 1289 7c07 0adb f762 2157 2c52 609d
来自 : https://yum.dockerproject.org/gpg
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安装 : libcgroup-0.41-15.el7.x86_64 1/10
正在安装 : audit-libs-python-2.8.1-3.el7.x86_64 2/10
正在安装 : checkpolicy-2.5-6.el7.x86_64 3/10
正在安装 : libseccomp-2.3.1-3.el7.x86_64 4/10
正在安装 : libsemanage-python-2.5-11.el7.x86_64 5/10
正在安装 : setools-libs-3.3.8-2.el7.x86_64 6/10
正在安装 : python-IPy-0.75-6.el7.noarch 7/10
正在安装 : policycoreutils-python-2.5-22.el7.x86_64 8/10
正在安装 : docker-engine-selinux-17.05.0.ce-1.el7.centos.noarch 9/10
setsebool: SELinux is disabled.
正在安装 : docker-engine-17.05.0.ce-1.el7.centos.x86_64 10/10
验证中 : libcgroup-0.41-15.el7.x86_64 1/10
验证中 : python-IPy-0.75-6.el7.noarch 2/10
验证中 : setools-libs-3.3.8-2.el7.x86_64 3/10
验证中 : policycoreutils-python-2.5-22.el7.x86_64 4/10
验证中 : libsemanage-python-2.5-11.el7.x86_64 5/10
验证中 : docker-engine-selinux-17.05.0.ce-1.el7.centos.noarch 6/10
验证中 : libseccomp-2.3.1-3.el7.x86_64 7/10
验证中 : docker-engine-17.05.0.ce-1.el7.centos.x86_64 8/10
验证中 : checkpolicy-2.5-6.el7.x86_64 9/10
验证中 : audit-libs-python-2.8.1-3.el7.x86_64 10/10
已安装:
docker-engine.x86_64 0:17.05.0.ce-1.el7.centos
作为依赖被安装:
audit-libs-python.x86_64 0:2.8.1-3.el7 checkpolicy.x86_64 0:2.5-6.el7 docker-engine-selinux.noarch 0:17.05.0.ce-1.el7.centos libcgroup.x86_64 0:0.41-15.el7 libseccomp.x86_64 0:2.3.1-3.el7 libsemanage-python.x86_64 0:2.5-11.el7
policycoreutils-python.x86_64 0:2.5-22.el7 python-IPy.noarch 0:0.75-6.el7 setools-libs.x86_64 0:3.3.8-2.el7
完毕!
root~]# systemctl start docker.service
root~]# docker version
Client:
Version: 17.05.0-ce
API version: 1.29
Go version: go1.7.5
Git commit: 89658be
Built: Thu May 4 22:06:25 2017
OS/Arch: linux/amd64
Server:
Version: 17.05.0-ce
API version: 1.29 (minimum version 1.12)
Go version: go1.7.5
Git commit: 89658be
Built: Thu May 4 22:06:25 2017
OS/Arch: linux/amd64
Experimental: false
root~]# sudo systemctl enable docker
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.
root~]# curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://b7fb3809.m.daocloud.io
docker version >= 1.12
{"registry-mirrors": ["http://b7fb3809.m.daocloud.io"]}
Success.
You need to restart docker to take effect: sudo systemctl restart docker
root~]# sudo systemctl restart docker
root~]# docker search tomcat
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
tomcat Apache Tomcat is an open source implementa... 1872 [OK]
tomee Apache TomEE is an all-Apache Java EE cert... 51 [OK]
dordoka/tomcat Ubuntu 14.04, Oracle JDK 8 and Tomcat 8 ba... 49 [OK]
davidcaste/alpine-tomcat Apache Tomcat 7/8 using Oracle Java 7/8 wi... 24 [OK]
bitnami/tomcat Bitnami Tomcat Docker Image 16 [OK]
consol/tomcat-7.0 Tomcat 7.0.57, 8080, "admin/admin" 16 [OK]
cloudesire/tomcat Tomcat server, 6/7/8 15 [OK]
tutum/tomcat Base docker image to run a Tomcat applicat... 9
jeanblanchard/tomcat Minimal Docker image with Apache Tomcat 8
meirwa/spring-boot-tomcat-mysql-app a sample spring-boot app using tomcat and ... 8 [OK]
aallam/tomcat-mysql Debian, Oracle JDK, Tomcat & MySQL 6 [OK]
rightctrl/tomcat CentOS , Oracle Java, tomcat application s... 3 [OK]
amd64/tomcat Apache Tomcat is an open source implementa... 2
maluuba/tomcat7-java8 Tomcat7 with java8. 2
fabric8/tomcat-8 Fabric8 Tomcat 8 Image 2 [OK]
camptocamp/tomcat-logback Docker image for tomcat with logback integ... 1 [OK]
99taxis/tomcat7 Tomcat7 1 [OK]
primetoninc/tomcat Apache tomcat 8.5, 8.0, 7.0 1 [OK]
oobsri/tomcat8 Testing CI Jobs with different names. 0
jelastic/tomcat 0
swisstopo/service-print-tomcat backend tomcat for service-print "the true... 0
trollin/tomcat 0
s390x/tomcat Apache Tomcat is an open source implementa... 0
picoded/tomcat7 tomcat7 with jre8 and MANAGER_USER / MANAG... 0 [OK]
awscory/tomcat tomcat 0
root~]# docker pull tomcat
Using default tag: latest
latest: Pulling from library/tomcat
cc1a78bfd46b: Pull complete
d2c05365ee2a: Pull complete
231cb0e216d3: Pull complete
e8912f9d0ce2: Pull complete
9bafe362f99b: Pull complete
28b0652112a6: Pull complete
da23e1e20eae: Pull complete
9d809d99b239: Pull complete
18b6ffdd481b: Pull complete
82eee093244d: Pull complete
655dce48e148: Pull complete
777860145dac: Pull complete
Digest: sha256:8d034991b2c0452e0a797fda9e0ada892abb57e8bed14332bf9bf2f122942c8b
Status: Downloaded newer image for tomcat:latest
root~]# docker run -d -p 8081:8080 tomcat
c7e6f99d38801b6b7f33805fcd23341c3d29c7a5482ccc77cd4fbf35b2807d3c
[root@localhost ~REPOSITORY TAG IMAGE ID CREATED SIZE
tomcat latest da0729cd9201 2 days ago 463MB
[root@localhost ~CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
c7e6f99d3880 tomcat "catalina.sh run" 5 minutes ago Up 5 minutes 0.0.0.0:8081->8080/tcp determined_johnson
[root@localhost ~