# This is an example for building the open source components of Docker for Mac kernel: image: linuxkit/kernel:6.6.13 cmdline: "console=ttyS0 page_poison=1" init: - linuxkit/vpnkit-expose-port:a3fbd97ce0a2d0bc77c917f6a6d18cd5bb32d58c # install vpnkit-expose-port and vpnkit-iptables-wrapper on host - linuxkit/init:c9a1adb982eb4074c01a34ce43860b6df24c252d - linuxkit/runc:bcd6268ea2d45dc7c6b43ca82d00dd01e7105f17 - linuxkit/containerd:d33b20080a2f88e833680dc8563b5a03a13a297e - linuxkit/ca-certificates:e1688f69167c991bf5be1be809fd68685a4a4a9a onboot: # support metadata for optional config in /run/config - name: metadata image: linuxkit/metadata:8f634b8ba5721c1a3430846fb672536945a04abb - name: sysctl image: linuxkit/sysctl:0c5861d22fac133d5bf679e763a1df14ad927de2 - name: sysfs image: linuxkit/sysfs:b77e6229c5b673421fc4fa938d02907278e895c3 - name: binfmt image: linuxkit/binfmt:50acb90af078d9afee42ec0ea7f418cb4e3bf1a8 # Format and mount the disk image in /var/lib/docker - name: format image: linuxkit/format:1214ae707090285cec2102e696c62892e3d8d0aa - name: mount image: linuxkit/mount:7cffeb3a4a77af09397479fe8e21c0dfce438cd0 command: ["/usr/bin/mountie", "/var/lib"] # make a swap file on the mounted disk - name: swap image: linuxkit/swap:d50ab34d24aea536480337365b9ba286c64783c6 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:c1f461bd40fabb1f3bb77348ab52abad8393bdb3 command: ["/sbin/dhcpcd", "--nobackground", "-f", "/dhcpcd.conf", "-1"] services: # Enable acpi to shutdown on power events - name: acpid image: linuxkit/acpid:78206e0612a2b521459178e11f590901a3bd00bc # Enable getty for easier debugging - name: getty image: linuxkit/getty:42bfdda2fef25c9fd84a58bb88de1496a7cafcda env: - INSECURE=true # Run ntpd to keep time synchronised in the VM - name: ntpd image: linuxkit/openntpd:58cc4dc0fcc1f4cabbe586277cc2949337da5e31 # VSOCK to unix domain socket forwarding. Forwards guest /var/run/docker.sock # to a socket on the host. - name: vsudd image: linuxkit/vsudd:16438e37ca05f79c985e014e924a66e0fac3f3d2 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:135927339bb2d6416bca3a2eefe1c8239bc4d817 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:730aa70eb57b1c5005bb89863c68f0a330177a04 # When the host resumes from sleep, force a clock resync - name: host-timesync-daemon image: linuxkit/host-timesync-daemon:e8fcb76cca89e722cbfe609c79004b37aa660655 # 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"]