Files
linuxkit/examples/docker-for-mac.yml
Avi Deitcher 0d15d8d9bb Update package tags
Signed-off-by: Avi Deitcher <avi@deitcher.net>
2024-01-28 15:32:09 +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:5.10.104
cmdline: "console=ttyS0 page_poison=1"
init:
- linuxkit/vpnkit-expose-port:d8a64b69160da8b5f1f787423a4e1e1fac67f1c3 # install vpnkit-expose-port and vpnkit-iptables-wrapper on host
- linuxkit/init:7e8c0f9a968894f6f8be80bfb99b3e16d201e50b
- linuxkit/runc:86b8092f0ad8635cc8b6b1c95a4b20f66c4095bb
- linuxkit/containerd:1b14966d84209083c9cbc757be862f97005e5796
- linuxkit/ca-certificates:b1afe194ecb800d2b947e24c9e780c959fd3668f
onboot:
# support metadata for optional config in /run/config
- name: metadata
image: linuxkit/metadata:29a9d4e117983518fcd5fbf637499c0fa82fce9d
- name: sysctl
image: linuxkit/sysctl:cf714d65c0df9ff0f0cccf4a3d4ff4157ddef903
- name: sysfs
image: linuxkit/sysfs:72b2041ed8b9ab95475a5ed0e5b208b1aca669eb
- name: binfmt
image: linuxkit/binfmt:d418c2bd3fe67bf65f94bf056694154b1a36a707
# Format and mount the disk image in /var/lib/docker
- name: format
image: linuxkit/format:68af8bc2e992f2f591afc9c628cfe35296616193
- name: mount
image: linuxkit/mount:ef198f6e9f4f9ee51a94daa90f3ebac67f7ee31e
command: ["/usr/bin/mountie", "/var/lib"]
# make a swap file on the mounted disk
- name: swap
image: linuxkit/swap:358ce603cf73a9825354f06e2d182467d5009ce9
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:cf2f1bb633284e0c2b0745c9d29aee66fab449aa
command: ["/sbin/dhcpcd", "--nobackground", "-f", "/dhcpcd.conf", "-1"]
services:
# Enable acpi to shutdown on power events
- name: acpid
image: linuxkit/acpid:afea8ced2185d302e0ccd99dde7cd795fea91540
# Enable getty for easier debugging
- name: getty
image: linuxkit/getty:e594a89dc1aee9b40cb0febcbdf207a5c2506c0e
env:
- INSECURE=true
# Run ntpd to keep time synchronised in the VM
- name: ntpd
image: linuxkit/openntpd:3d4f9c34269471e9bee76a73dc5168d8a4c8d990
# VSOCK to unix domain socket forwarding. Forwards guest /var/run/docker.sock
# to a socket on the host.
- name: vsudd
image: linuxkit/vsudd:c2cad3db45c8111483a82ad3155c1b5c37494576
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:4ce0fb5bee8a286aaaeb2e9d93384e992a8d9f3f
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:c23dc426e5ed914aa4a592821bfaf2b107df257e
# When the host resumes from sleep, force a clock resync
- name: host-timesync-daemon
image: linuxkit/host-timesync-daemon:914c737972e7fe8b4fbe161f919a3f279de2cb53
# 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"]