Stephen
Stephen

Reputation: 4296

How to quickly update a running docker-compose container

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.

Upvotes: 15

Views: 15140

Answers (2)

Sergei Lubianov
Sergei Lubianov

Reputation: 111

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

Upvotes: 10

dnephin
dnephin

Reputation: 28050

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.

Upvotes: 1

Related Questions