This is a memo of the command to be reflected in the image or container after editing and updating Dockerfile or docker-compose.yml. It was unexpectedly simple. In addition, this article introduces the case where multiple containers are managed by docker-compose.
$ docker-compose up -d --build
* The -d option is an option that starts in the background </ small>
I'm adding the --build
option to the docker-compose up command.
Normally when you run docker-compose up,
① Build the Docker image and ② run is executed
Is executed, but if the Docker image is already built,
Only the run of ② is executed.
Therefore, even if you execute the docker-compose up -d
command after updating the Dockerfile,
The new Docker image will not be built and run will be executed based on the old image.
So by adding the --build
option, you can run build and run together.
$ docker-compose up -d
* The -d option is an option that starts in the background </ small>
This is the same as the command to start a container with docker-compose. Based on the updated docker-compose.yml, the container will be rebuilt.
Recommended Posts