Docker container with multiple configurable ports

I have a container that runs a node app with three servers: one server for public data and two webpack servers. By default these run on ports 3000, 3001, and 3002, but these ports can all be configured.

It seems that I would be able to run the container like so:

  • How can I tell if docker has frozen?
  • How to get the Docker version using the Remote API
  • Jupyter R crashes when plotting in docker container
  • Docker, can't reach “rails server” development from localhost:3000 using docker flag -p 3000:3000
  • one docker daemon can support how many docker containers? [closed]
  • GC overhead limit exceeded in Docker when trying to build project by sbt
  • docker run -p 3000:3003 -p 3001:3004 -p 3002:3005 -e 'APP_PORT=3003' \
      -e 'NG_PORT=3004' -e 'RC_PORT=3005' --expose 3003 --expose 3004 --expose 3005 \

    However there are two problems with this approach:

    1. There is a tremendous amount of redundancy
    2. I want the default ports to be used/exposed if nothing is specified

    Is there a simpler way to expose all of the configurable ports whether or not they are changed from the defaults?

  • Error : function_clause while running the docker container for the rabbitmq
  • How to share images between multiple docker hosts?
  • Control lifetime of .NET Core console application hosted in docker
  • Updating rather than replacing ECS Task Definition with CloudFormation
  • How to ssh into GitLab default shared runner?
  • How can i mount volume of glusterfs to /var/lib/docker in ubuntu 14.04
  • One Solution collect form web for “Docker container with multiple configurable ports”

    You wouldn’t want to expose ALL ports, however you can expose and bind by range since at least docker 1.5:

    docker run -p 3000-3002:3003-3005

    I don’t think you need to use –expose when you publish.

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