Git, containers and DevOps

Command docker compose

Manage multi-container projects

Linux · Bash examples · commands run on the selected server

When to use docker compose

Use docker compose to manage a defined multi-container project. Confirm the Compose file, environment and project context first so that inspection or later changes target the intended application stack.

Syntax

docker compose [PARAMETERS] COMMAND

Square brackets mark optional arguments; an ellipsis means repetition. Replace example file names, user names and server addresses with your own values.

Common options and arguments

-f FILE
Explicitly select the Compose file.
ps
Show the status of the project services.
logs
Read service logs; --tail limits output.

Usage examples

Check the syntax and structure of the project

docker compose config --quiet

The merged configuration is validated quietly; success normally prints no configuration content.

View project status

docker compose ps

Containers associated with the selected project are listed.

View service log

docker compose logs --tail 100 web

A bounded log tail is requested for the named service.

Notes and limitations

  • These examples use the Compose V2 plugin: docker compose, with a space rather than a hyphen.
  • up, down and down -v change project state. -v can remove data volumes. config without --quiet can expose substituted secrets.

Common questions and troubleshooting

Why is docker-compose different from docker compose?

The hyphenated command commonly refers to the older standalone interface; the spaced form uses the Docker CLI plugin. Check the installed tool and supported configuration.

Does configuration validation prove the app will run?

No. Valid syntax and configuration do not verify image availability, credentials, storage permissions or application health.

Further help

Options vary by version and distribution. Check the installed documentation with this command: docker compose --help.