Docker Community Forums

Share and learn in the Docker community.

How do I get the tomcat container up and running on Google Cloud Platform?


(Stevenheynderickx) #1

I assume that I have been looking in the wrong places, and that things are all in development and changing but I can’t seem to find a good place where the following items are connected in a good “how to” article:

I wish to see the default Tomcat 7 homepage from a
Tomcat 7 that runs in a container on a
Google optimized for docker container server (https://cloud.google.com/compute/docs/containers/container_vms)

So I have the server… following the instructions on google cloud platform
I have the docker images downloaded on that server and running with following properties:

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
60b206130ef1 tomcat:7 “catalina.sh run” 6 hours ago Up 6 hours 0.0.0.0:32768->8080/tcp hopeful_hoover

I have my external IP-adress for my docker-server (I assume this would also be my docker host as far as I understand)

That server has a firewall that allows http and https traffic…

So what else do I need to do to see the homepage of Tomcat besides typing my external server ip-adress:32768 in my local browser (meaning my homecomputer)

As you may notice from the syntax that I use, I am a newbie, so be patient and ellaborative in your replies please


(Jeff Anderson) #2

Hello,

You mentioned that your firewall allows http and https traffic. generally speaking, firewalls allow that sort of thing strictly by the port number. http is 80, and https is 443. Your are running that container on port 32768. You will probably want to specify what port to map that to rather than allowing docker to choose one for you.

Instead of doing docker run -P or docker run -p 8080, you can specify the port like this: docker run -p 80:8080. That will bind your tomcat’s 8080 to your docker host’s port 80. Your firewall should allow that connection to happen.

/Jeff


(Stevenheynderickx) #3

I was following instructions as given on https://hub.docker.com/_/tomcat/ and used

docker run -it --rm -p 8888:8080 tomcat:8.0

So you say I should try

docker run -it --rm -p 80:8080 tomcat:8.0 ?

Will try and keep you posted, thanks for the swift reply!!


(Stevenheynderickx) #4

I tried

sudo docker run -d -p 80:8080 tomcat:8.0

Worked right away!

So far so good… now I need to figure out a way to get my Laravel project up and running. I know I don’t need the Tomcat for that… but at least I know my server is working.

Any info on Docker and Laravel would be nice… but the initial problem is solved

THANKS!!!