随着微服务的流行,Docker越来越流行,正如它的理念”Build, Ship, and Run Any App, Anywhere”一样,Docker提供的容器隔离技术使得开发人员不用再去理清server里的各种环境配置,轻松把应用运行起来。我们只需把运行环境的配置和应用封装在Docker的镜像(image),然后使用Docker运行这个镜像即可。Docker可以说是给所有开发人员的一个福利包,学习和使用Docker是所有开发人员的标配技能。
Another app is currently holding the yum lock; waiting for it to exit...
The other application is: PackageKit
Memory : 12 M RSS (924 MB VSZ)
Started: Mon Jan 2 17:22:13 2017 - 1 day(s) 1:06:13 ago
State : Sleeping, pid: 16208
查看正在yum使用的进程
ps -ef|grep yum
kill掉它即可
kill -9 16208
安装完成,查看安装是否成功
docker info #查看docker的情况
docker --version #查看docker的版本
启动Docker服务
service docker start
启动Docker的hello-world
从Docker Hub下载一个hello-world镜像
docker pull hello-world 运行hello-world镜像
docker run hello-word 输出以下信息
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.
至此,我们已成功运行起第一个Docker容器
tomcat运行环境
1、搜索Docker Hub里的tomcat镜像
docker search tomcat
部分搜索结果如下
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
tomcat Apache Tomcat is an open source implementa... 1132 [OK]
dordoka/tomcat Ubuntu 14.04, Oracle JDK 8 and Tomcat 8 ba... 29 [OK]
cloudesire/tomcat Tomcat server, 6/7/8 12 [OK]
davidcaste/alpine-tomcat Apache Tomcat 7/8 using Oracle Java 7/8 wi... 11 [OK]
andreptb/tomcat Debian Jessie based image with Apache Tomc... 6 [OK]