Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't get docker to accept request over the internet

So, I'm trying to get Jenkins working inside of docker as an exercise to get experience using docker. I have a small linux server, running Ubuntu 14.04 in my house (computer I wasn't using for anything else), and have no issues getting the container to start up, and connect to Jenkins over my local network.

My issue comes in when I try to connect to it from outside of my local network. I have port 8080 forwarded to the serve with the container, and if I run a port checker it says the port is open. However, when I actually try and go to my-ip:8080, I will either get nothing if I started the container just with -p 8080:8080 or "Error: Invalid request or server failed. HTTP_Proxy" if I run it with -p 0.0.0.0:8080:8080.

I wanted to make sure it wasn't jenkins, so I tried getting just a simple hello world flask application to work, and had the exact same issue. Any recommendations? Do I need to add anything extra inside Ubuntu to get it to allow outside connections to go to my containers?

EDIT: I'm also just using the official Jenkins image from docker hub.

like image 816
Adam LeBlanc Avatar asked Aug 21 '15 23:08

Adam LeBlanc


1 Answers

If you are running this:

docker run -p 8080:8080 jenkins

Then to connect to jenkins you will have to connect to (in essence you are doing port forwarding):

http://127.0.0.1:8080 or http://localhost:8080

If you are just running this:

docker run jenkins

You can connect to jenkins using the container's IP

http://<containers-ip>:8080

The Dockerfile when the Jenkins container is built already exposes port 8080

like image 58
Rico Avatar answered Oct 12 '22 20:10

Rico