Shared server guidance · Question & answer

How do I validate a Docker Compose configuration without starting containers?

docker compose config resolves and validates the Compose model. The --quiet option checks it without printing the resulting configuration, which can contain secrets after variable interpolation. Validation is useful before deployment but does not prove that an image can start or an application will work.

BeginnerLinux servers with Docker Compose v2
Go to the answer

Before you start

  • The approved Compose file, project name and required environment inputs.
  • The same file and environment options used by the actual deployment.

Instructions

1. Confirm the intended project inputs

Use an explicit file path and the existing project name. A different project name can create a separate set of containers and networks during a later deployment, so do not invent one for an existing service.

2. Validate quietly

Replace the example path and project name with the real deployment values. Include any additional approved -f or --env-file options in the same order as the deployment.

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

Validates the resolved configuration without printing the full model.

3. Inspect non-secret service names

Check that the expected application services are present. Avoid sharing unfiltered config or --environment output because interpolated credentials may be included.

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

Lists defined service names without launching them.

Check the result

  • Quiet validation returns successfully and the intended services are present in the correct project configuration.

Troubleshooting

A required variable is missing
Supply it through the approved secret or environment mechanism. Do not hard-code a live password into the Compose file merely to pass validation.
Validation succeeds but startup later fails
Check image availability, application configuration, ports and runtime dependencies; model validation cannot exercise those behaviours.

Official references

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