docker remote api cannot bind a port to a host

I was trying to use docker‘s remote api to bind a host, but it always fails.

I pass this dict using python and urllib2:

  • Python exceptions in Docker logs marked as stream: stdout
  • my proxy in docker wont link my url to port
  • Updating docker images with small changes using commits
  • Run Different Linux OS in Docker Container?
  • unable to run docker container using marathon
  • Docker-compose up causing client is newer than server error
  • {

    Then I use remote api to inspect container, it gives me the following:


    I also tried to use the method in this link Binding a port to a host interface using the REST API,
    but when I posted data to start the container, it will raise HTTP Error 500. So I guess whether the docker remote api had been changed.

  • Node error ENOSPC when running pm2 with docker-compose
  • Cloud9 - is there a way to use ssh workspaces with standalone?
  • How to avoid redundancy and time loss when re-building images during development?
  • Docker fails to start due to “volume store metadata database: timeout”
  • how to list the nodes in docker swarm via api call?
  • jax-rs client is not creating jax-rs cookie
  • One Solution collect form web for “docker remote api cannot bind a port to a host”

    Looks like your PortBindings parameter is slightly off. You’re missing "HostPort":

    Change it to:

    'HostConfig':{'PortBindings':{'80/tcp':[{ "HostPort": '15080' }] }}

    From the docs:

    • PortBindings – A map of exposed container ports and the host port they should map to. It should be specified in the form {
      <port>/<protocol>: [{ “HostPort”: “<port>” }] } Take note that port
      is specified as a string and not an integer value.
    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.