# 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:873870017f869a74e342a3121d1182ee9baeb139 # install vpnkit-expose-port and vpnkit-iptables-wrapper on host - linuxkit/init:31dcd928602e39ee752843ebcf6c35cbae73c883 - linuxkit/runc:7ecf2e5253905855fb554b072d42903f7829c8b6 - linuxkit/containerd:f645aa2f8aa58023149d7766725039572a2ebeb5 - linuxkit/ca-certificates:4ed09a382de2b3ba2143f4270375b3bd6e973fb5 onboot: # support metadata for optional config in /run/config - name: metadata image: linuxkit/metadata:a5df09643d7ac6565295cad633c3d63489c3d4df - name: sysctl image: linuxkit/sysctl:2f575c3d127824eb8d059673c538c440d22f19f5 - name: sysfs image: linuxkit/sysfs:f383bf1c1094383fa3a42e5d5cba7d247dfc6720 - name: binfmt image: linuxkit/binfmt:7c086ece3b5894c3851e7284c128be8a08ba32b7 # Format and mount the disk image in /var/lib/docker - name: format image: linuxkit/format:ae6114d970492747fafbd2071602090c8df3bbf4 - name: mount image: linuxkit/mount:6c799d9cd854cb13cab253945aa3893995f22704 command: ["/usr/bin/mountie", "/var/lib"] # make a swap file on the mounted disk - name: swap image: linuxkit/swap:7b7a05f24652d0a6e01b5b5cdcb73feef9d8e6b6 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:0cca76e71466fc6128fad585549b70538855f254 command: ["/sbin/dhcpcd", "--nobackground", "-f", "/dhcpcd.conf", "-1"] services: # Enable acpi to shutdown on power events - name: acpid image: linuxkit/acpid:3cdd803fbe2d3f0b385caafe478be25fc5d1fadc # Enable getty for easier debugging - name: getty image: linuxkit/getty:ccac1189f78ff466b76d097a0b7b7236ea54de84 env: - INSECURE=true # Run ntpd to keep time synchronised in the VM - name: ntpd image: linuxkit/openntpd:30314674e138726b6dc774dfb62a060d3a8da8d0 # VSOCK to unix domain socket forwarding. Forwards guest /var/run/docker.sock # to a socket on the host. - name: vsudd image: linuxkit/vsudd:f8d52cb44f80504d9ef08534d06aaca612ccd4df 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:3f85f8763b3436bd77d386a0c95679a544b7003a 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:66535330f2ff8a1995d9a85d10d5484c9cb9b3ba # When the host resumes from sleep, force a clock resync - name: host-timesync-daemon image: linuxkit/host-timesync-daemon:95b380f87558950fb3737ef8795129f409040387 # 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"]