Ravindra BagaleCourses & study guides मराठी

Ravi Sir's Cards › DevOps

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 13: 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 13: 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 13: 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 13: 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 13: 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 13: 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 13: 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 13: 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 13: Every docker compose command · Download PNG · Open card page

Lesson: 53.9 Every docker compose command: full reference

Compose Watch vs nodemon. Rebuilding the image after every code change wastes minutes.
Revision card 10 of 13: Compose Watch vs nodemon · Download PNG · Open card page

Lesson: 53.10 Compose Watch vs nodemon and the node_modules volume trick

Separate dev and prod Compose files. Dev settings like bind mounts leak into production and break it.
Revision card 11 of 13: Separate dev and prod Compose files · Download PNG · Open card page

Lesson: 53.11 Separate dev and prod Compose files, deployed to an Ubuntu VM

Wait-for-DB and retry patterns. depends_on only orders startup; the database can still go away later.
Revision card 12 of 13: Wait-for-DB and retry patterns · Download PNG · Open card page

Lesson: 53.12 Wait-for-DB and retry patterns beyond depends_on

Watchtower: automatic image updates. Small servers fall behind because nobody pulls new images.
Revision card 13 of 13: Watchtower: automatic image updates · Download PNG · Open card page

Lesson: 53.13 Watchtower: automatic image updates for Compose apps

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 13: 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 13: 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 13: 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 13: .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 13: 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 13: 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 13: 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 13: 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 13: exec vs run in Compose? · Download PNG · Open card page

Lesson: 53.9 Every docker compose command: full reference

How do you get live reload with Docker? Use docker compose watch (sync, sync+restart, rebuild) or a bind mount with nodemon.
Interview card 10 of 13: How do you get live reload with Docker? · Download PNG · Open card page

Lesson: 53.10 Compose Watch vs nodemon and the node_modules volume trick

How do you separate dev and prod in Compose? A shared compose.yaml plus override files; prod uses -f with pinned images and restart policies.
Interview card 11 of 13: How do you separate dev and prod in Compose? · Download PNG · Open card page

Lesson: 53.11 Separate dev and prod Compose files, deployed to an Ubuntu VM

Is depends_on enough to wait for a database? Only with condition: service_healthy, and the app still needs retries because the DB can restart later.
Interview card 12 of 13: Is depends_on enough to wait for a database? · Download PNG · Open card page

Lesson: 53.12 Wait-for-DB and retry patterns beyond depends_on

Is Watchtower good for production? For small or home setups; real production needs pinned tags and controlled deploys with rollback.
Interview card 13 of 13: Is Watchtower good for production? · Download PNG · Open card page

Lesson: 53.13 Watchtower: automatic image updates for Compose apps

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