liveBook · Manning

Emulation

As explained in Learn Docker in a Month of Lunches, Second Edition

Emulation is the software reproduction of another processor or machine environment so that software built for it can execute on the host.

Emulation reproduces another processor environment in software, letting Docker build or run containers for a different architecture than the host. Docker Desktop uses built-in QEMU support; Linux Docker Engine can use an installed QEMU setup. section 12.1 section 1.3

Use emulation when a development machine and target machine use different architectures, such as building an Arm64 image on an Intel computer. Build separate platform-tagged images, inspect their architectures, and run each image on a matching host. section 12.1

# switch to the exercises folder:
cd ch12/exercises
# build for 64-bit Arm:
docker build -t diamol/ch12-hello:2e-linux-arm64 `
 --platform linux/arm64 ./hello
# and for 64-bit Intel:
docker build -t diamol/ch12-hello:2e-linux-amd64 `
 --platform linux/amd64 ./hello
# check the native architecture of your engine:
docker info -f '{{.OSType}}/{{.Architecture}}'
# and the architecture of the images:
docker image inspect diamol/ch12-hello:2e-linux-arm64 `
 -f '{{.Os}}/{{.Architecture}}'
docker image inspect diamol/ch12-hello:2e-linux-amd64 `
 -f '{{.Os}}/{{.Architecture}}'

Build Arm64 and AMD64 images, inspect the engine architecture, and verify the architecture recorded in each image. section 12.1

Cross-platform image builds

A Go image built with the platform flag can target linux/arm64 or linux/amd64 even when the developer's machine supports only one architecture. The resulting images can be pushed to a registry and run on matching Arm or Intel machines. section 12.1

How Learn Docker in a Month of Lunches, Second Edition covers it

How deep it goes
Explains platform selection, QEMU setup, image inspection, and architecture matching without descending into emulator internals.
Examples
Uses Arm64 and AMD64 Docker builds, architecture inspection commands, and a Go multi-stage image.
What it assumes
Assumes basic Docker image and container use, while introducing host operating systems, CPU architectures, and platform variants.
What you can do after
Operate Docker emulation to build and verify images for Arm64 or AMD64 hosts.
How it connects
Connects emulation with containers, Docker Desktop, QEMU, multi-platform images, CPU architecture, and virtualization.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Learn Docker in a Month of Lunches, Second Edition. The section links point to the parts of the book it draws on.