There is a Dockerfile
in the current directory. Initially we could:
docker build
to build the image- make use of the built image to
docker run
to start the corresponding docker container
But often times there is need to update the Dockerfile
. As a result, there would be the following steps to restart the docker container with the latest update
docker build
to build the image again- kill/stop the running docker container
- remove the image
docker run
to start the docker container again with the updated docker image
But there are 4 steps involved =>
Question: How to minimize the 4 steps above, e.g. rebuild the docker image and restart the updated container in one go like the docker-compose up --build <sevice_name>