Understanding docker port mappings

Please explain the following output:

docker ps ExanpleContainter

Ports
--------
10.10.10.10:443->443/tcp, 0.0.0.0:1937->1937/tcp

And,

  • Docker: cannot open port 8080
  • Docker with Compose and Swarm
  • Docker OSX disc storage
  • Cache gems in GitLab CI bundle build
  • How to get remote access to a private docker-registry?
  • Is there any reason to favour concatenated RUN directives over RUNning a script?
  • docker inspect ExanpleContainter
    
    "Ports": {
                    "1937/tcp": [
                        {
                            "HostIp": "0.0.0.0",
                            "HostPort": "1937"
                        }
                    ],
                    "443/tcp": [
                        {
                            "HostIp": "10.10.10.10",
                            "HostPort": "443"
                        }
                    ]
    

    I’d want to understand how mapping is done and which port is mapped where?

  • Environment based connection string with ASP NET CORE and Docker support
  • Call rabbitmq from nodejs
  • Docker container with entrypoint variable expansion and CMD parameters
  • Storing base java project inside child project jar (maven, docker)
  • Mounting a single file from a Docker data volume in a Docker
  • How to add variable to docker daemon in CentOS?
  • One Solution collect form web for “Understanding docker port mappings”

    10.10.10.10:443->443/tcp

    This means docker host IP 10.10.10.10 on port 443 is mapped to specified container on port 443. packets arriving at that ip port combination will be accessible in the container on the same port (443)

    0.0.0.0:1937->1937/tcp

    Packets arriving on all available IP addresses (0.0.0.0) on docker host on port 1937 are accessible on specified container on the same port (1937)

    Read explanation in the answer and compare it to output of docker inspect ExanpleContainter.

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