Docker Community Forums

Share and learn in the Docker community.

Remote access to server running in container

docker

(Larrymartell59) #1

I have a server that runs in a container. It listens on port 8000. The container is started with:

-p 127.0.0.1:48000:8000

Running a client on the same host as the server, and connecting to 48000 works fine. But I need to access the server from a remote host. If I run it remotely and use foo.com:48000 I get no route to host. If I use foo.com:8000 I get 405 Not Allowed, but that is coming from nginx running on foo.com, not from my server (which is running wsgi). How can I remotely access my server running in the container?


(David Maze) #2

The “127.0.0.1” in that docker run -p option means “only listen on localhost and don’t respond to any other interface”. Just remove it, docker run -p 48000:8000 ...