Can’t connect to the server running in your container? Let’s see why, and how to fix it, starting with an example. By by Itamar Turner-Trauring.
This is hands on tutorial, explaining common Docker networking issues in case you are not able to connect to your Docker containers. To understand how to solve various networking issues, you need to know a minimal amount about how Docker’s networking works.
Source: https://pythonspeed.com/articles/docker-connection-refused/
In particular, this article will cover:
- Networking namespaces, and how Docker uses them
- Networking without Docker
- Network namespaces
- What docker run -p 5000:5000 does, and why our example above doesn’t work
- Docker run port-forwarding (is not enough)
- How to fix your image so the server is accessible
- The solution: listen on all interfaces
By default, containers run in their own network namespaces, with their own IP addresses. Links to more resources provided together with link to a book: Just Enough Docker Packaging. Nice one!
[Read More]