Learning paths / Containers / Why containers

Set up Docker

Reading · 10 min · Module 1, lesson 1 of 433 min left in this module

Module 1 · Why containersLesson 1 of 4

Goal: Install Docker, start it, and confirm it runs containers, including Intel and AMD images on an Apple silicon Mac.

Key idea

Every hands-on lesson in this path runs on Docker, on your own machine. Install it once, start it, and check it answers with docker version. After that, every "Try it" lesson works as written.

Install it

Docker has two parts: the docker command you type, and the Docker Engine, the background program that builds and runs containers. On macOS and Windows, Docker Desktop installs both, and Docker Compose with them.

Follow Install Docker Desktop on Mac. Pick the installer for your processor: Apple silicon (M1 and later) or Intel. Drag Docker into Applications, open it, and accept the terms.

First start

Docker Desktop must be running before any docker command works. Open it and wait until it says the engine is running; on Linux, the engine starts as a service. Then run:

docker version
Client:
 Version:           29.3.0
 ...
Server: Docker Desktop 4.66.0 (222299)
 Engine:
  Version:          29.3.0

A Server section means the engine is up. If the output ends with failed to connect to the docker API … check if the daemon is running, Docker isn't started yet: open Docker Desktop (or start the service) and try again. Your version numbers can differ; any recent one works.

On an Apple silicon Mac

The lab images are built for Intel and AMD processors (amd64), which is what most servers use. Your Mac's processor is arm64, so Docker runs those images through emulation, and prints a platform warning when it does.

Make emulation fast: in Docker Desktop, open Settings, then General, turn on Use Rosetta for x86_64/amd64 emulation on Apple Silicon, and apply the change; Docker restarts. The setting needs the Apple Virtualization framework, chosen under Virtual Machine Manager on the same tab. If macOS offers to install Rosetta, accept.

Check yourself

You run docker version and it prints a Client section, then failed to connect to the docker API. What's wrong?