Repository navigation
Conversation
container 1.2.0 picked up containerization's secure-by-default changes (default readonlyPaths include /proc/sys, restricted capability set), which removed the ability to write sysctls or remount mounts in the guest with no way to opt out from the CLI. Kubernetes node images (kindest/node, rancher/k3s) and docker-in-docker engines like dagger fail to boot as a result (fixes apple#2041). Add two Docker-compatible flags to run/create: - --sysctl key=value (repeatable) sets guest sysctls at creation; the guest applies them before the read-only remount, so they compose with the default readonly paths. - --privileged grants the full capability set and clears the default masked/readonly paths. Since every container is its own VM with its own kernel, an explicit opt-in escape hatch is proportionate and matches user expectations from Docker.
|
@ronandi Have you tried this sort of thing for sysctl: |
|
Thank you for that @jglogan! I'm trying to run a kube cluster and Use case, for context: running a long-lived local Kubernetes cluster on apple/container (kubeadm/k3s node images). Kubernetes nodes fundamentally need to write sysctls and remount /sys at boot, so 1.2.0's defaults make node images unbootable |
|
I don't mean to hijack this discussion but how would that apply to container machines? From what I can tell the |
|
@ronandi Thanks for the contribution, but we're going to close it as we're working on getting a different fix out quickly for this one. We're not ready to a As a quick fix we're going to make the OCI path controls manageable as experimental CLI options that we'll deprecate once we can get a more general solution in place. We'll do a patch release at the end of the week that includes the fix. |
Fixes #2041.
Problem
container 1.2.0 picked up containerization's secure-by-default changes (default
readonlyPathsincludes/proc/sys, restricted capability set) with no CLI opt-out. Guests can no longer write sysctls or remount mounts, so Kubernetes node images (kindest/node,rancher/k3s) and docker-in-docker engines like dagger fail to boot.Change
Two Docker-compatible flags on
run/create:--sysctl key=value(repeatable): sets guest sysctls at creation. vminitd applies them before the read-only remount, so they compose with the default readonly paths.--privileged: grants the full capability set and clears the default masked/readonly paths. Every container is its own VM with its own kernel, so an explicit opt-in escape hatch is proportionate and matches Docker's UX.The API plumbing (
sysctls,readonlyPaths,maskedPathsonContainerConfiguration) already existed — this exposes it.Verification (against 1.2.0 services)
--sysctl net.ipv4.ip_forward=1: value lands in the guest (cat= 1)--privilegedubuntu:sysctl -wsucceeds,mount -o remount,ro /syssucceeds--privilegedkindest/node:v1.36.1: boots cleanly (containerd active, kubelet starts) — fails hard without the flagParser.sysctlsunit tests (note:swift testneeds full Xcode; I only had CLT locally, so tests are unrun locally — CI should cover)Defaults are unchanged: without the flags, behavior is exactly 1.2.0.