# This is an example for building the open source components of Docker for Mac kernel: image: linuxkit/kernel:5.10.104 cmdline: "console=ttyS0 page_poison=1" init: - linuxkit/vpnkit-expose-port:8f9811ec15dbeb5eb37336f66ca97289870fe11d # install vpnkit-expose-port and vpnkit-iptables-wrapper on host - linuxkit/init:817099ace2d56ea2d20c7702ab8e1a8abc7d89fd - linuxkit/runc:59c40661f2174ca6752d73086b91d63eeb98d021 - linuxkit/containerd:0dab9a4e2b9aa7f034873881a08890fd40b2755d - linuxkit/ca-certificates:6003d7e78387f1fbb35bf1d1af300120be97f94b onboot: # support metadata for optional config in /run/config - name: metadata image: linuxkit/metadata:420ead0d86604a6dc138c393914d419b68e50e04 - name: sysctl image: linuxkit/sysctl:f8a06fea01bfcb322e913213e22d35790168ed01 - name: sysfs image: linuxkit/sysfs:e2476b26d551cd75b032990545a304c2cfbd1084 - name: binfmt image: linuxkit/binfmt:312ed1cb899fae229b5303ac6c0510ac58f331c8 # Format and mount the disk image in /var/lib/docker - name: format image: linuxkit/format:4686064ce75f8014a3cdf8c3227887a81a74180a - name: mount image: linuxkit/mount:e3f4f07c424c1aff42a3b2009fb701540e313056 command: ["/usr/bin/mountie", "/var/lib"] # make a swap file on the mounted disk - name: swap image: linuxkit/swap:ace4fd36355cd24cb8428122f46a2ae8a113d9ac command: ["/swap.sh", "--path", "/var/lib/swap", "--size", "1024M"] # mount-vpnkit mounts the 9p share used by vpnkit to coordinate port forwarding - name: mount-vpnkit image: alpine:3.13 binds: - /var/:/host_var:rbind,rshared capabilities: - CAP_SYS_ADMIN rootfsPropagation: shared command: ["sh", "-c", "mkdir -p /host_var/vpnkit/port && mount -v -t 9p -o trans=virtio,dfltuid=1001,dfltgid=50,version=9p2000 port /host_var/vpnkit"] # move logs to the mounted disk (this is a temporary fix until we can limit the log sizes) - name: move-logs image: alpine:3.13 binds: - /var:/host_var command: ["sh", "-c", "mv -v /host_var/log /host_var/lib && ln -vs /var/lib/log /host_var/log"] - name: dhcpcd image: linuxkit/dhcpcd:a58543e8b40a29b3cd0c5d1e42ce21b71a8abcef command: ["/sbin/dhcpcd", "--nobackground", "-f", "/dhcpcd.conf", "-1"] services: # Enable acpi to shutdown on power events - name: acpid image: linuxkit/acpid:c9d5ab81d3312602f3b17b266be9c60127e8f5ec # Enable getty for easier debugging - name: getty image: linuxkit/getty:9b8e6b510b49da196a1e412aa95f364e3dd16576 env: - INSECURE=true # Run ntpd to keep time synchronised in the VM - name: ntpd image: linuxkit/openntpd:4745ea9d3633469c860d1c3d5250303c3d96eec9 # VSOCK to unix domain socket forwarding. Forwards guest /var/run/docker.sock # to a socket on the host. - name: vsudd image: linuxkit/vsudd:f1ced526fee6df1ef2e46f87c503ef4a8fd48151 binds: - /var/run:/var/run command: ["/vsudd", "-inport", "2376:unix:/var/run/docker.sock"] # vpnkit-forwarder forwards network traffic to/from the host via VSOCK port 62373. # It needs access to the vpnkit 9P coordination share - name: vpnkit-forwarder image: linuxkit/vpnkit-forwarder:9a2cb62b40426b271db8ba35dca538db05bc9220 binds: - /var/vpnkit:/port net: host command: ["/vpnkit-forwarder", "-vsockPort", "62373"] # Monitor for image deletes and invoke a TRIM on the container filesystem - name: trim-after-delete image: linuxkit/trim-after-delete:b2001c6b4ffbba5b2d52e8d5cd5c97b9efed8898 # When the host resumes from sleep, force a clock resync - name: host-timesync-daemon image: linuxkit/host-timesync-daemon:6c8df91685b3f123d79214d55c515f90dbd954de # Run dockerd with the vpnkit userland proxy from the vpnkit-forwarder container. # Bind mounts /var/run to allow vsudd to connect to docker.sock, /var/vpnkit # for vpnkit coordination and /run/config/docker for the configuration file. - name: docker-dfm image: docker:20.10.6-dind capabilities: - all net: host mounts: - type: cgroup options: ["rw","nosuid","noexec","nodev","relatime"] binds: - /etc/resolv.conf:/etc/resolv.conf - /var/lib/docker:/var/lib/docker - /lib/modules:/lib/modules - /var/vpnkit:/port # vpnkit control 9p mount - /var/run:/var/run - /run/config/docker:/var/config/docker - /usr/bin/vpnkit-expose-port:/usr/bin/vpnkit-expose-port # userland proxy - /usr/bin/vpnkit-iptables-wrapper:/usr/bin/iptables # iptables wrapper command: [ "/usr/local/bin/docker-init", "/usr/local/bin/dockerd", "--", "--config-file", "/var/config/docker/daemon.json", "--swarm-default-advertise-addr=eth0", "--userland-proxy-path", "/usr/bin/vpnkit-expose-port", "--storage-driver", "overlay2" ] runtime: mkdir: ["/var/lib/docker"]