If I change the exposed port on my docker-compose
, does it change the current container when I run docker-compose up -d
?
If I change the exposed port on my docker-compose
, does it change the current container when I run docker-compose up -d
?
The idea of container in Docker is precisely that it is ephemeral, that is, it can die at any moment. Following this idea, in my opinion, it would not be appropriate to change the port of a container already exists, but instead create a new container and expose the desired port.
In your case, you can change the yaml file being read by docker-compose and change the do something like docker-compose up -d
, this will generate a new container with the changes specified in the configuration file.
Complementing: within your docker-compose configuration file you can specify a Dockerfile and define everything your image will need, so you can destroy and upload the container whenever you need it without needing to stay reinstalling things manually.