Files
os-builder/docs/docker-build.md
2026-03-10 06:30:47 -07:00

56 lines
1.5 KiB
Markdown

# Docker Build
Docker can be used to run the build inside a container. This is useful on non-Debian hosts (e.g. Fedora, Arch, macOS with Linux VM) or to keep the build environment isolated from the host system.
> **Note**: The Docker build is not fully isolated — it still needs kernel-level access for `binfmt_misc` (ARM emulation) and `losetup` (loop devices for `.img` builds).
## Building
```bash
cp config.example config # edit as needed
./build-docker.sh
```
Output will be in `deploy/`.
## Continuing After a Failure
Edit the failing script, then resume without restarting from scratch:
```bash
CONTINUE=1 ./build-docker.sh
```
## Inspecting the Container After a Failure
```bash
sudo docker run -it --privileged --volumes-from=pigen_work vesperos-build /bin/bash
```
## Preserving the Container Between Runs
By default the container is removed after a successful build. To keep it for incremental development:
```bash
PRESERVE_CONTAINER=1 ./build-docker.sh
```
## Passing Extra Docker Arguments
Use `PIGEN_DOCKER_OPTS` to pass additional flags to `docker run`:
```bash
PIGEN_DOCKER_OPTS="--add-host myrepo:192.168.1.10" ./build-docker.sh
```
The `--name` and `--privileged` flags are already set by the script and should not be redefined.
## binfmt_misc on Docker Hosts
If building ARM images, `binfmt_misc` must be enabled on the host kernel before starting the build:
```bash
sudo apt-get install binfmt-support qemu-user-static
sudo update-binfmts --enable
```