docker bind socket to outside port

I’m using docker. Inside docker I have app that binds listening socket to ip of outside machine (ip of machine where I have docker running). is there any way I can make such listening socket work? that’s bound to outside ip address ( and not docker’s eth0 (

  • Bluemix IBM Container with Mongodb connection failed
  • Can not connect from golang to docker postgres container
  • Deploy a docker container to production
  • click-and-run docker image (or VM) with web interface?
  • Script to clone/snapshot Docker Containers including their Data?
  • Have docker container connect to network devices
  • Docker Remote API JSON schema definition
  • Deploying Elixir App to Google Cloud via Docker
  • Container already stopped error on ECS
  • Docker - Is it possible to recreate volume container without recreating the containers that use it
  • Flow of registration between kafka and zookeeper
  • How to make the external host IP address assigned to container hostname?
  • 2 Solutions collect form web for “docker bind socket to outside port”

    When you run the container map the port to the external port you want to reach it on. docker run -p 80:80 myapp This will let you access the docker container at The command format is -p {external port}:{internal app port}.

    For further clarification. To access any application inside a container you will want to expose the port, see this. Essentially you map a port from the container to the host o/s.

    Example: You have an application running on port 8080 in your container, but you want to access it with your host ip at port 8000. You would run your app like so docker run -p 8000:8080 myapp. This will expose port 8080 to your host o/s as port 8000 at which point you could reach it at {host ip}:8000.

    Okay fixed myself:
    add new ip via “ip addr add”, then make iptable rule to preroute incoming packets to that ip and thats all 🙂

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