首页 > 其他 > 详细

基于Alpine搭建Tomcat环境

时间:2022-05-27 21:26:48      阅读:17      评论:0      收藏:0      [点我收藏+]

编写Dockerfile

[root@node2 ~]# vim Dockerfile
FROM alpine:3.13.6

RUN set -x;     echo "http://mirrors.aliyun.com/alpine/latest-stable/main/" > /etc/apk/repositories &&     echo "http://mirrors.aliyun.com/alpine/latest-stable/community/" >> /etc/apk/repositories &&     apk upgrade &&     apk add --no-cache ca-certificates &&     apk add --no-cache unzip curl bash bash-doc bash-completion bash wget vim net-tools &&     rm -rf /tmp/* /var/cache/apk/*

RUN /bin/bash

# set glibc
RUN wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.32-r0/glibc-2.32-r0.apk     https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.32-r0/glibc-bin-2.32-r0.apk     https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.32-r0/glibc-i18n-2.32-r0.apk     https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.32-r0/glibc-dev-2.32-r0.apk

RUN wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub

RUN apk add glibc-2.32-r0.apk glibc-bin-2.32-r0.apk glibc-dev-2.32-r0.apk glibc-i18n-2.32-r0.apk &&     rm -rf *.apk

ADD jdk-8u301-linux-x64.tar.gz apache-tomcat-9.0.53.tar.gz /

RUN mv /apache-tomcat-9.0.53  /tomcat9 &&     rm -rf /tomcat9/webapps/{docs,examples,host-manager,manager}

# install JRE
RUN apk add --no-cache openjdk8-jre-base &&     rm -rf /var/cache/apk/*


COPY Shanghai /etc/localtime

ENV JAVA_HOME=/jdk1.8.0_301
ENV CLASSPATH=JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
ENV PATH=$PATH:.JAVA_HOME/bin:$PATH

EXPOSE 8080

CMD ["/tomcat9/bin/catalina.sh","run"]

构建镜像

[root@node2 ~]# docker build -t alpine:v1 .

创建容器

该步可自定义添加其他参数

[root@node2 ~]# docker run -itd --name tomcat1 -p 8080:8080 alpine:v1

基于Alpine搭建Tomcat环境

原文:https://www.cnblogs.com/smlile-you-me/p/15347413.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!