Shared server guidance · Question & answer

How do I update one Docker Compose service without restarting its unrelated dependencies?

Compose can apply an image or configuration update to one named service. The --no-deps option avoids starting linked dependencies as part of that command, but the selected service may still restart and its startup code can perform application work. Plan the change around that service’s real state and compatibility requirements.

IntermediateDocker Compose v2 deployments on Linux
Go to the answer

Before you start

  • An approved image/configuration change for one named service.
  • The exact existing project name and Compose inputs.
  • A documented compatible previous release and application rollback criteria.

Instructions

1. Validate the intended project

Use the same files, project name and environment inputs as the running deployment. Review the selected image reference and any startup migrations before applying it.

Remote Linux shell
docker compose -f /srv/app/compose.yaml -p example-app config --quiet

Checks the resolved model without printing potentially sensitive configuration.

2. Pull and apply only the selected service

Run the update only after the image pull succeeds. Replace web with the exact approved service name; do not add volume-removal or orphan-removal options.

Remote Linux shell
docker compose -f /srv/app/compose.yaml -p example-app pull web

Downloads the image for the selected service without starting a new container.

Remote Linux shell
docker compose -f /srv/app/compose.yaml -p example-app up -d --no-deps web

Reconciles the selected service in detached mode while leaving dependency startup out of this command.

3. Check the deployed behaviour

Review state, bounded logs and an application request. A container can be running while the service is still unready.

Remote Linux shell
docker compose -f /srv/app/compose.yaml -p example-app ps web
docker compose -f /srv/app/compose.yaml -p example-app logs --tail 50 web

Inspects only the selected service after deployment.

Check the result

  • The service uses the approved release, application checks pass and its dependencies remain healthy.

Troubleshooting

The new release changes a database schema
A container-image rollback may not reverse a schema migration. Follow the application’s compatibility and recovery plan before proceeding.

Official references

Use the documentation for your installed version when a flag, service name or platform feature differs.