Does changing the Docker-Compose reflect in the current container?

Asked

Viewed 513 times

1

In case I change the door exposed in mine docker-compose, when rotating docker-compose up -d this change will reflect on the current container?

1 answer

1


The idea of a container at Docker is just that it’s ephemeral, which means it could die at any moment. Following this idea, in my view, it would not be appropriate to change the port of a container already exists, but rather create a new container and expose the desired port.

In your case, you can change the file yaml which is being read by Docker-Compose and alter port, later to this could 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 (setting) you can specify a Dockerfile and set everything your image will need, so you can destroy and climb the container whenever you need without having to re-install things manually.

  • 1

    Thanks for the explanation. That already solves my problem.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.