# 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:77e45e4681c78d59f1d8a48818260948d55f9d05 # install vpnkit-expose-port and vpnkit-iptables-wrapper on host - linuxkit/init:e120ea2a30d906bd1ee1874973d6e4b1403b5ca3 - linuxkit/runc:6062483d748609d505f2bcde4e52ee64a3329f5f - linuxkit/containerd:39301e7312f13eedf19bd5d5551af7b37001d435 - linuxkit/ca-certificates:5aaa343474e5ac3ac01f8b917e82efb1063d80ff onboot: # support metadata for optional config in /run/config - name: metadata image: linuxkit/metadata:b082f1bf97a9034d1e4c0e36a5d2923f4e58f540 - name: sysctl image: linuxkit/sysctl:5a374e4bf3e5a7deeacff6571d0f30f7ea8f56db - name: sysfs image: linuxkit/sysfs:ec174e06ca756f492e7a3fd6200d5c1672b97511 - name: binfmt image: linuxkit/binfmt:68604c81876812ca1c9e2d9f098c28f463713e61 # Format and mount the disk image in /var/lib/docker - name: format image: linuxkit/format:e040f4f045f03138a1ee8a22bb6feae7fd5596a6 - name: mount image: linuxkit/mount:19ff89c251a4156bda8ed11c95faad2f40eb770e command: ["/usr/bin/mountie", "/var/lib"] # make a swap file on the mounted disk - name: swap image: linuxkit/swap:c57f3319ce770515357f0058035e40519c22b752 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:e9e3580f2de00e73e7b316a007186d22fea056ee command: ["/sbin/dhcpcd", "--nobackground", "-f", "/dhcpcd.conf", "-1"] services: # Enable acpi to shutdown on power events - name: acpid image: linuxkit/acpid:3b1560c81d3884e049ebbd9d9bf94ccb394e6cd3 # Enable getty for easier debugging - name: getty image: linuxkit/getty:5d86a2ce2d890c14ab66b13638dcadf74f29218b env: - INSECURE=true # Run ntpd to keep time synchronised in the VM - name: ntpd image: linuxkit/openntpd:c90c6dd90f5dfb0ca71a73aac2dad69c8d956af3 # VSOCK to unix domain socket forwarding. Forwards guest /var/run/docker.sock # to a socket on the host. - name: vsudd image: linuxkit/vsudd:b4d80d243733f80906cdbcf77f367a7b5744dc09 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:a89ec807d7d675dccd53773c07382bc707db3396 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:6ba98bfb111a808b7a1ca890aca9fc2b3709fca2 # When the host resumes from sleep, force a clock resync - name: host-timesync-daemon image: linuxkit/host-timesync-daemon:0d351aee24b5cf853927647e4f5e6998014959db # 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"]