# 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:b1615db443ce330a763f5c26a1dfbbe65c209dfa # install vpnkit-expose-port and vpnkit-iptables-wrapper on host - linuxkit/init:5251073a3d3e52881bf2697f7dfabac6eedfd569 - linuxkit/runc:49628804b3a39b0a0cfab046dd80b76a4fd87b5a - linuxkit/containerd:c35f10fb8127841b4eb82ddfcebd5d5a54bad0e7 - linuxkit/ca-certificates:945ac3f0c1a31535d37ff77003fc30dbd71da6bb onboot: # support metadata for optional config in /run/config - name: metadata image: linuxkit/metadata:2f7fe9290bf5e192bafee2a767e392485ec30ed5 - name: sysctl image: linuxkit/sysctl:7c0059d1ad7d86127d990474b6e5f17297c07bf5 - name: sysfs image: linuxkit/sysfs:713f1e871e7fdfcdc9088385501d3c49116e915d - name: binfmt image: linuxkit/binfmt:2432eabd3f545ace20077c773e1fafdabab6442a # Format and mount the disk image in /var/lib/docker - name: format image: linuxkit/format:3648c589de02c27a98fe4cbdfa4c890f45aaa121 - name: mount image: linuxkit/mount:fb8f153ac0d83d01dee58a7c720e243dca3593fe command: ["/usr/bin/mountie", "/var/lib"] # make a swap file on the mounted disk - name: swap image: linuxkit/swap:610bf0b64eb3c4f40ee3aa05bec7ea60fbf4edd2 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:fc2b5bf40b13df746ee66f354672bf687a540ce8 command: ["/sbin/dhcpcd", "--nobackground", "-f", "/dhcpcd.conf", "-1"] services: # Enable acpi to shutdown on power events - name: acpid image: linuxkit/acpid:2c1339e3731efd298f22c33a3978d9cc58b9d9f1 # Enable getty for easier debugging - name: getty image: linuxkit/getty:d421b06d0a1ae118e2af025cb7a3637f808a755b env: - INSECURE=true # Run ntpd to keep time synchronised in the VM - name: ntpd image: linuxkit/openntpd:d2b58cb5d776f9e56cf34d8ba301a3e64c16355c # VSOCK to unix domain socket forwarding. Forwards guest /var/run/docker.sock # to a socket on the host. - name: vsudd image: linuxkit/vsudd:dcfafdda35fdd51a31cf30dcf0eeb2e641bf37c6 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:83a7899b338966f8b7c2ddba5fe50f7814c640b6 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:d6229f9e9f994bfa2c2b4e6011cebcd1a7d2f0ef # When the host resumes from sleep, force a clock resync - name: host-timesync-daemon image: linuxkit/host-timesync-daemon:5ba3cd8c7b03b2aa9133a4be3842d8c28dbb756f # 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"]