tomcat 服务器是目前比较流行的开源中间件服务器,下面介绍如何使用 docker 来做一个 tomcat 数据库服务。官方的仓里没有标 OFFICIAL 的 tomcat 的镜像,不过 「tutum」的镜像做的非常好,我们可以直接 pull 他们的镜像来完成我们的操作。
core@localhost ~/base $ docker pull tutum/tomcat:8.0
Pulling repository tutum/tomcat
866eb07a675e: Download complete
511136ea3c5a: Download complete
1c9383292a8f: Download complete
9942dd43ff21: Download complete
d92c3c92fa73: Download complete
0ea0d582fd90: Download complete
cc58e55aa5a5: Download complete
c4ff7513909d: Download complete
3e9890d3403b: Download complete
b9192a10c580: Download complete
28e5e6a80860: Download complete
2128079f9b8f: Download complete
2fdb535bb227: Download complete
af938f214bc9: Download complete
6229ba3a34a8: Download complete
960d19d6cec3: Download complete
5e29a9c87494: Download complete
06466c9ca44e: Download complete
99cabf3c3503: Download complete
d9d23662e1ab: Download complete
c2f8acd8560d: Download complete
e57060590015: Download complete
core@localhost ~/base $ docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
base/163 latest 468d347c06bc 22 hours ago 249.1 MB
test/supervisord latest 468d347c06bc 22 hours ago 249.1 MB
dl.dockerpool.com:5000/ubuntu 14.04 1357f421be38 4 days ago 192.7 MB
ubuntu 14.04 1357f421be38 4 days ago 192.7 MB
dl.dockerpool.com:5000/mysql 5.7 e95cbb9f48ea 6 days ago 258.6 MB
mysql 5.7 e95cbb9f48ea 6 days ago 258.6 MB
mysql latest 9a09222edf60 6 days ago 235.6 MB
tutum/tomcat 8.0 866eb07a675e 6 weeks ago 539.4 MB
core@localhost ~/base $ docker run -d -p 80:8080 tutum/tomcat:8.0
5a02ce457c875638bdc5a460206798cc12c3b8633a754a8745e6d1eda136ac99
core@localhost ~/base $ docker logs 5a0
=> Creating and admin user with a random password in Tomcat
=> Done!
========================================================================
You can now configure to this Tomcat server using:
admin:LfI5jMu2J8ZO
========================================================================
#从 logs 中可以看到tomcat的用户名和密码
...
这样我们的tomcat服务就启动了
更多内容请关注 http://www.dockerpool.com
原文地址:http://blog.csdn.net/smallfish1983/article/details/40107273