Docker
99 bites tagged Docker — interview questions with model answers, and 60-second explainers.
How would you design a multi-arch build process and anticipate challenges?
Mention buildx or cross-compilation, split native and emulated builds, cache per-arch layers. Cross-platform CI/CD orchestration and build abstraction.
Dockerizing Next.js with Multi-Stage Builds
Use a multi-stage Dockerfile to create lean, production-ready Next.js images. This separates build-time dependencies from the runtime environment, shrinking image size.
Your First Python Dockerfile Blueprint
A Dockerfile is a recipe for building a self-contained environment for your Python app. Use it to ensure your app runs identically everywhere, from your laptop to production. The common footgun is forgetting a .dockerignore file, which bloats your image.
Docker Compose for Multi-Container Apps
Docker Compose is a conductor for your containers. Instead of running each service manually, you define your app and its database in one YAML file and launch them together. This is standard for local Node.js/Postgres development.
Optimize Node.js Images with Multi-Stage Builds
Multi-stage builds separate your build environment from your final runtime. This lets you use heavy tools to build your Node.js app, then ship only the lean production code, drastically reducing image size and attack surface.
Creating a Basic Node.js Dockerfile
A Dockerfile is a recipe for building a portable image of your app. Use it to ensure your Node.js app runs identically everywhere, from your laptop to production.
Multi-stage Docker Builds: Lean Images, Fast Deploys
Build your app in one container stage and run it in another, separate one. This keeps your final Docker image lean by shipping only the compiled artifact, not the entire build environment, compilers, and source code.
Docker Bind Mounts: A Portal to Your Host Filesystem
A bind mount is a portal from your host machine's filesystem directly into a container, where changes on either side are reflected instantly. Use it for live code development, but never for production data, as it creates a major security risk.
Private Container Registry: Own Your Image Pipeline
A private container registry is your own personal Docker Hub, giving you full control over image storage and access. It's crucial for secure, in-house CI/CD pipelines.
cAdvisor: A Task Manager for Containers
cAdvisor is like a task manager for your containers, giving you a live view of their resource usage. It's used to track performance, historical usage, and network stats for every container on a host.
Container Image Signing: Verifying What You Run
Think of image signing as a digital "tamper-evident seal" on your containers. It proves who built an image and that it hasn't been altered. This is crucial for production systems to prevent running malicious code.
Harbor: A Private, Secure Artifact Registry
Think of Harbor as a private Docker Hub with built-in security. Use it to scan images for vulnerabilities, enforce role-based access control, and sign artifacts before deploying to Kubernetes.
OCI Image Manifest: The Recipe for a Container Image
An OCI Image Manifest is the recipe for a single container image, listing its configuration and filesystem layers for one specific architecture. It's what a runtime uses to assemble an image like `ubuntu:22.04` on your `linux/amd64` machine.
Docker Registry Mirror: A Local Cache for Faster Pulls
A registry mirror is like a CDN for Docker images, caching public images on your local network to speed up pulls and avoid rate limits. Use it in CI/CD pipelines to reduce build times. The footgun: you can't `docker push` to a mirror; it's a.
Image Digest: The Immutable Image Identifier
An image digest is a unique fingerprint for a container image, guaranteeing you get the exact version you expect. Use it in production to pin an image, preventing unexpected updates from mutable tags like `:latest`. The footgun is assuming a tag is immutable.
Artifact Registry: Google's Universal Package Manager
Artifact Registry is a private, universal package manager for all your software components, not just Docker images. Use it to store your company's Docker images, Java JARs, and Helm charts in one place, integrated with GCP CI/CD.
Docker Image Prune: Reclaim Your Disk Space
Docker image prune is a garbage collector for your local Docker setup, deleting unused images to free up disk space. Use it when low on storage after many builds. The footgun: by default, it only removes *dangling* (untagged) images, not all unused ones.
Docker Login: Authenticating to a Container Registry
docker login saves your credentials for a container registry, letting you push and pull private images. Use it before interacting with private repos on Docker Hub, ECR, or GCR. The footgun: credentials are often stored unencrypted by default.
Docker Push and Pull: Moving Container Images
Think of `docker push` and `pull` like `git push` and `pull`, but for container images. They move images between your machine and a remote registry. A common mistake is forgetting to tag an image with the registry's full address before pushing.
Docker Hub: The Central Repository for Containers
Think of Docker Hub as the GitHub for Docker images. It's a central repository from Docker, Inc. for finding, storing, and sharing pre-built software containers to automate code deployment.
Docker Compose Secrets: Keep Credentials Out of Your Code
Docker Compose Secrets inject sensitive data into containers as files at runtime, keeping credentials out of your version-controlled `docker-compose.yml`. Use them for API keys and passwords. The footgun: your app must read from a file, not an env var.
Extending Compose Files for Different Environments
Think of extending Compose files like CSS for your services; a base file defines the structure, and override files style it for different environments. This is used to manage settings like local code mounts for dev vs. restart policies for prod.
Docker Compose Profiles: Activate Service Groups
Docker Compose profiles let you toggle groups of services on or off within a single `compose.yaml` file. Use it to separate your core app from debugging utilities or to define a "local dev" setup versus a "CI" setup.
Building Images with Docker Compose
Docker Compose builds images from a `compose.yml` file, turning a Dockerfile into a runnable service within a multi-container app. It's for local dev where you need a database and backend to start together. The footgun: `up` won't rebuild without `--build`.
Get Docker bites daily.
Five a day, five minutes, offline. With quizzes so it sticks.
Open testing — you’ll join as an early tester.