Ravindra BagaleCourses & study guides मराठी

Ravi Sir's Cards › DevOps

Chapter 53: Docker Compose Tutorial: Services, depends_on Healthchecks, Env Files, Profiles, Overrides, Scaling and Every Command: Cards

मराठी cards · Open the chapter

Revision cards

Why Docker Compose. Multi-container apps are painful with plain docker run.
Revision card 1 of 9: Why Docker Compose · Download PNG · Open card page

Lesson: 53.1 Why Compose: one file for the whole app

Compose service keys. Every service is built from the same few keys.
Revision card 2 of 9: Compose service keys · Download PNG · Open card page

Lesson: 53.2 Service keys: build, image, command, environment, ports, restart

depends_on with healthchecks. Started is not ready; apps crash on early connects.
Revision card 3 of 9: depends_on with healthchecks · Download PNG · Open card page

Lesson: 53.3 depends_on with healthchecks: start in the right order

Env files, interpolation and secrets. Config must change per environment without editing YAML.
Revision card 4 of 9: Env files, interpolation and secrets · Download PNG · Open card page

Lesson: 53.4 Environment files, interpolation and secrets

Volumes and networks in Compose. Data and network design belong in the same file.
Revision card 5 of 9: Volumes and networks in Compose · Download PNG · Open card page

Lesson: 53.5 Volumes and networks in Compose

Compose profiles. Not every service should start every time.
Revision card 6 of 9: Compose profiles · Download PNG · Open card page

Lesson: 53.6 Profiles: optional services

Overrides, include and extends. Dev and prod differ a little, not completely.
Revision card 7 of 9: Overrides, include and extends · Download PNG · Open card page

Lesson: 53.7 Override files, multiple -f, include and extends

Scaling, watch and a 3-tier app. Real apps have layers and need more copies under load.
Revision card 8 of 9: Scaling, watch and a 3-tier app · Download PNG · Open card page

Lesson: 53.8 Scaling, watch mode and the full 3-tier stack

Every docker compose command. Daily work uses ten commands again and again.
Revision card 9 of 9: Every docker compose command · Download PNG · Open card page

Lesson: 53.9 Every docker compose command: full reference

Interview cards

What is Docker Compose? A tool to define and run multi-container apps from compose.yaml. v2 is the docker compose plugin (with a space).
Interview card 1 of 9: What is Docker Compose? · Download PNG · Open card page

Lesson: 53.1 Why Compose: one file for the whole app

build vs image in Compose? image pulls a ready image; build builds from a context. With both, the built image gets that name.
Interview card 2 of 9: build vs image in Compose? · Download PNG · Open card page

Lesson: 53.2 Service keys: build, image, command, environment, ports, restart

Does depends_on wait until the DB is ready? Not by default; it only orders starts. With condition: service_healthy and a db healthcheck, it waits.
Interview card 3 of 9: Does depends_on wait until the DB is ready? · Download PNG · Open card page

Lesson: 53.3 depends_on with healthchecks: start in the right order

.env vs env_file? .env is read by Compose for ${VAR} substitution in YAML. env_file sends variables into the container.
Interview card 4 of 9: .env vs env_file? · Download PNG · Open card page

Lesson: 53.4 Environment files, interpolation and secrets

Does docker compose down delete volumes? No. down removes containers and networks; add -v to delete named volumes too.
Interview card 5 of 9: Does docker compose down delete volumes? · Download PNG · Open card page

Lesson: 53.5 Volumes and networks in Compose

What are Compose profiles? Labels on services; services with a profile start only when that profile is enabled (--profile or COMPOSE_PROFILES).
Interview card 6 of 9: What are Compose profiles? · Download PNG · Open card page

Lesson: 53.6 Profiles: optional services

How does Compose merge files? It reads compose.yaml plus compose.override.yaml automatically, or the -f list in order; later values win.
Interview card 7 of 9: How does Compose merge files? · Download PNG · Open card page

Lesson: 53.7 Override files, multiple -f, include and extends

Why does --scale fail with ports: 8080:8080? Each copy tries the same host port. Publish only the container port or put a proxy in front.
Interview card 8 of 9: Why does --scale fail with ports: 8080:8080? · Download PNG · Open card page

Lesson: 53.8 Scaling, watch mode and the full 3-tier stack

exec vs run in Compose? exec runs inside an existing service container. run starts a new one-off container (use --rm).
Interview card 9 of 9: exec vs run in Compose? · Download PNG · Open card page

Lesson: 53.9 Every docker compose command: full reference

Comparison cards

docker run vs docker compose. docker run: one container from flags.Compose: many services from YAML.
Comparison card 1 of 3: docker run vs docker compose · Download PNG · Open card page

Lesson: 53.1 Why Compose: one file for the whole app

.env vs env_file. .env: fills ${VAR} in YAML.env_file: vars into the container.
Comparison card 2 of 3: .env vs env_file · Download PNG · Open card page

Lesson: 53.4 Environment files, interpolation and secrets

compose exec vs compose run. exec: inside a running service.run: a new one-off container.
Comparison card 3 of 3: compose exec vs compose run · Download PNG · Open card page

Lesson: 53.9 Every docker compose command: full reference