一、安装步骤
1.tomcat
[root@iZbp10d5h2h0qbsabf055iZ /]# docker pull tomcat
Using default tag: latest
latest: Pulling from library/tomcat
b9a857cbf04d: Pull complete
d557ee20540b: Pull complete
3b9ca4f00c2e: Pull complete
667fd949ed93: Pull complete
661d3b55f657: Pull complete
511ef4338a0b: Pull complete
a56db448fefe: Pull complete
00612a99c7dc: Pull complete
326f9601c512: Pull complete
c547db74f1e1: Pull complete
Digest: sha256:94cc18203335e400dbafcd0633f33c53663b1c1012a13bcad58cced9cd9d1305
Status: Downloaded newer image for tomcat:latest
docker.io/library/tomcat:latest
#通过镜像开启tomcat容器
[root@iZbp10d5h2h0qbsabf055iZ /]# docker run -d --name tomcat01 -p 3355:8080 tomcat
4925be86e9755df7f524b35f3b01a6ac2da8c93da78985195d6698b6b40d0f47
#进入tomcat容器内部。
[root@iZbp10d5h2h0qbsabf055iZ /]# docker exec -it tomcat01 /bin/bash
root@4925be86e975:/usr/local/tomcat# ls
BUILDING.txt LICENSE README.md RUNNING.txt conf logs temp webapps.dist
CONTRIBUTING.md NOTICE RELEASE-NOTES bin lib native-jni-lib webapps work
root@4925be86e975:/usr/local/tomcat# cd /
root@4925be86e975:/# ls
bin boot dev etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var
root@4925be86e975:/#
2.nginx
#安装nginx
[root@iZbp10d5h2h0qbsabf055iZ /]# docker pull nginx
Using default tag: latest
latest: Pulling from library/nginx
a076a628af6f: Already exists
0732ab25fa22: Pull complete
d7f36f6fe38f: Pull complete
f72584a26f32: Pull complete
7125e4df9063: Pull complete
Digest: sha256:10b8cc432d56da8b61b070f4c7d2543a9ed17c2b23010b43af434fd40e2ca4aa
Status: Downloaded newer image for nginx:latest
docker.io/library/nginx:latest
#以后台方式运行nginx
[root@iZbp10d5h2h0qbsabf055iZ /]# docker run -d --name nginx01 -p 3340:80 nginx
a1ca5d2026a161f2f1c01f7ff60766f4dd1abc7d29abfca57348761b6de24e04
#查看运行的容器列表
[root@iZbp10d5h2h0qbsabf055iZ /]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
a1ca5d2026a1 nginx "/docker-entrypoint.…" 15 seconds ago Up 14 seconds 0.0.0.0:3340->80/tcp nginx01
ad6675bc8ae7 centos "/bin/sh -c 'while t…" 11 hours ago Up 11 hours wonderful_mestorf
6f2c69f266fe centos "/bin/bash" 11 hours ago Up 11 hours blissful_cohen
3、elasticsearch
[root@iZbp10d5h2h0qbsabf055iZ /]# docker pull elasticsearch
Using default tag: latest
latest: Pulling from library/elasticsearch
05d1a5232b46: Pull complete
5cee356eda6b: Pull complete
89d3385f0fd3: Pull complete
65dd87f6620b: Pull complete
78a183a01190: Pull complete
1a4499c85f97: Pull complete
2c9d39b4bfc1: Pull complete
1b1cec2222c9: Pull complete
59ff4ce9df68: Pull complete
1976bc3ee432: Pull complete
5af49e8af381: Pull complete
42c8b75ff7af: Pull complete
7e6902915254: Pull complete
99853874fa54: Pull complete
596fbad6fcff: Pull complete
为了解决这个问题,我们在elasticsearch容器启动的时候,通过修改配置文件增加内存的限制。
[root@iZbp10d5h2h0qbsabf055iZ /]# docker run -d --name elasticsearch02 -p 9200:9200 -e "discovery.type=single-node" -e ES_JAVA_OPTS="-Xms64m -Xmx512m" elasticsearch
0636068c87a20bc0a4927c4ccb4e81df584d528aacf8f81d758769888c656cae
#docker stats可以查看docker的状态。
[root@iZbp10d5h2h0qbsabf055iZ /]# docker stats
CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
0636068c87a2 elasticsearch02 0.02% 212.4MiB / 1.795GiB 11.56% 0B / 0B 0B / 123kB 33
#运行elasticsearch容器
[root@iZbp10d5h2h0qbsabf055iZ /]# docker exec -it elasticsearch02 /bin/bash
root@0636068c87a2:/usr/share/elasticsearch# ls
NOTICE.txt README.textile bin config data lib logs modules plugins
root@0636068c87a2:/usr/share/elasticsearch#
二、总结
支持,一些基本的安装过程已经讲解完毕啦嘿嘿。开心!