`

Docker tomcat安装

阅读更多
1.创建目录 /root/mdocker/dockerfiles/test
2.上传jdk-8u45-linux-x64.tar.gz  tomcat.8.tar.gz到1中
3.创建Dockerfile文件

4.
docker images:
REPOSITORY                       TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
hub.c.163.com/library/ubuntu     latest              b47daa16e381        13 days ago         117.3 MB

contents:
FROM hub.c.163.com/library/ubuntu
MAINTAINER test@test.com
#copy jdk and tomcat into image
ADD ./jdk-8u45-linux-x64.tar.gz /root
ADD ./tomcat.8.tar.gz /root
#set environment variable
ENV JAVA_HOME /root/jdk1.8.0_45
ENV PATH $JAVA_HOME/bin:$PATH
#define entry point which will be run first when the container starts up
ENTRYPOINT /root/tomcat/bin/startup.sh && tail -F /root/tomcat/logs/catalina.out

5.查看镜像 docker images
docker images:
REPOSITORY                       TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
samson/ubuntu                    tomcat-test         7c824a2bc3d6        4 days ago          471.6 MB
hub.c.163.com/library/ubuntu     latest              b47daa16e381        13 days ago         117.3 MB

6.构建 docker build -t samson/ubuntu:tomcat-test --rm=true .

7.docker run -i -t -d -p 8090:8080 7c824a2bc3d6 /bin/bash

来张图:



启动多个docker-tomcat容器 绑定不同的端口8090:8080 8091:8080 ...
可安装docker-nginx容器 或主机上安装nginx 达到负载均衡的效果

  • 大小: 296.8 KB
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics