Files
linuxkit/examples/docker-for-mac.yml
2025-08-28 21:05:06 +03:00

109 lines
4.8 KiB
YAML

# This is an example for building the open source components of Docker for Mac
kernel:
image: linuxkit/kernel:6.6.71
cmdline: "console=ttyS0 page_poison=1"
init:
- linuxkit/vpnkit-expose-port:e39447f4ca312f9ca256e7737a6bec59bd36aec9 # install vpnkit-expose-port and vpnkit-iptables-wrapper on host
- linuxkit/init:680da6e6f79bb8236a095147d532cd2160e23c9f
- linuxkit/runc:2dfee46421e963d6c0d946137e46fe36fa606d29
- linuxkit/containerd:838b745e38e43309393675ce3cf04bee9047eb91
- linuxkit/ca-certificates:a4f15fe71bb0ad7560ff78f48504dd2af500a442
onboot:
# support metadata for optional config in /run/config
- name: metadata
image: linuxkit/metadata:db835ad616084adb6b474e7fd804928fd1d5dd5f
- name: sysctl
image: linuxkit/sysctl:2fad4cdf96faa97bf7888696b8c3ca00f98137af
- name: sysfs
image: linuxkit/sysfs:8d484374bb71b04984fa1e989b1dfc34b3e258a7
- name: binfmt
image: linuxkit/binfmt:0dbbe9b1394561d693fe593aab3ec83d992b20d1
# Format and mount the disk image in /var/lib/docker
- name: format
image: linuxkit/format:512d4fb6cd40c1d90a4aa8335d1bd167fa34a10e
- name: mount
image: linuxkit/mount:54906e884b21aca02bf5ecae65f3741b89d8c4e6
command: ["/usr/bin/mountie", "/var/lib"]
# make a swap file on the mounted disk
- name: swap
image: linuxkit/swap:d63836313d3e63712de097aa5a1b4b8cda948106
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:4681273eeea47c26d980958656e60fe70d49e318
command: ["/sbin/dhcpcd", "--nobackground", "-f", "/dhcpcd.conf", "-1"]
services:
# Enable acpi to shutdown on power events
- name: acpid
image: linuxkit/acpid:0cbffea2a050fae4e5a942f3a3b9f52257c6db28
# Enable getty for easier debugging
- name: getty
image: linuxkit/getty:37a16fb37f56ad0aee6532c1a39d780416f7fb80
env:
- INSECURE=true
# Run ntpd to keep time synchronised in the VM
- name: ntpd
image: linuxkit/openntpd:c28b50438374f8a413b10297f68c65c0f31bf830
# VSOCK to unix domain socket forwarding. Forwards guest /var/run/docker.sock
# to a socket on the host.
- name: vsudd
image: linuxkit/vsudd:e98493f495a206c83f4b1b4eb60255e15da7e223
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:870678494d2bf615787b036a87ff1bc5f477c850
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:ffcb95df35984f0b28951f3483a38cafb6f2198e
# When the host resumes from sleep, force a clock resync
- name: host-timesync-daemon
image: linuxkit/host-timesync-daemon:2c39149907038dcc7ab4731f079e1880cfb19bd7
# 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"]