Files
linuxkit/examples/docker-for-mac.yml
Avi Deitcher 5c2e62d2b9 Update package tags
Signed-off-by: Avi Deitcher <avi@deitcher.net>
2025-01-15 14:59:47 +02: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.13
cmdline: "console=ttyS0 page_poison=1"
init:
- linuxkit/vpnkit-expose-port:0a41328b6d100e998f08239fdae2fece81d3725c # install vpnkit-expose-port and vpnkit-iptables-wrapper on host
- linuxkit/init:30e04e810c9d3d54ab1eb6c2d9407a09d4f2709a
- linuxkit/runc:8b5af3365fc7d015db4e44113d93c7b1f8e2d2ab
- linuxkit/containerd:8072efcee7c1d77a6b41093ae610062552e354fb
- linuxkit/ca-certificates:422d213bd5fff6177be9219a1e0dfc39d9d75342
onboot:
# support metadata for optional config in /run/config
- name: metadata
image: linuxkit/metadata:83cda7b43112b201613084ea8b7fab585b6e5549
- name: sysctl
image: linuxkit/sysctl:112fe3d480ccb6cd115d9d6c446f9d833f6b8e68
- name: sysfs
image: linuxkit/sysfs:23a13bbf83bf666ef6a3ba7b3ebba35d2daead98
- name: binfmt
image: linuxkit/binfmt:564e110729c8d8ecc365979a7d149e2851942883
# Format and mount the disk image in /var/lib/docker
- name: format
image: linuxkit/format:8f487d728959192289e0783784fc2b185eadbc82
- name: mount
image: linuxkit/mount:2a507ef30302693682f9f612289028df00c58ac5
command: ["/usr/bin/mountie", "/var/lib"]
# make a swap file on the mounted disk
- name: swap
image: linuxkit/swap:3b92229926a906986c490a624edd5f478e5e0ed7
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:f46134c05f9665d8865a9fbebd5be0995057af28
command: ["/sbin/dhcpcd", "--nobackground", "-f", "/dhcpcd.conf", "-1"]
services:
# Enable acpi to shutdown on power events
- name: acpid
image: linuxkit/acpid:caa7b2b227868bbd84962bd92662ed16c4bdf4e9
# Enable getty for easier debugging
- name: getty
image: linuxkit/getty:70237b8ac2006b0177026520e7720fc574339298
env:
- INSECURE=true
# Run ntpd to keep time synchronised in the VM
- name: ntpd
image: linuxkit/openntpd:59a2eab34d729e379d93deddf12bfb24a9fe3bbb
# VSOCK to unix domain socket forwarding. Forwards guest /var/run/docker.sock
# to a socket on the host.
- name: vsudd
image: linuxkit/vsudd:be056b9bf455ca664a0835054de1ef95f4159992
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:974c8fc04837a05afe6f97c79c205a949e8ebb7c
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:97dbe2e552de0aa77c3cea6293f7c378f611c3cd
# When the host resumes from sleep, force a clock resync
- name: host-timesync-daemon
image: linuxkit/host-timesync-daemon:ec5a54a9ea824a4c021862fa9b0aea8c18d461d6
# 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"]