Search code examples
javadockertomcattomcat8

Can't reach Tomcat default page in localhost:8080 for Ubuntu 16.04 Docker container


I'm trying to run a simple Tomcat8 server on my Ubuntu 16.04 Docker image. But I can't see the Tomcat default page.

1) I ran this command to run the container docker run -it --entrypoint bash e36658dffbd8

2) I opened up localhost:8080/ after installing tomcat8 in my container but it doesn't work.

Here is my Dockerfile

FROM ubuntu:16.04
# OS: Ubuntu 16.04

# Tomcat Setup
ENV JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64

RUN apt-get update
RUN apt-get install -y tomcat8 openjdk-8-jre-headless exuberant-ctags git telnet subversion mercurial wget inotify-tools unzip sysstat vim procps virtualenv python3-pip

EXPOSE 7443
EXPOSE 8080


Solution

  • You need to tell docker to map the exposed port to a local port:

    docker run -it -p 8080:8080 --entrypoint bash e36658dffbd8
    

    Also, I don't see anything in your dockerfile that will actually install Tomcat, so that would be a different problem.