Docker Community Forums

Share and learn in the Docker community.

Persisting containers ports between restart


(Remy Loubradou) #1

I am using the publish all ports feature when creating a container with one port exposed through the Dockerfile, when I start the container the first time it starts with a port but on the subsequent restarts the port changes, I was expecting the container to keep the same port after a restart but it actually changes.

There is something I could do to keep the same port between the restarts while still using a random available port on the first run of the container ?

I found this post but it is old now!topic/docker-user/Py3YHb1C8Jo