How do you quickly update one running service using docker-compose.
I find myself often running docker-compose stop SERVICE
, docker-compose build SERVICE
and docker-compose up -d SERVICE
.
Is there an easier way, preferably with little down time.
In this tutorial, you will use Watchtower with both Docker's run command and Docker Compose to automatically update a Docker image. Both methods are functionally the same in creating a container running Watchtower, then pointing it towards a container you wish to keep automatically updated.
In dev environment I would suggest you to create a volume mapped to your source code tree and setup hot reload.
For production there is an article suggesting the next command:
docker-compose -f docker-compose.prod.yml up --build --no-deps -d SERVICE
If you're having to restart it to pickup code changes you could try using a volume
.
Otherwise the commands you are running are the fastest option. If stop
is taking 10 seconds see https://docs.docker.com/compose/faq/#why-do-my-services-take-10-seconds-to-stop, or consider using docker-compose kill SERVICE
to force shutdown.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With