Docker network – Why docker container responds on 127.0.0.1?

I start up a docker container with a service that runs on port 9324:

docker run -d -p 9324:9324 vsouza/sqs-local

I imagine that this container will run o bridge0 network. So If I run: docker network inspect bridge, I can see that this container is on ip: "IPv4Address": "172.17.0.2/16".

  • Docker permissions development environment using a host mounted volume
  • hotdeploy / hotswap classes using wildfly maven docker intellij
  • Persistence for an ASP.NET 5 Web API running in a Docker container
  • Best way to have Jenkins “update” a running docker container when the image has been updated
  • Getting error ImportMismatchError while running py.test
  • Docker dependency issue: Rake aborted! LoadError: cannot load such file — sqlite3/sqlite3_native
  • The service is responding on both ip: 172.17.0.2:9324 and 127.0.0.1:9324.

    Why this service is responding on 127.0.0.1?

  • How do I attach multiple containers directly to a physical interface?
  • Strange way to launch a background apache/mysql docker container
  • Docker container doesn't work properly on Azure WebApps for Linux, however it works on locally.
  • What is the difference between the `COPY` and `ADD` commands in a Dockerfile?
  • Running wine in ubuntu docker container
  • How to get the dockerTag label via the Artifactory API?
  • One Solution collect form web for “Docker network – Why docker container responds on 127.0.0.1?”

    The -p 9324:9324 tells docker to publish the 9324 port in the container on the host at port 9324. The actual mechanics of that are with some iptables rules to do a masquerade and a dnat on that port (for outbound and inbound traffic respectively). This is frequently done since you don’t always know the ip of each container, and may have your firewall rules configured to block direct access to the container (which you don’t in your environment).

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.