Rebuilding single services in docker-compose

Note to self: a single service (“container”) out of a docker-compose.yaml file is rebuilt and restarted like this:

docker-compose create container_name

 

While this complains about deprecations, there is another way. Let’s say we want to re-create a container called “web” belonging to a composition:

# stop container

docker-compose stop web

# optionally destroy container. Make sure to mount volumes you care about!
# docker-compose rm web
# Make changes, eg. vi docker-compose.yml
# Then either:

docker-compose create web
docker-compose start web

# or

docker-compose up -d --no-recreate web

As Daniel Nephin writes here: https://github.com/docker/compose/issues/1195#issuecomment-86670031

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s