docker: cannot map two container ports to one host port

app.json for pm2 (src/ is Flask app):

    "apps": [
      "exec_mode": "fork",
      "script": "src/",
      "args": ["-p", "8080"]
      "exec_mode": "fork",
      "script": "src/",
      "args": ["-p", "8081"]


  • Linux Container vs JVM
  • Docker virtual host cached
  • Docker: How to create a stack, multiple images or one base image?
  • docker registry with s3
  • Where is the new docker hub api documentation?
  • How to route ports between docker containers on ubuntu host
  • EXPOSE 8080 8081
    CMD ["pm2", "start", "app.json"]

    Error when running docker:

    docker run -p 8080:8080 -p 8080:8081 oct20
    docker: Error response from daemon: driver failed programming external connectivity on endpoint high_fermi (xxxxxxxxxxx): Bind for failed: port is already allocated.

    Any ideas? Thanks

  • When, where and how does Visual Studio 2017 set the DOCKER_BUILD_SOURCE environment variable
  • Building a Dockerfile with Vagrant and the Docker provider: multi-line command chaining returns error
  • error response from daemon: no such container: dionaea
  • Docker interrupt proxy internet connection
  • Docker best practices: single process for a container
  • Vagrant docker shellinit?
  • One Solution collect form web for “docker: cannot map two container ports to one host port”

    You can’t have two things listening on one port in the host – whether they’re separate ports in one container, or two Docker containers, or two other apps. It’s not a Docker limitation, it’s part of the OS networking stack.

    Where would the host send a request to port 8080 if you could do that in this case? To port 8080 in the container, or port 8081, or multicast it to both?

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