Docker with multiple exposed ports
docker run --name test -d -p 1000:1000 -p 1001:1001 -p 1002:1002 docker_image
Only the Express server is working fine on the host computer. However, when I log into the container and do
curl, all three servers are responding just fine.
Any ideas what is going on with multiple port bindings with docker/host?
One Solution collect form web for “Docker with multiple exposed ports”
Once you do the following:
- EXPOSE ports on the DockerFile
- set -p flag for each port to expose externally
You just need to make sure that your services allows external connections.
i.e. for python flask: http://dixu.me/2015/10/26/How_to_Allow_Remote_Connections_to_Flask_Web_Service/ the default listen is localhost. Make sure it’s listening on 0.0.0.0