Docker Container's PublicPort via Remote API

How can I get the publicport from a running container by using the remote api? The information does not seem to be available in list or inspect containers. On creation of the container I allowing Docker to set the publicport randomly due to the large number of containers being spun up.

Thanks much for the thoughts.

  • What docker commands does rancher run when I perform an upgrade
  • Does docker swarm mode (docker 1.13 & compose v3) really provides zero downtime rolling updates or deployments?
  • Get host IP in docker container
  • Running docker-container tests on circleCI
  • Can't pull image from docker registry when docker is pointing to a swarm
  • How to start docker container after succesfull wait-for-it script
  • How to get contents generated by a docker container on the local fileystem
  • How to run Google Datalab locally?
  • How to connect to SSHD inside a Docker container from Windows?
  • Is there a way to download a Docker image without Docker daemon?
  • Trying to set up a local DNS using a Docker container - Stuck trying to connect to it
  • Dockerfile: command not found
  • 2 Solutions collect form web for “Docker Container's PublicPort via Remote API”

    It’s listed under NetworkSettings in the inspect:

    curl http://localhost:2375/containers/650eeb3c5d63/json
    bash$ docker port 650eeb3c5d63
    443/tcp ->
    80/tcp ->

    if i’m not mistaken its under

     "HostConfig": {
                "PortBindings": {
                    "3306/tcp": [
                            "HostIp": "",
                            "HostPort": "3309"
                "RestartPolicy": {
                    "Name": "no",
                    "MaximumRetryCount": 0
    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.