Heidelberg AICurriculum
Track 12 · Advanced
12.6.2

Docker on Linux

Install Docker Engine on Linux — package manager, permissions, and your first container

5 lessons 2026-08-06 AI-generated

1Overview

Docker Engine on Linux — installed natively via the package manager (no VM), so software runs in reproducible, self-contained boxes with the lowest overhead.

Docker on Linux is the most native and performant setup: you install Docker Engine directly via your distribution's package manager, no VM required. This chapter covers Ubuntu/Debian (the most common), shows you how to run Docker without sudo, and gets you running your first container. Covers systemd integration, firewall configuration, and the Docker socket security model.

Install Docker Engine natively on Linux and run your first container. No VM: you install the engine directly through your package manager, so it is the fastest and most lightweight setup.

1.2After this chapter you can
Install Docker Engine on Ubuntu/Debian via the official package repository
Configure your user to run Docker without sudo
Run your first container (a local n8n workflow) and access it in your browser
Understand Docker socket security and systemd integration
1.3Best for

A fast, native, fully-free container setup on Ubuntu/Debian — ideal for servers and lab machines running n8n, databases, or AI services.

1.4Watch out

Adding your user to the `docker` group (to skip sudo) grants root-equivalent host access via the Docker socket — only on a machine you trust; command-line only, no bundled GUI.

1.5Free vs paid

Fully free and open source — no license tiers. (Docker Desktop's paid plans apply only to the Windows/macOS app, not the Linux engine.)

2Lessons 5

2.1 Run Docker Engine on Ubuntu

On Linux, Docker runs natively without a VM, using kernel features like cgroups and namespaces for isolation and performance.

Install Docker Engine from the official repository on Ubuntu/Debian

Trysudo docker run hello-world

Paste this into the Terminal pane of anythingllm and press Enter; look for the 'Hello from Docker!' message confirming the engine runs correctly.

  1. Remove old Docker packages with sudo apt-get remove docker docker-engine docker.io containerd runc
  2. Update package index and install prerequisites with sudo apt-get update && sudo apt-get install -y ca-certificates curl gnupg
  3. Add Docker’s GPG key using sudo install -m 0755 -d /etc/apt/keyrings && curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg && sudo chmod a+r /etc/apt/keyrings/docker.gpg
  4. Add the Docker repository with echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
  5. Install Docker Engine with sudo apt-get update && sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
  6. Verify the installation by running sudo docker run hello-world
  • You'll see The command prints “Hello from Docker!” and exits cleanly
  • Takeaway Linux Docker uses native kernel features for best performance with no VM overhead
  • Check What roles do cgroups and namespaces play in container isolation?

2.2 Run Docker commands without sudo

Do this first Run Docker Engine on Ubuntu

Run Docker commands without sudo by adding your user to the docker group

  1. Add your user to the docker group with sudo usermod -aG docker $USER
  2. Apply the new group membership by logging out and back in or running newgrp docker
  3. Execute docker ps without using sudo
  • You'll see docker ps returns an empty table without error
  • Takeaway The docker group grants the same privileges as root for Docker operations
  • Check Why does adding a user to the docker group remove the need for sudo when managing containers?

2.3 Start a local n8n workflow with Docker Compose

Do this first Run Docker commands without sudo

Launch a local n8n workflow using Docker Compose

n8n workflow editor canvas showing a Schedule Trigger feeding an HTTP request node into an If branch
  1. 1 Editor tab edit node configuration Why this exists →
  2. 2 Tests panel run isolated node tests Why this exists →
  3. 3 Run test workflow execute whole flow manually

Best viewed on desktop — tap Enlarge to read the numbered controls.

This is n8n running inside your container, reached at localhost:5678 — the same editor on Linux. A Schedule Trigger → HTTP request → If branch. Credit: docs.n8n.io ↗
  1. Create a workspace directory and move into it with mkdir n8n-workspace && cd n8n-workspace
  2. Create a docker-compose.yml file containing the required service definitions
  3. Start the services in detached mode with docker compose up -d
  4. Open your browser to http://localhost:5678
  • You'll see The n8n UI loads at http://localhost:5678, ready to create an account
  • Takeaway Docker Compose orchestrates multiple containers as a single application
  • Check What does the ‑d flag do when running docker compose up?

2.4 Enable Docker auto‑start with systemd

Do this first Start a local n8n workflow with Docker Compose

Enable Docker to start automatically after each reboot using systemd

  1. Enable Docker to start on boot with systemctl enable docker
  2. Start the Docker service immediately with systemctl start docker
  3. Check that the service is active with systemctl status docker
  • You'll see Docker shows as active (running) and containers restart after reboot
  • Takeaway Enabling the Docker service ensures it survives system reboots
  • Check How does systemd know to start Docker automatically once it has been enabled?

2.5 Fix common Linux Docker problems

Do this first Enable Docker auto‑start with systemd

Resolve common Docker issues on a Linux host

  1. Add your user to the docker group with sudo usermod -aG docker $USER and re‑login
  2. Find processes using the Docker socket with lsof | grep /var/run/docker.sock and stop them with kill
  3. Inspect daemon logs via journalctl -u docker.service, then restart Docker with sudo systemctl restart docker
  • You'll see All three problems are diagnosed and the Docker service runs correctly
  • Takeaway Diagnosing socket conflicts and reviewing daemon logs helps quickly fix Docker failures
  • Check What information does journalctl provide that helps identify why the Docker daemon failed to start?

3You’ll know it worked 73 checkable outcomes in this chapter

  • Output includes 'Hello from Docker!' and exits cleanly
  • `systemctl status docker` shows active (running) after the fix
  • `docker version` returns client and server details
  • Visiting `http://localhost:<hostPort>` in a browser shows your app.
  • Running 'docker version' shows client and server versions without error
  • Running `docker info` shows no errors and displays system details
  • Visit http://your-vps-ip:port and see the Open Notebook login screen
  • `docker images` lists the newly pulled image with its tag

73 outcomes in all — one per recipe below.

4FAQ, Tips & How-to 84

one problem, one solution, one action
How-to AnythingLLM Everyone

Old Docker packages still installed

Removing any previously installed Docker components prevents conflicts with the new installation

Lesson → AI-generated
How-to AnythingLLM Everyone

System lacks required packages for Docker

Installing ca-certificates, curl and gnupg ensures the system can fetch and verify Docker's repository securely

Lesson → AI-generated
How-to AnythingLLM Everyone

Apt can’t verify Docker packages

Adding Docker's official GPG key lets apt verify packages from Docker's repo

Lesson → AI-generated
How-to AnythingLLM Everyone

No official Docker package source

Configuring the official Docker apt source enables installation of the latest stable engine

Lesson → AI-generated
How-to AnythingLLM Everyone

Want Docker on your machine

Installing docker-ce, its CLI, containerd and related plugins gives you a fully functional Docker runtime

Lesson → AI-generated
How-to AnythingLLM Everyone

Running the official hello-world container confirms that Docker Engine is correctly installed and can pull/run images

Lesson → AI-generated
Tip AnythingLLM Everyone

Anyone who can access /var/run/docker.sock effectively has full root privileges on the host

Lesson → AI-generated
Tip AnythingLLM Everyone

Docker group — root-equivalent permission set

Membership in the docker group grants the same power as root because it allows access to the Docker socket

Lesson → AI-generated
How-to AnythingLLM Everyone

Need to run Docker without typing sudo

Adding your account to the docker group lets you run Docker commands without sudo

~10 min · no code Lesson → AI-generated
How-to AnythingLLM Everyone

Group membership changed but session still shows old rights

You must start a new login session or use newgrp for the group membership to take effect

Lesson → AI-generated
How-to AnythingLLM Everyone

Running a Docker command without sudo confirms the group membership is active

Lesson → AI-generated
How-to AnythingLLM Everyone

If Docker still fails, confirming the docker group exists helps diagnose the issue

Lesson → AI-generated
How-to n8n Everyone

Need a tidy spot for Docker Compose files

Creating a dedicated folder keeps the Docker Compose configuration and related files tidy and isolated

Lesson → AI-generated
How-to Everyone

Opening the browser at the default port shows the running n8n instance

Lesson → AI-generated
How-to Everyone

Docker won’t start on its own after a reboot

Enabling the Docker service makes it start automatically whenever the host boots

~5 min · no code Lesson → AI-generated
How-to Everyone

Docker isn’t running

Starting the service brings Docker up immediately without waiting for a reboot

Lesson → AI-generated
How-to Everyone

Seeing the service status confirms Docker is up and ready to manage containers

Lesson → AI-generated
How-to Everyone

Containers stop after a host reboot

Adding `restart: unless-stopped` to docker-compose.yml makes containers survive reboots but still obey manual stops

Lesson → AI-generated
How-to Everyone

Docker commands require sudo

You can run Docker commands without sudo by granting your user access to the Docker socket

Lesson → AI-generated
How-to Everyone

Port already in use error

You can resolve "port already in use" errors by locating the process holding the port and stopping it or remapping the container port

Lesson → AI-generated
How-to Everyone

Inspecting the Docker service logs reveals why the daemon fails, enabling targeted fixes such as clearing corrupted data or freeing disk space

Lesson → AI-generated
Tip Everyone

Docker Image vs Container — understand the difference

An image is a static package containing layers, dependencies and configuration; a container is the running instance of that image with its own filesystem, environment variables and port bindings. Knowing this prevents confusion when managing Docker resources.

Tip Everyone

Docker Pull — download an image from a registry

`docker pull <repo>/<image>:<tag>` fetches the layered image files from Docker Hub (or another registry) to your local machine, caching layers for future reuse.

Tip Everyone

Docker Run — start a container from an image

`docker run <image>` combines pull (if needed) and starts a new container, allocating resources and executing the image’s default command. Adding `-d` runs it detached so the terminal stays free.

Tip Everyone

Port Binding with Docker Run — expose a service to the host

The `-p <host_port>:<container_port>` flag maps a port on your machine to the container’s internal port, allowing external programs to reach the service without conflicts.

Tip Everyone

Docker Stop & Start — restart a stopped container

`docker stop <container_id>` gracefully stops a running container; `docker start <container_id>` restarts it without recreating, preserving its state and configuration.

Tip Everyone

Docker PS –a — list all containers including stopped ones

The `-a` flag extends `docker ps` to show every container ever created on the host, useful for finding IDs of exited containers for restart or removal.

Tip Everyone

Docker Logs — view a container’s output

`docker logs <container_id>` streams the stdout/stderr captured from the container’s process, helping debug issues without attaching to the container.

Tip Everyone

Docker Exec — run a command inside a running container

`docker exec -it <container_id> <command>` opens an interactive shell (or runs any command) inside the container’s namespace, allowing inspection or manual fixes.

Tip Everyone

Docker Install on Windows 10 — set up Docker Desktop

Download the stable installer, run it, ensure virtualization is enabled in BIOS/Task Manager, then start Docker Desktop; the whale icon indicates the engine is running.

Tip Everyone

Docker Toolbox — run Docker on legacy OSes

When native Docker isn’t supported, install Docker Toolbox which bundles Docker CLI, Machine, Compose and VirtualBox; after installation use the QuickStart Terminal to issue Docker commands.

How-to Everyone

Need a private AI notebook on your computer

The video shows how to pull the Open Notebook Docker image, provide an OpenAI API key, and start the container. This gives you a self‑hosted instance that runs on your machine without needing to compile code.

Fahd Mirza ↗ Lesson → AI-generated
How-to Everyone

Multiple AI models behind one URL

LiteLLM can run as a Dockerized proxy that normalizes API calls to different LLM providers. By defining each provider in the config file you expose a single endpoint that forwards requests to the chosen backend, simplifying client code.

Better Stack ↗ Lesson → AI-generated
How-to Everyone

Need to try an AI model on your computer without cloud fees

Using Docker containers isolates AI applications on your own machine, giving you the same security and reproducibility as a cloud VM without recurring costs. Containers package code, dependencies, and hardware access, so you can develop and test models offline.

YouTube ↗ Lesson → AI-generated
How-to Everyone

Evaluating the total cost of ownership helps you choose whether to run AI agents locally in Docker or rent a cloud VM. Local execution incurs only electricity and hardware depreciation, while cloud VMs charge per hour for compute and storage.

YouTube ↗ Lesson → AI-generated
How-to Everyone

Running `docker version` in a terminal shows the client and server versions if Docker Desktop is correctly installed. It confirms the CLI can communicate with the Docker daemon.

The Coding Sloth ↗ Lesson → AI-generated
How-to Everyone

Need a portable package for my Node server

A Dockerfile defines the build steps for an image. Using a base Node image, copying package files first enables layer caching of dependencies, making rebuilds faster.

The Coding Sloth ↗ Lesson → AI-generated
How-to Everyone

Need a ready‑to‑run container image

`docker build -t <name> .` reads the Dockerfile in the current directory, executes each instruction, and produces an immutable image identified by the tag you provide.

The Coding Sloth ↗ Lesson → AI-generated
How-to Everyone

Want to view your Node.js app in a browser

`docker run -p hostPort:containerPort <image>` maps a port on your host to the container's exposed port, allowing you to access the service via localhost.

The Coding Sloth ↗ Lesson → AI-generated
How-to Everyone

Docker Scout analyzes the layers of an image, lists all installed packages, and flags known security issues, providing remediation suggestions.

The Coding Sloth ↗ Lesson → AI-generated
How-to Everyone

Want to run a Node app with its PostgreSQL DB together

`docker-compose.yml` defines multiple services, their build contexts, images, environment variables, ports, and shared volumes, allowing a single command to launch the whole stack.

The Coding Sloth ↗ Lesson → AI-generated
How-to Everyone

Container restarts wipe my database rows

A named volume stores files outside the container's writable layer, so data remains even when the container is removed. Declaring it in `docker-compose.yml` or with `-v` on `docker run` mounts it into the container.

The Coding Sloth ↗ Lesson → AI-generated
How-to Everyone

Need a private research‑chat notebook like Google’s

Open Notebook is an open‑source, Docker‑first application that provides the same research‑chat experience as Google NotebookLM but runs on your own server. By running it locally you keep all uploaded documents private and can choose any LLM provider.

Better Stack ↗ Lesson → AI-generated
How-to Everyone

Want to run containers on Debian

Adds Docker's official GPG key and repository, updates the package index, then installs docker-ce, docker-ce-cli, containerd.io, and the compose plugin. Using Docker's repo ensures you get up‑to‑date packages rather than outdated distro versions.

Learn Linux TV ↗ Lesson → AI-generated
How-to Everyone

Running the official hello‑world image pulls a tiny test container that prints a confirmation message, proving the daemon can pull images and run containers correctly.

Learn Linux TV ↗ Lesson → AI-generated
How-to Everyone

Having to type sudo for every container command

Adding your user to the `docker` Unix group grants permission to communicate with the Docker daemon, eliminating the need for `sudo` on each command.

Learn Linux TV ↗ Lesson → AI-generated
How-to Everyone

Need a self‑hosted uptime monitor that keeps data across restarts

A Docker Compose YAML defines services, ports, volumes, and restart policies. Editing it to create a named volume ensures persistent data across container restarts.

Learn Linux TV ↗ Lesson → AI-generated
How-to Everyone

Can't run containers on my PC

The installer provides a GUI that adds the Docker CLI, daemon and optional Kubernetes. It also creates a lightweight Linux VM (or uses WSL/Hyper‑V) to run containers on non‑Linux hosts.

DevOps Directive ↗ Lesson → AI-generated
How-to Everyone

Want to show a custom message in a container

Docker pulls the image layers from Docker Hub, creates an isolated container, and runs the provided command inside it. The '--rm' flag (implicit in this demo) removes the container after exit.

DevOps Directive ↗ Lesson → AI-generated
How-to Everyone

Want a local PostgreSQL server for testing

Using 'docker run' with '-e' sets environment variables (POSTGRES_PASSWORD) required by the official image, while '-p' maps host port 5432 to the container’s port, making it reachable from local tools.

DevOps Directive ↗ Lesson → AI-generated
How-to Everyone

Docker creates a PID namespace so processes inside see their own PID space starting at 1. This prevents containers from seeing host processes, improving security and reproducibility.

DevOps Directive ↗ Lesson → AI-generated
How-to Everyone

Container keeps maxing out the host CPU

Docker maps cgroup settings from command‑line flags. '--cpus=0.5' limits the container to half a CPU core, preventing it from monopolizing host resources.

DevOps Directive ↗ Lesson → AI-generated
How-to Everyone

Docker stores images as a stack of read‑only lower layers plus a writable upper layer. When you pull an image, each layer is downloaded separately; shared base layers are reused across images, saving space and bandwidth.

DevOps Directive ↗ Lesson → AI-generated
How-to Everyone

Need a personal n8n server

Running n8n in Docker gives you full control over updates, ports, and data storage while keeping the setup simple with a single compose file.

Ryan & Matt Data Science ↗ Lesson → AI-generated
How-to Everyone

Need a local LLM API you can call

Docker provides an isolated environment for LiteLLM, ensuring all dependencies are met and the service runs consistently across machines. Starting the container exposes the API on localhost:4000, ready for configuration.

KeyLabz ↗ Lesson → AI-generated
Tip Everyone

Virtualization vs Containerization — understand core differences

Virtualization uses a hypervisor to run full guest operating systems on virtual hardware, while containerization shares the host OS kernel and isolates processes using namespaces and cgroups. This makes containers lighter and faster than VMs.

How-to Everyone

Need to run containers on Arch Linux

Docker can be installed via the system package manager; on Arch Linux the pacman command pulls the Docker daemon and CLI packages, setting up the service automatically.

typecraft ↗ Lesson → AI-generated
How-to Everyone

The `docker run hello-world` command pulls a tiny test image from Docker Hub, creates a container, and prints a confirmation message if the daemon is functional.

typecraft ↗ Lesson → AI-generated
How-to Everyone

Want a custom container built from my code

A Dockerfile lists base image, package installs, file copies, and default command; `docker build` reads this file, executes each step, and produces an immutable image tagged as you specify.

typecraft ↗ Lesson → AI-generated
How-to Everyone

Want to run your script isolated from the host

`docker run` starts a container from an image; the container runs the CMD defined in the Dockerfile unless overridden, providing an isolated environment for the app.

typecraft ↗ Lesson → AI-generated
How-to Everyone

Need separate app versions without overwriting

Docker images are immutable; to change code you edit the Dockerfile and rebuild with a new tag (e.g., `myapp:v2`). Multiple tags can coexist, letting you run different versions side‑by‑side.

typecraft ↗ Lesson → AI-generated
How-to Everyone

I need to run random Python snippets safely

A Docker container can act as a digital prison that runs arbitrary Python code while preventing access to the host filesystem, network, and excessive resources. By pulling a minimal python:3.11-slim image and launching it with restrictive flags, any malicious behavior is confined and the container self‑destructs after execution.

codingdidi ↗ Lesson → AI-generated
How-to Everyone

Need to run untrusted Python code

Specific Docker run options (`--network none`, `-m <mem>`, `--cpus <cpu>`) provide a lightweight security boundary that stops most attacks: no outbound connections, limited RAM to prevent OOM, and CPU caps to kill infinite loops quickly.

codingdidi ↗ Lesson → AI-generated
How-to Everyone

I need a local OpenAI‑compatible API

The video shows how to clone the LiteLLM repo, set a master key and salt in .env, then launch the proxy with Docker Compose. This creates a local HTTP server (default port 4000) that serves the OpenAI‑compatible API for all configured models.

Data Science Basics ↗ Lesson → AI-generated
How-to Everyone

Need Open NotebookLM but don’t want to install anything

Docker packages all dependencies into an isolated container, so you don’t need to install Python libraries or manage system paths. The video shows pulling the pre‑built image and running it with a single command.

Julian Goldie SEO ↗ Lesson → AI-generated
How-to Everyone

Want a private notebook server on your VPS

Deploying Open Notebook via Docker on a virtual server gives you full control and privacy over your data. By pulling the GitHub repository into a Docker compose setup, the service runs in an isolated container that can be started with a single command.

SaaS Master ↗ Lesson → AI-generated
How-to Everyone

Need a container engine on Ubuntu

Installing Docker involves updating the package index, adding Docker's repository, installing the docker.io package, and enabling the service to start at boot. This ensures you have the latest stable Docker engine compatible with your Ubuntu version.

vCloudBitsBytes ↗ Lesson → AI-generated
How-to Everyone

Running the official hello‑world image tests that the Docker daemon can pull images and run containers, confirming a successful install.

vCloudBitsBytes ↗ Lesson → AI-generated
How-to Everyone

Need an OS container image locally

The command contacts Docker Hub (a public registry) and retrieves the specified image layers to your host. It caches them locally so future runs are instant.

NetworkChuck ↗ Lesson → AI-generated
How-to Everyone

Need to poke around a running container

`docker exec` runs a new process inside an existing container, letting you interact with its filesystem and services as if you were logged into a separate VM.

NetworkChuck ↗ Lesson → AI-generated
How-to Everyone

Containerized web server not reachable from my PC

The `-p hostPort:containerPort` flag creates a NAT rule so traffic hitting the host’s port is forwarded to the container, enabling web servers or other services to be reachable externally.

NetworkChuck ↗ Lesson → AI-generated
How-to Everyone

Want to free resources by halting a container

`docker stop` sends SIGTERM then SIGKILL after a timeout, gracefully halting the container. `docker start` restarts it without recreating the filesystem, preserving its state.

NetworkChuck ↗ Lesson → AI-generated
Tip Everyone

Docker vs Virtual Machine — understand core differences

Docker virtualizes only the application layer and reuses the host kernel, while a VM virtualizes an entire OS with its own kernel. This makes Docker images much smaller, faster to start, but limited to compatible host kernels.

How-to Everyone

Need to run containers locally

Download the installer from Docker's official site, run the .dmg (mac) or .exe (Windows), and follow system‑requirement prompts. The installation provides the Docker Engine, CLI, and a GUI client.

TechWorld with Nana ↗ Lesson → AI-generated
How-to Everyone

Want a particular container image saved locally

`docker pull <image>:<tag>` contacts Docker Hub (default registry) and stores the specified image locally, making it ready for container creation.

TechWorld with Nana ↗ Lesson → AI-generated
How-to Everyone

Need to start a service without tying up the terminal

`docker run -d <image>:<tag>` creates a new container from the image and runs it in the background, returning only the container ID.

TechWorld with Nana ↗ Lesson → AI-generated
How-to Everyone

Need to reach a service inside a container from my computer

The `-p hostPort:containerPort` flag maps a port on your machine to the container’s internal port, allowing you to reach the service via localhost.

TechWorld with Nana ↗ Lesson → AI-generated
How-to Everyone

Container IDs are cryptic

Using `--name <myname>` when running a container lets you refer to it by that name instead of the autogenerated ID in subsequent commands.

TechWorld with Nana ↗ Lesson → AI-generated
How-to Everyone

Need a portable way to run my Node.js app

A Dockerfile defines the steps to assemble an image: choose a base image (`FROM`), copy source files, install dependencies (`RUN npm install`), and set the start command (`CMD`). Building it with `docker build` produces a reusable image.

TechWorld with Nana ↗ Lesson → AI-generated
How-to Everyone

Container commands need sudo

After installing Docker, the video shows how to configure the system so regular users can execute Docker commands by adding them to the 'docker' group and restarting the session.

ProgrammingKnowledge ↗ Lesson → AI-generated
How-to Everyone

Need a private, offline AI notebook for documents

Open NotebookLM is an open‑source web interface that lets you upload documents, create notebooks and query them with LLMs running on your own machine. Because everything runs inside Docker it stays offline, giving full privacy and no usage limits.

Julian Goldie SEO ↗ Lesson → AI-generated
How-to Everyone

Need keyword‑free searching of notes

An embedding model converts text chunks into vector representations that can be compared for similarity, powering fast keyword‑free searches across your knowledge base.

Julian Goldie SEO ↗ Lesson → AI-generated
How-to Everyone

Want to run Open Notebook without any installs

Docker packages all dependencies of Open Notebook into a self‑contained image, letting you run the app on any machine without manual installs. This isolation ensures consistent behavior and easy cleanup.

Tech Bytes Insights ↗ Lesson → AI-generated
How-to Everyone

Need a private AI notebook on your server

`docker compose up -d` reads docker‑compose.yml and the .env variables, builds any needed images, and starts the services in detached mode, making the web UI available on your network.

Tech Bytes Insights ↗ Lesson → AI-generated

The same set on /recipes, filtered by tool and role.

5Videos 4

6FAQ 5

Why does Docker run faster on Linux compared to using a VM?

Docker on Linux uses the host’s kernel directly through features called cgroups and namespaces, so containers share the same kernel instead of emulating hardware. This avoids the overhead of a virtual machine, giving near‑native CPU, I/O and latency performance.

How do I remove old Docker packages before installing a fresh version?

Old Docker components like docker, docker-engine, docker.io, containerd and runc should be uninstalled with apt‑get. Running the provided removal command clears those packages and prevents conflicts with the new install.

What steps are needed to let my user run Docker commands without sudo?

Add your user account to the system group named docker, which controls access to the Docker socket (/var/run/docker.sock). After running the usermod command, log out and back in (or use newgrp docker) so the new group membership takes effect.

How can I verify that Docker was installed correctly?

Run the official test container with sudo docker run hello-world. The command pulls a small image from Docker Hub and prints a success message if the engine is working properly.

What should I do if Docker fails to start because the service isn’t running?

Start the Docker daemon manually with systemctl start docker, then check its status using systemctl status docker to confirm it’s active. You can also enable it to launch automatically at boot with systemctl enable docker.

7Glossary 12 terms

Show the 12 terms
Docker on Linux
cgroups
A Linux kernel feature that limits and monitors resource usage for groups of processes.
namespaces
Kernel mechanisms that isolate system resources like network, process IDs, and file systems for each container.
apt-get
A command‑line tool used on Debian‑based Linux to install, remove, or manage software packages.
usermod
A command that modifies a user account, such as adding the user to a new group.
/var/run/docker.sock
A Unix socket file through which the Docker CLI talks to the Docker daemon; access gives full control over Docker.
docker.gpg
The public GPG key stored on the system that lets apt verify packages from Docker’s repository.
docker.list
A file placed in /etc/apt/sources.list.d that tells apt where to find Docker’s Ubuntu package repository.
docker group
A system user group whose members can run Docker commands without using sudo because they can access the Docker socket.
hello-world container
A small test image that prints a success message when run, confirming Docker is installed correctly.
systemctl enable
A command that registers a service to start automatically each time the system boots.
restart: unless-stopped
A Docker Compose setting that tells containers to restart after a reboot unless they were manually stopped.
newgrp
A command that refreshes the current shell’s group memberships without logging out and back in.

8See also

💬 Discuss this chapter

Ask, share, or report — over on the Heidelberg AI community forum.