This directory builds a persistent Ubuntu 24.04 environment for Apple container, with systemd running as PID 1. The normal ubuntu:24.04 OCI image is intended to run one application and does not contain /sbin/init, so it cannot boot directly as a container machine. This Dockerfile installs systemd and masks services that do not work in this VM setup.
The recipe follows Apple's container machine documentation.
Start the Apple container service:
container system startThen run the three build and setup commands:
./build.shThe script builds local/ubuntu-machine:24.04, creates a persistent machine named ubuntu, and makes it the default container machine.
Open an interactive shell:
container machine run -n ubuntuApple container creates a Linux user matching the macOS user and shares the macOS home directory with the machine. A stopped machine starts automatically when container machine run is called.
Run the two checks in check.sh:
./check.shThe first reports whether systemd reached a usable state. The second lists running services.