# 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:b7d75bf04d53024e6245ff6631744b66560a135a # install vpnkit-expose-port and vpnkit-iptables-wrapper on host - linuxkit/init:7135424f6836ee166d1199e88cfb95ee88efaf91 - linuxkit/runc:efcece75889aec4e2de0d95ba27ccc46438522b3 - linuxkit/containerd:ce79d5d4ab9c46f4763735c6e4ab5c51c3feb5d8 - linuxkit/ca-certificates:d4cc1b82c73d272e94d0e71ea375fe56b0c0626a onboot: # support metadata for optional config in /run/config - name: metadata image: linuxkit/metadata:f35b5aafc7d19bb6a44a900840727902dad78e44 - name: sysctl image: linuxkit/sysctl:c5f4b4895844b993dce4e8b35fd8263a6b557807 - name: sysfs image: linuxkit/sysfs:010d0865b5786128962d2980efa8d4c6e4e8b8d6 - name: binfmt image: linuxkit/binfmt:7dbce407e0b6814622bceae127421c5529fc7a3a # Format and mount the disk image in /var/lib/docker - name: format image: linuxkit/format:3c858f0cf42a2b14441bfb5c266b78f14d2b75a4 - name: mount image: linuxkit/mount:4413ebd50bfbe026058e4a60463259cece2b8bb5 command: ["/usr/bin/mountie", "/var/lib"] # make a swap file on the mounted disk - name: swap image: linuxkit/swap:8a1fd15d56b6ddf67d6d8ce25361178e1f36128b 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:330839488cd122db3c44738e265c035c9729a963 command: ["/sbin/dhcpcd", "--nobackground", "-f", "/dhcpcd.conf", "-1"] services: # Enable acpi to shutdown on power events - name: acpid image: linuxkit/acpid:6379700e2f3341250432e37a4cac36e35c7caac8 # Enable getty for easier debugging - name: getty image: linuxkit/getty:bae9e3d4861173bacf78f14a4fe44997a430d13b env: - INSECURE=true # Run ntpd to keep time synchronised in the VM - name: ntpd image: linuxkit/openntpd:da26954c2f98a274091e5ed0bbdd2079a77a47c1 # VSOCK to unix domain socket forwarding. Forwards guest /var/run/docker.sock # to a socket on the host. - name: vsudd image: linuxkit/vsudd:4d3c64766a5db737b952e83a8acf72ff0004333e 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:930e9d3756e4b701595bf72c80e56d70abff70a1 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:14fbf307d2e6b287411987fcddde578b14e92b81 # When the host resumes from sleep, force a clock resync - name: host-timesync-daemon image: linuxkit/host-timesync-daemon:f7047f8aa7c1d733d9b9acf0e5ad5bea66f3d005 # 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"]