Using Docker Compose Print

  • 0

Running several containers together.

WHAT IT PROVIDES

A file describing several services, run with one command.

WHAT IT SUITS

Local development Small single-host deployments Testing environments

WHAT IT DOES NOT SUIT

Several hosts Automatic recovery across machines

WHAT THE FILE DESCRIBES

Services, each with an image or build Ports Volumes Environment Networks Dependencies between services

WHAT DEPENDS-ON ACTUALLY DOES

Controls start order, not readiness.

WHY THAT DISTINCTION MATTERS

A database container starting is not a database accepting connections.

WHAT TO DO ABOUT IT

Health checks, with dependants waiting for healthy status Or applications that retry their connections

WHAT TO PREFER

Applications that retry.

WHY

They then survive the database restarting later, not only at startup.

WHAT THE ESSENTIAL COMMANDS ARE

Start everything, in the background Stop and remove View logs across services Execute a command in one service Rebuild

WHAT TO BE CAREFUL WITH

Removing volumes when tearing down, which deletes data.

WHAT TO KEEP SEPARATE

Development and production files, with overrides.

WHAT TO NEVER PUT IN THE FILE

Real credentials.


Was this answer helpful?
Back

Are you happy with your experience? Leave us a review on Trustpilot.


Trustpilot