VINCENZO CILINO / INDEPENDENT WORKSDESIGNED & BUILT WITH INTENT
FIELD NOTES / CONTAINERS

Introduction to Docker

A practical primer on containers, images, and Compose for running repeatable services on Linux.

DockerLinuxBeginner guide
START HERE

What Docker is.

Docker runs applications in containers: isolated processes with their own filesystem view, dependencies, and configuration. Unlike a traditional virtual machine, a Linux container shares the host kernel. This often makes container deployment lighter than operating a separate guest OS for every service.

BASIC TERMS

Images, containers, volumes.

  • Image: the packaged filesystem and metadata from which containers are created.
  • Container: a running or stopped instance of an image.
  • Volume: persistent data stored outside a disposable container filesystem.
  • Network: a way for containers to discover and communicate with permitted peers.
A FIRST EXAMPLE

Launch a web server.

With Docker installed, this command runs an Nginx container and publishes its web port locally:

docker run --rm -d --name example-web -p 127.0.0.1:8080:80 nginx:stable

Visit http://127.0.0.1:8080 from the host. When you are finished, remove the container with docker stop example-web. Binding to 127.0.0.1 avoids exposing the example on every network interface.

COMPOSE

Turn a command into configuration.

For repeatable deployments, put the service definition in compose.yaml:

services:
  web:
    image: nginx:stable
    ports:
      - "127.0.0.1:8080:80"
    restart: unless-stopped

Run docker compose up -d to start it and docker compose down to stop and remove the service container. A restart policy helps after crashes or daemon restarts; it does not replace monitoring or backups.

PRODUCTION HABITS

Design for maintenance.

  • Pin known-good image versions rather than relying blindly on floating tags.
  • Use named volumes or clearly managed directories for persistent data.
  • Keep secrets out of repositories and public Compose examples.
  • Publish only ports you need and restrict privileges.
  • Back up both application data and the configuration required to restore it.
  • Review upstream documentation before copying installation commands, which change over time.
This is a rewritten edition of a March 20, 2025 post. Installation steps for specific Ubuntu releases are intentionally delegated to Docker’s current installation guide ↗.