Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Dockerfile to run tomcat in an ubuntu container
FROM ubuntu:latest
RUN apt-get -y update && apt-get -y upgrade
RUN apt-get -y install openjdk-8-jdk wget
RUN mkdir /usr/local/tomcat
RUN wget http://www-us.apache.org/dist/tomcat/tomcat-8/v8.5.16/bin/apache-tomcat-8.5.16.tar.gz -O /tmp/tomcat.tar.gz
RUN cd /tmp && tar xvfz tomcat.tar.gz
RUN cp -Rv /tmp/apache-tomcat-8.5.16/* /usr/local/tomcat/
EXPOSE 8080
CMD /usr/local/tomcat/bin/catalina.sh run
@lobster1234

This comment has been minimized.

Copy link
Owner Author

@lobster1234 lobster1234 commented Jul 27, 2017

$ docker build .

$ docker run -d -p 8080:8080 <image_id>

$ curl http://localhost:8080
@Yale96

This comment has been minimized.

Copy link

@Yale96 Yale96 commented Mar 6, 2018

@slrswamy

This comment has been minimized.

Copy link

@slrswamy slrswamy commented Feb 4, 2019

How to configure tomcatuser.xml.. not able to access manager from UI

@mehtakaran9

This comment has been minimized.

Copy link

@mehtakaran9 mehtakaran9 commented Mar 14, 2019

You can get a image from the Docker Hub
FROM tomcat:8.5.38-jre8

@azqsdf

This comment has been minimized.

@LeoLiu1209

This comment has been minimized.

Copy link

@LeoLiu1209 LeoLiu1209 commented Mar 4, 2020

now tomcat8 version is v8.5.51/bin
Download latest version : http://apache.stu.edu.tw/tomcat/tomcat-8/v8.5.51/bin/apache-tomcat-8.5.51.tar.gz

@mcavignesh

This comment has been minimized.

Copy link

@mcavignesh mcavignesh commented Apr 22, 2020

tomcat is started successfully. But http://localhost:port is not opening the tomcat home page. what could be the reason?

@LeoLiu1209

This comment has been minimized.

Copy link

@LeoLiu1209 LeoLiu1209 commented Apr 22, 2020

tomcat is started successfully. But http://localhost:port is not opening the tomcat home page. what could be the reason?
-@mcavignesh try with http://localhost:8080

@NivethaAshokan25

This comment has been minimized.

Copy link

@NivethaAshokan25 NivethaAshokan25 commented Jun 17, 2020

How to configure tomcatuser.xml.. not able to access manager from UI

I am also stuck in that part,
Did you find any clue

@JainTarunJain

This comment has been minimized.

Copy link

@JainTarunJain JainTarunJain commented Jun 27, 2020

change the CMD as
CMD ["/usr/local/tomcat/bin/catalina.sh", "run"]
and tomcat runing by default on port 8080 so change accordingly
OR to run specifically or port 8000, add the following in Dockerfile
RUN sed -i 's/port="8080"/port="8000"/' /usr/local/tomcat/conf/server.xml

@LinkSake

This comment has been minimized.

Copy link

@LinkSake LinkSake commented Sep 27, 2020

Latest Tomcat version -> http://apache.stu.edu.tw/tomcat/tomcat-8/v8.5.58/bin/apache-tomcat-8.5.58.tar.gz
Remember to change the foldername too!

@Vsb19

This comment has been minimized.

Copy link

@Vsb19 Vsb19 commented Dec 28, 2020

Hi,
I fallowed the same process, but the container is not starting..
But the created container is showing in the list of stopped containers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment