# This is an example for building the open source components of Docker for Mac kernel: image: linuxkit/kernel:6.12.52 cmdline: "console=ttyS0 page_poison=1" init: - linuxkit/vpnkit-expose-port:cd97abcfb41fc43ffd93ac9ce5a8c99f4b27222f # install vpnkit-expose-port and vpnkit-iptables-wrapper on host - linuxkit/init:962b1eb0f6fd0b3e072be3bf555a10c9c831f53d - linuxkit/runc:4ae6608b906fa1f428cfcb55686a8452e98e8a27 - linuxkit/containerd:c4e7bb44ddf46365abc4f4b5fa77901bdd73321c - linuxkit/ca-certificates:6d74d50cfbb09d3c322b0899bb45ebefa1ac20ff onboot: # support metadata for optional config in /run/config - name: metadata image: linuxkit/metadata:9587a7d582b18e4880ebe528f0fe1fe8da022e27 - name: sysctl image: linuxkit/sysctl:237cbcc272f357fe1d479847a42d0640d0a48871 - name: sysfs image: linuxkit/sysfs:2e728658079a4141d9f3b67f088a8da1555c32ed - name: binfmt image: linuxkit/binfmt:053091f12f475abbd8ba7a59494c961167efaf06 # Format and mount the disk image in /var/lib/docker - name: format image: linuxkit/format:aab46db75a2ace18b81c01ef0657a8725085e47d - name: mount image: linuxkit/mount:c712a371ac72cdc4d1f5dd1e642609b5c63c920f command: ["/usr/bin/mountie", "/var/lib"] # make a swap file on the mounted disk - name: swap image: linuxkit/swap:885f0e58af79d6c7b218bb23f63db3b545f261df 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:700b2f53f2133f9dd3896b86e7ef7e22e459fefc command: ["/sbin/dhcpcd", "--nobackground", "-f", "/dhcpcd.conf", "-1"] services: # Enable acpi to shutdown on power events - name: acpid image: linuxkit/acpid:5a63182eb6b1b12c9954f4942740e2d129e66458 # Enable getty for easier debugging - name: getty image: linuxkit/getty:239bff4bbe8b98b1a88f887e567345e4943438c5 env: - INSECURE=true # Run ntpd to keep time synchronised in the VM - name: ntpd image: linuxkit/openntpd:dedcaeb10930e83dcce9177ba165d59b0eaaa69b # VSOCK to unix domain socket forwarding. Forwards guest /var/run/docker.sock # to a socket on the host. - name: vsudd image: linuxkit/vsudd:fc65dcfed20fe8a94dde72207b5137297bf24f97 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:74973eb51f3542b76d212fef82af4bb5af0af93c 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:c5a9add8884bdd9b2d6eb8a01e0e1d6463369fa1 # When the host resumes from sleep, force a clock resync - name: host-timesync-daemon image: linuxkit/host-timesync-daemon:b20d482c682619b85650c5fe72b0519a2e75430d # 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"]