Docker Community Forums

Share and learn in the Docker community.

How do you create assign ports for different containers on a remote server

I have four different instances of a Docker Container on a remote site. They are all of the same containers but for different people to work on the site. Right now, no matter which container a person is working on, the changes go to the same port 8080. Is there a way to assign a different port to each person’s container? This is a test site where everyone can make changes and then push their changes back to the git repository.

I’m pretty new to Docker. Any help would be greatly appreciated.

How does everyone access a different container? I assume you’re using some different -p (a.k.a. --publish) port mapping for each container?

Depends on how they use/start them?

Maybe this is what you’re looking for, in your run command:

The -P option publishes all the ports to the host interfaces. Docker binds each exposed port to a random port on the host.