# 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:2f6d203f8647b1bae5d5cef8aa4aa4bbd071cb5b # install vpnkit-expose-port and vpnkit-iptables-wrapper on host - linuxkit/init:ad37cb61355b08cf481c54b07612b5206be6254d - linuxkit/runc:8c00a7c58393f0cfcab81ac4171c00bcaec6b962 - linuxkit/containerd:26f04b0b57e3d21bfb36732b5c6ebe8f08c6705b - linuxkit/ca-certificates:a37095d3d576815fdefe76a28444c68cd9eac8fe onboot: # support metadata for optional config in /run/config - name: metadata image: linuxkit/metadata:fa7dda444e6cfcdaad696a013364d53c9ebebd62 - name: sysctl image: linuxkit/sysctl:984bff0476b059ae86b4c3e7c15f93f72a5d0a57 - name: sysfs image: linuxkit/sysfs:e7910655e4b320b769bb7e5819f33e0d097c98c4 - name: binfmt image: linuxkit/binfmt:e13c3d8480ef26523171d872a37c25b1a9b6d653 # Format and mount the disk image in /var/lib/docker - name: format image: linuxkit/format:97dcd726d14ce2ef767d674adb8a709d5a73c213 - name: mount image: linuxkit/mount:ce11bd5f816af89ba0760853420aa988b98cda13 command: ["/usr/bin/mountie", "/var/lib"] # make a swap file on the mounted disk - name: swap image: linuxkit/swap:c5218fcde4d99f6763227bf2daf39eee74e1ea11 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:0060977dc2cd15eb242c21888fad240f96ec7308 command: ["/sbin/dhcpcd", "--nobackground", "-f", "/dhcpcd.conf", "-1"] services: # Enable acpi to shutdown on power events - name: acpid image: linuxkit/acpid:f7075311b07774b41d536395ed7b2a1ac36789c3 # Enable getty for easier debugging - name: getty image: linuxkit/getty:97d0743bc3baa349dc96809b58f8584c5896928a env: - INSECURE=true # Run ntpd to keep time synchronised in the VM - name: ntpd image: linuxkit/openntpd:2a6439b4f52cd694d139f5445287d9f09e392a92 # VSOCK to unix domain socket forwarding. Forwards guest /var/run/docker.sock # to a socket on the host. - name: vsudd image: linuxkit/vsudd:95b76be440be0a0dd8de44f0532c897e7df9d1d9 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:447dac4b62d790c0fedf1c0f8ed3245dbc3450f9 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:93ed89a36fa6fda9ef1fd7761489de8da69d40d0 # When the host resumes from sleep, force a clock resync - name: host-timesync-daemon image: linuxkit/host-timesync-daemon:7c71f4948c57656657b87a2d4f2709f78fe82b7c # 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"]