Docker: Interview Set

0.0(0)
Studied by 0 people
call kaiCall Kai
Locked
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/80

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 3:17 AM on 7/23/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat

No analytics yet

Send a link to your students to track their progress

81 Terms

1
New cards

Image

Read-only template/blueprint — packaged app code, dependencies, runtime, filesystem, built in layers

2
New cards

Container

A running instance of an image — isolated process, writable layer on top of the image's read-only layers

3
New cards

Registry

Storage/distribution service for images (Docker Hub, ECR, private registries)

4
New cards

Image Tag

Label identifying a specific version/variant of an image

5
New cards

docker run

Creates and starts a container from an image

6
New cards

docker run -d

Run container in detached/background mode

7
New cards

docker run -p

Map container port to host port (host:container)

8
New cards

docker run -v

Mount volume (host:container)

9
New cards

docker run -e

Set environment variable

10
New cards

docker run flag order

All docker run flags go BEFORE the image name

11
New cards

docker ps

List running containers

12
New cards

docker ps -a

List all containers, including stopped

13
New cards

docker exec -it

Run an interactive command in a running container

14
New cards

-i flag

Keeps STDIN open, lets container receive input

15
New cards

-t flag

Allocates a pseudo-terminal — makes output render as an interactive session

16
New cards

docker stop vs docker kill

stop sends SIGTERM (graceful), kill sends SIGKILL (immediate, no cleanup)

17
New cards

docker rm

Remove a stopped container permanently

18
New cards

docker rmi

Remove an image — must remove all containers using it first

19
New cards

docker logs

View a container's stdout/stderr output

20
New cards

Where logs are stored (default)

Host filesystem, /var/lib/docker/containers//, json-file driver

21
New cards

Production logging pattern

Configure a different log driver (awslogs, syslog, fluentd) to ship to centralized aggregation

22
New cards

FROM

Sets the base image everything else builds on

23
New cards

RUN

Executes a command at build time, result baked into a new layer

24
New cards

COPY

Copies files from build context into the image at build time

25
New cards

ENV

Sets an environment variable, available at build time and runtime

26
New cards

WORKDIR

Sets working directory for subsequent instructions

27
New cards

EXPOSE

Documents which port the container listens on — informational only, doesn't publish it

28
New cards

CMD

Default command/arguments — fully overridden if anything is passed at the end of docker run

29
New cards

ENTRYPOINT

Fixed command that always runs — runtime args get appended, not replaced

30
New cards

CMD + ENTRYPOINT together

ENTRYPOINT = fixed program, CMD = default (overridable) arguments to it

31
New cards

Exec form vs shell form

Exec form ["cmd","arg"] preserves signal handling

32
New cards

Build context

The directory docker build looks in for the Dockerfile and any COPY sources

33
New cards

docker build -t

Tags the built image with a name:version

34
New cards

Dockerfile instruction order and caching

Put least-frequently-changing steps first (e.g. dependency install before app code) to maximize layer cache reuse

35
New cards

Layer caching

Docker skips re-running a layer if it and everything above it are unchanged

36
New cards

Why separate layers exist

Enables caching, cross-image layer sharing/dedup, and copy-on-write

37
New cards

Copy-on-Write (CoW)

Layers stay read-only and shared

38
New cards

Multi-stage build

Multiple FROM stages in one Dockerfile

39
New cards

Why multi-stage builds

Keeps final image small — build tools/dependencies from earlier stages never ship in the final image

40
New cards

Parallel stages

Independent stages (no COPY --from= between them) build concurrently in BuildKit automatically

41
New cards

BuildKit cache mount

RUN --mount=type=cache — persists a directory (e.g. pip/apt cache) across builds, not included in final image

42
New cards

Cache mount scope

Applies only to the single RUN instruction it's attached to

43
New cards

Cache mounts in CI

Don't work by default on ephemeral runners (e.g. GitHub Actions) — need external backend like type=gha or type=registry

44
New cards

BuildKit secret mount

RUN --mount=type=secret — makes a credential available only during that one RUN step, never persisted in any layer

45
New cards

Why not use ENV for secrets

ENV creates a permanent, inspectable layer — visible via docker history/inspect forever

46
New cards

--platform flag

Specifies target architecture (linux/amd64, linux/arm64) for a build or base image

47
New cards

docker init

Scaffolds a starter Dockerfile, .dockerignore, and compose.yaml based on detected project type

48
New cards

Volume

Persistent storage outside a container's writable layer — mounted at a path, survives container removal

49
New cards

Named volume

Docker-managed storage location

50
New cards

Bind mount

Host path you specify directly

51
New cards

Volume vs bind mount use case

Volumes for production/persistent data (databases)

52
New cards

tmpfs mount

Stores data in host memory only, never touches disk, gone when container stops

53
New cards

docker system df

Shows actual disk usage, accounting for layer deduplication across images

54
New cards

docker images size vs system df

images shows each image's full logical size independently

55
New cards

docker ps -s (size column)

Shows container writable-layer size and virtual size (writable + all image layers, no dedup credit)

56
New cards

Storage driver

Mechanism implementing the layered filesystem — overlay2 is the modern default (uses OverlayFS)

57
New cards

Docker network purpose

Controls how containers communicate with each other, host, and outside world

58
New cards

bridge network (default)

Private virtual network on the host

59
New cards

Custom bridge network

Adds automatic DNS resolution by container/service name — default bridge does NOT have this

60
New cards

host network

No isolation — container shares host's network stack directly, no port mapping needed

61
New cards

none network

No networking beyond loopback

62
New cards

overlay network

Connects containers across multiple hosts (Docker Swarm)

63
New cards

macvlan network

Gives container its own MAC address, appears as physical device on host network

64
New cards

docker network create --subnet/--gateway

Defines custom IP range and exit-point address for a network — fixed at creation, can't be edited after

65
New cards

Docker Compose

Defines a multi-container app in one YAML file

66
New cards

Compose services

Each service = one container definition (image, ports, env, volumes, networks)

67
New cards

Compose networking

Containers on the same custom network resolve each other by service name automatically

68
New cards

Compose depends_on

Controls start order only — does NOT wait for the dependency to be actually ready

69
New cards

docker compose up

Builds/starts the full multi-container stack defined in the compose file

70
New cards

Compose vs Kubernetes

Compose = local dev/single-host

71
New cards

docker (CLI)

Client that translates commands into REST API requests

72
New cards

REST API

Interface dockerd exposes

73
New cards

dockerd

Daemon that receives API requests, coordinates Docker-specific logic, delegates lifecycle execution to containerd

74
New cards

containerd

Standalone runtime managing actual container lifecycle — image pulls, snapshotting, supervising running containers

75
New cards

runc

Creates the actual isolated container process using namespaces + cgroups, then exits

76
New cards

Namespaces

Kernel feature controlling what a process CAN SEE — isolated PIDs, network, mounts

77
New cards

cgroups

Kernel feature controlling what a process CAN USE — CPU/memory/IO resource limits

78
New cards

Why K8s uses containerd directly

containerd supports CRI (Container Runtime Interface) natively

79
New cards

gRPC

RPC framework (protobuf + HTTP/2) used for dockerd-to-containerd internal communication

80
New cards

docker exec -it cat /etc/os-release

Standard way to check a running container's OS/distro

81
New cards

VM vs Container

VM virtualizes hardware, full OS per guest, heavier