Repository navigation
Revert "Use named volumes for MySQL volume" - #347
Merged
Merged
Conversation
This reverts commit a489d66.
Contributor
Author
|
It will be back, stronger and better than ever 💪 |
rfay
pushed a commit
to rfay/ddev
that referenced
this pull request
Jun 27, 2017
rfay
added a commit
to rfay/ddev
that referenced
this pull request
Aug 7, 2026
…status, for ddev#7372 [skip ci] Split the numbered "Blockers" list into open vs. fixed, ordered by actual impact on DDEV instead of numeric IDs. Added a fix-branches table near the top, linked to every referenced branch/issue/PR. Corrected stale status (PR ddev#347 and issue ddev#346 are closed, not open) and split out the still-open DNS wrong-network-address bug from the already-fixed AAAA/EDNS0 bug it had been bundled with. Re-ranked the table by DDEV impact rather than the fork's diff-risk-based submission order, and surfaced the still-unbranched exec-upgrade/attachStdin fix, which is the actual cause of the `ddev start` hang.
rfay
added a commit
to rfay/ddev
that referenced
this pull request
Aug 7, 2026
…ists, for ddev#7372 [skip ci] The previous commit added a table row proposing a new branch/issue for "socktainer only upgrades exec connection when stdin is attached." Checking the socktainer fork before filing anything found the fix already exists: fix/exec-hijack-close was rewritten on 2026-08-05 (commit 53cc0f3, local only, not pushed) to fix the attachStdin gating and the EOF-close bug together, superseding the closed PR ddev#347 for both. Move that branch back into the top DDEV-start-blocking tier and correct the prose sections that still described it as a real-but-non-blocking bug.
rfay
added a commit
to rfay/ddev
that referenced
this pull request
Aug 11, 2026
…status, for ddev#7372 [skip ci] Split the numbered "Blockers" list into open vs. fixed, ordered by actual impact on DDEV instead of numeric IDs. Added a fix-branches table near the top, linked to every referenced branch/issue/PR. Corrected stale status (PR ddev#347 and issue ddev#346 are closed, not open) and split out the still-open DNS wrong-network-address bug from the already-fixed AAAA/EDNS0 bug it had been bundled with. Re-ranked the table by DDEV impact rather than the fork's diff-risk-based submission order, and surfaced the still-unbranched exec-upgrade/attachStdin fix, which is the actual cause of the `ddev start` hang.
rfay
added a commit
to rfay/ddev
that referenced
this pull request
Aug 11, 2026
…ists, for ddev#7372 [skip ci] The previous commit added a table row proposing a new branch/issue for "socktainer only upgrades exec connection when stdin is attached." Checking the socktainer fork before filing anything found the fix already exists: fix/exec-hijack-close was rewritten on 2026-08-05 (commit 53cc0f3, local only, not pushed) to fix the attachStdin gating and the EOF-close bug together, superseding the closed PR ddev#347 for both. Move that branch back into the top DDEV-start-blocking tier and correct the prose sections that still described it as a real-but-non-blocking bug.
rfay
added a commit
to rfay/ddev
that referenced
this pull request
Aug 21, 2026
…t, for ddev#7372 [skip ci] - For ddev#7372 Apple Container (via socktainer) cannot run DDEV as-is. The dominant blocker is that Apple Container backs each named volume with an ext4 block image that can only be attached to one running VM at a time, so `ddev-global-cache` — mounted simultaneously by web, db, router and every helper container — fails with `VZErrorDomain Code=2 "The storage device attachment is invalid."`. It does not solve it; it establishes how far DDEV can get and what is left. With these changes plus the host-side workarounds documented in HANDOFF.md, `ddev start` brings web, db and ddev-router to healthy (10.5s each) and traefik routes correctly from the host. Remaining blockers are upstream, and the two that still stop a page from being served are catalogued in HANDOFF.md. All code changes are gated behind `DDEV_BIND_GLOBAL_CACHE=true`. With the variable unset, rendering and behavior are unchanged; the compose templates emit exactly what they did before. - `pkg/globalconfig/global_config.go`: `UseBindGlobalCache()`, `GlobalCacheSource()`, `GlobalCacheMount()`. In bind mode the global cache is a host directory (`~/.ddev/global-cache-bind`) rather than a Docker volume, because virtiofs bind mounts can be shared between running containers. - `pkg/ddevapp/ddevapp.go`: use the helper for every `/mnt/ddev-global-cache` mount; skip volume creation and create the host directory instead; add `copyIntoGlobalCache()`, which copies on the host in bind mode. Copying a directory into a container is unsupported by socktainer and hangs when driven through the API. - `pkg/ddevapp/commands.go`, `pkg/ddevapp/traefik.go`: route their copies through `copyIntoGlobalCache()`. - `pkg/ddevapp/app_compose_template.yaml`, `pkg/ddevapp/router_compose_template.yaml`, `config.go`, `router.go`: add `GlobalCacheMount` / `BindGlobalCache` template vars, omit the `volumes:` block when it would render empty, and place project services on `ddev_default` only, since Apple Container gives a container one NIC and `docker network connect` is a no-op. HANDOFF.md records the full analysis: eleven upstream blockers with reproductions, the host-side workarounds needed (gateway DNS, buildkit node), and six design options for replacing the shared-volume pattern. Three of those options are provider-independent improvements worth doing on their own. Requires macOS with Apple `container` 1.2.0 and `socktainer` 1.2.1, plus the host-side setup in HANDOFF.md (gateway dnsmasq and a hand-created buildkit node — buildx cannot bootstrap one under socktainer). ```bash docker context use socktainer mkdir ~/tmp/appletest && cd ~/tmp/appletest && echo '<?php phpinfo();' > index.php ddev config --project-type=php --docroot=. --project-name=appletest DDEV_BIND_GLOBAL_CACHE=true ddev start ``` To confirm nothing changed for normal providers, run `ddev debug compose-config` with the variable unset and verify the `ddev-global-cache` volume and both networks are still present. No new tests. This is exploratory work behind an environment variable that is off by default, and the paths it touches need an Apple Container host to exercise. `make staticrequired` is clean and `go test -short ./pkg/globalconfig/...` passes. Not for release. `DDEV_BIND_GLOBAL_CACHE` is undocumented and unsupported, and HANDOFF.md should be deleted before any of this merges to main. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> docs: refine shared-volume options with attach-rule testing, for ddev#7372 [skip ci] Testing showed the volume restriction is narrower than first documented. A volume is either attached read-write by exactly one container, or read-only by any number of them (verified with three simultaneous `:ro` attachers). Consequences, all verified rather than reasoned: - A long-lived writer container with `:ro` readers alongside it does NOT work; the exclusivity is on the block device, so a writer blocks every other attach, `:ro` included. Recorded so the pattern is not retried. - A *transient* writer does work: seed the volume read-write, exit, then let the project containers mount it `:ro`. Re-seeding requires every reader to be down, which is what `ddev start` / `ddev restart` already does. - Content written continuously by a running container (npm/Composer caches, n_prefix, corepack, shell history) cannot live in the read-only volume, and ddev-webserver's start.sh would need to stop running mkdir/chown under /mnt/ddev-global-cache/. - The owning-container idea still works if it serves the cache over HTTP instead of the filesystem, which covers downloads but not install prefixes. Adds design options 7 and 8 and marks 7 as the most promising direction, since unlike the bind-mount approach implemented behind DDEV_BIND_GLOBAL_CACHE it does not trade away volume performance. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> docs: add privileged-port blocker and cold-start recipe, for ddev#7372 [skip ci] Two failures found while reproducing a start that broke early. Ports below 1024 cannot be published at all: Apple Container's port forwarder runs unprivileged and rejects them with "Binding to ports below 1024 requires root privileges". This is DDEV's default configuration, and it had been masked until now by another router holding 80/443, which made DDEV fall back to ephemeral high ports. Workaround is router_http_port/router_https_port above 1024; a real Apple Container mode needs non-privileged defaults or no port publishing at all. The buildkit node must be recreated, never restarted. Once it exits, buildx restarts it and every build fails with `rbind ... operation not permitted`; `docker rm -f` plus an identical `docker run` fixes it immediately. Capabilities are not the explanation, since they survive a restart, so the cause is unidentified. Since the node exits whenever `container system` restarts, this is the most likely thing to bite when picking the work back up. Adds a cold-start recipe with the required ordering, because the environment does not survive idling: the default network's host bridge is torn down once nothing runs on it, which kills DNS and prevents dnsmasq from rebinding. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> feat(apple-container): auto-detect socktainer, add port and buildkit findings, for ddev#7372 [skip ci] Bind mode was gated behind DDEV_BIND_GLOBAL_CACHE, which is easy to forget: a `ddev start` in a terminal without it uses the volume path and fails in confusing ways. It now turns on automatically when the provider is socktainer. - `pkg/dockerutil/providers.go`: add `IsSocktainer()`, matching `Server.Platform.Name` in the same shape as the existing `IsPodman()`. Move `UseBindGlobalCache()`, `GlobalCacheSource()` and `GlobalCacheMount()` here from `globalconfig`, since detection needs a Docker call and `dockerutil` already imports `globalconfig` rather than the reverse. - `DDEV_BIND_GLOBAL_CACHE=true`/`=false` still forces the behavior either way for testing on other providers. When unset and the provider is not socktainer — including when the provider cannot be reached — detection returns false and rendering is byte-identical to before. Verified by rendering `ddev debug compose-config` both ways. Two failures found while reproducing a start that broke early: - Ports below 1024 cannot be published: Apple Container's forwarder runs unprivileged and rejects them. This is not a new class of problem for DDEV — rootless Podman is already a supported provider with the same restriction and the docs already tell users to configure unprivileged ports. The macOS wrinkle is that there is no `net.ipv4.ip_unprivileged_port_start` escape hatch, so it is mandatory rather than recommended. It had been masked until now by another router holding 80/443, which made DDEV fall back to ephemeral high ports. - The buildkit node must be recreated, never restarted. Once it exits, buildx restarts it and every build fails with `rbind ... operation not permitted`; `docker rm -f` plus an identical `docker run` fixes it. Capabilities are not the explanation, since they survive a restart, so the cause is unidentified. Also adds a cold-start recipe with the required ordering, because the environment does not survive idling: the default network's host bridge is torn down once nothing runs on it, which kills DNS and prevents dnsmasq rebinding. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> docs: say "global-cache bind mount", not "bind mode", for ddev#7372 [skip ci] "Bind mount" on its own is ambiguous in DDEV, where no_bind_mounts already refers to something else entirely: whether the project directory is mounted into the containers. This work bind-mounts only the global cache, so the prose and comments now say so explicitly rather than talking about "bind mode". No behavior change. Also corrects the header, which still described the changes as gated behind an environment variable after they were switched to socktainer auto-detection. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> docs: track upstream socktainer issue/PR status in HANDOFF.md, for ddev#7372 [skip ci] Cross-reference each blocker with its fix's current status (filed, PR open, fix ready but not yet submitted, or investigated-but-not-reproducible), and point to the rfay/socktainer fork's UPSTREAM_ROLLOUT.md for the full ranked plan, so status lives in the branch instead of only in PR comments. feat(apple-container): force Mutagen off on socktainer, for ddev#7372 [skip ci] Mutagen mounts project_mutagen at both /var/www and /tmp/project_mutagen in the web container. On Apple Container that is two attachments of one block-backed volume within a single container, which no configuration can satisfy, so the container never boots: VZErrorDomain Code=2 "The storage device attachment is invalid." Rather than leave every project to discover this, GetPerformanceMode() returns "none" when the provider is socktainer, with a WarningOnce naming the reason. Projects that already resolve to "none" are unaffected and silent. no_bind_mounts normally forces Mutagen on as the only way to get code into the container. It cannot work here either, so it is not honored and gets its own warning instead of failing the same way. Behavior on every other provider is unchanged: IsSocktainer() returns false and both paths keep their previous values. Verified against a project whose only relevant setting was the global performance_mode: mutagen default. The warning appears once per command, the web container gets "bind <project> -> /var/www/html", and no project_mutagen volume is mounted. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> feat(apple-container): stop re-mounting the db volume while its container runs, for ddev#7372 [skip ci] Two DDEV code paths mount the database volume into a throwaway container while the project's own db container already has it. On apple container a volume takes either one writer or any number of readers, never a mix, so the second attachment aborts the helper's boot: VZErrorDomain Code=2 "The storage device attachment is invalid." - getDBVersionFromVolume() ran a GetExistingDBType-* container for this, and util.Failed() made the error fatal, so `ddev start` and `ddev config` both died for any project whose db was running. It now reads the version file with dockerutil.Exec into that running container, which starts no container at all and is cheaper on every provider. - the start-chown-* container mounted the volume to fix ownership. Skipped when the db container is up, since ownership was set on an earlier start. Behavior elsewhere is unchanged: with no running db container both paths do exactly what they did before. Verified with two projects running at once on apple container, which was previously impossible, both serving 200 with no per-project workaround files. `ddev restart` works repeatably (~27s). `ddev start` over an already-running project still fails on apple container's global hostname uniqueness, which is upstream of socktainer and unrelated to these paths. HANDOFF.md records the four socktainer-side findings from the same session (start_period slept rather than probed, HostConfig.PortBindings nil, health probes forced to root, hostname uniqueness) and retires blocker 5 plus the healthcheck and chown workarounds, which are now harmful rather than helpful. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> feat(apple-container): add IsAppleContainer() and report it as its own environment, for ddev#7372 [skip ci] DDEV had no vocabulary for "the runtime is apple container" distinct from "the API in front of it is socktainer" — every check went through IsSocktainer(), and `ddev version` reported ddev-environment=darwin and docker-platform=linux-docker, indistinguishable from any other Docker provider on macOS even though apple container's constraints (single-writer volumes, virtiofs bind mounts, global hostname uniqueness) are unlike any of them. Adds dockerutil.IsAppleContainer(), currently detected through IsSocktainer() since socktainer is the only Docker-compatible API in front of apple container today; the two questions are kept separate since that may not stay true. All apple-container-specific call sites (UseBindGlobalCache, the two Mutagen warnings, GetDockerPlatform, activeDockerProvider, the addon virtiofs-propagation sleep) now go through it instead of IsSocktainer() directly. `ddev version` and `ddev debug port` now report: ddev-environment apple-container (was: darwin) docker-platform apple-container (was: linux-docker) Every other provider (OrbStack, Colima, Podman, ...) and Docker being unreachable were retested and are unaffected. Also folds in an audit of every RunSimpleContainer call site for other double-mounts of the database volume: none exist beyond the two already fixed in the prior commit, and RestoreSnapshot always removes the db container before touching its volume, so it was never at risk. Corrected HANDOFF.md, which had speculatively listed it as untested. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> docs: record restart/db-recreate finding and full rebuild recipe, for ddev#7372 [skip ci] Two things from today's session. First, investigated why `ddev restart` recreates the db/web containers every time on apple container: it isn't a bug. `Restart()` is `Stop()`+`Start()`, and `Stop()` always removes the containers first, so compose has nothing to compare a config hash against on the way back up — the same thing happens on every provider, apple container is just slower at it (likely the volume block-attach cost from blocker 1). Second, tore down and rebuilt the entire apple-container/socktainer stack from nothing (system, socktainer binary, docker context) to confirm it's reproducible, and documented the exact recipe. That rebuild also surfaced and fixed a real socktainer bug: ApiVersion/MinAPIVersion carried a stray "v" prefix that silently failed DDEV's own minimum- Docker-version check regardless of the actual version number. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> docs: reorganize HANDOFF.md by DDEV priority and fix stale branch/PR status, for ddev#7372 [skip ci] Split the numbered "Blockers" list into open vs. fixed, ordered by actual impact on DDEV instead of numeric IDs. Added a fix-branches table near the top, linked to every referenced branch/issue/PR. Corrected stale status (PR ddev#347 and issue ddev#346 are closed, not open) and split out the still-open DNS wrong-network-address bug from the already-fixed AAAA/EDNS0 bug it had been bundled with. Re-ranked the table by DDEV impact rather than the fork's diff-risk-based submission order, and surfaced the still-unbranched exec-upgrade/attachStdin fix, which is the actual cause of the `ddev start` hang. docs: correct HANDOFF.md, the exec-upgrade/attachStdin fix already exists, for ddev#7372 [skip ci] The previous commit added a table row proposing a new branch/issue for "socktainer only upgrades exec connection when stdin is attached." Checking the socktainer fork before filing anything found the fix already exists: fix/exec-hijack-close was rewritten on 2026-08-05 (commit 53cc0f3, local only, not pushed) to fix the attachStdin gating and the EOF-close bug together, superseding the closed PR ddev#347 for both. Move that branch back into the top DDEV-start-blocking tier and correct the prose sections that still described it as a real-but-non-blocking bug.
rfay
added a commit
to rfay/ddev
that referenced
this pull request
Aug 24, 2026
…t, for ddev#7372 [skip ci] - For ddev#7372 Apple Container (via socktainer) cannot run DDEV as-is. The dominant blocker is that Apple Container backs each named volume with an ext4 block image that can only be attached to one running VM at a time, so `ddev-global-cache` — mounted simultaneously by web, db, router and every helper container — fails with `VZErrorDomain Code=2 "The storage device attachment is invalid."`. It does not solve it; it establishes how far DDEV can get and what is left. With these changes plus the host-side workarounds documented in HANDOFF.md, `ddev start` brings web, db and ddev-router to healthy (10.5s each) and traefik routes correctly from the host. Remaining blockers are upstream, and the two that still stop a page from being served are catalogued in HANDOFF.md. All code changes are gated behind `DDEV_BIND_GLOBAL_CACHE=true`. With the variable unset, rendering and behavior are unchanged; the compose templates emit exactly what they did before. - `pkg/globalconfig/global_config.go`: `UseBindGlobalCache()`, `GlobalCacheSource()`, `GlobalCacheMount()`. In bind mode the global cache is a host directory (`~/.ddev/global-cache-bind`) rather than a Docker volume, because virtiofs bind mounts can be shared between running containers. - `pkg/ddevapp/ddevapp.go`: use the helper for every `/mnt/ddev-global-cache` mount; skip volume creation and create the host directory instead; add `copyIntoGlobalCache()`, which copies on the host in bind mode. Copying a directory into a container is unsupported by socktainer and hangs when driven through the API. - `pkg/ddevapp/commands.go`, `pkg/ddevapp/traefik.go`: route their copies through `copyIntoGlobalCache()`. - `pkg/ddevapp/app_compose_template.yaml`, `pkg/ddevapp/router_compose_template.yaml`, `config.go`, `router.go`: add `GlobalCacheMount` / `BindGlobalCache` template vars, omit the `volumes:` block when it would render empty, and place project services on `ddev_default` only, since Apple Container gives a container one NIC and `docker network connect` is a no-op. HANDOFF.md records the full analysis: eleven upstream blockers with reproductions, the host-side workarounds needed (gateway DNS, buildkit node), and six design options for replacing the shared-volume pattern. Three of those options are provider-independent improvements worth doing on their own. Requires macOS with Apple `container` 1.2.0 and `socktainer` 1.2.1, plus the host-side setup in HANDOFF.md (gateway dnsmasq and a hand-created buildkit node — buildx cannot bootstrap one under socktainer). ```bash docker context use socktainer mkdir ~/tmp/appletest && cd ~/tmp/appletest && echo '<?php phpinfo();' > index.php ddev config --project-type=php --docroot=. --project-name=appletest DDEV_BIND_GLOBAL_CACHE=true ddev start ``` To confirm nothing changed for normal providers, run `ddev debug compose-config` with the variable unset and verify the `ddev-global-cache` volume and both networks are still present. No new tests. This is exploratory work behind an environment variable that is off by default, and the paths it touches need an Apple Container host to exercise. `make staticrequired` is clean and `go test -short ./pkg/globalconfig/...` passes. Not for release. `DDEV_BIND_GLOBAL_CACHE` is undocumented and unsupported, and HANDOFF.md should be deleted before any of this merges to main. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> docs: refine shared-volume options with attach-rule testing, for ddev#7372 [skip ci] Testing showed the volume restriction is narrower than first documented. A volume is either attached read-write by exactly one container, or read-only by any number of them (verified with three simultaneous `:ro` attachers). Consequences, all verified rather than reasoned: - A long-lived writer container with `:ro` readers alongside it does NOT work; the exclusivity is on the block device, so a writer blocks every other attach, `:ro` included. Recorded so the pattern is not retried. - A *transient* writer does work: seed the volume read-write, exit, then let the project containers mount it `:ro`. Re-seeding requires every reader to be down, which is what `ddev start` / `ddev restart` already does. - Content written continuously by a running container (npm/Composer caches, n_prefix, corepack, shell history) cannot live in the read-only volume, and ddev-webserver's start.sh would need to stop running mkdir/chown under /mnt/ddev-global-cache/. - The owning-container idea still works if it serves the cache over HTTP instead of the filesystem, which covers downloads but not install prefixes. Adds design options 7 and 8 and marks 7 as the most promising direction, since unlike the bind-mount approach implemented behind DDEV_BIND_GLOBAL_CACHE it does not trade away volume performance. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> docs: add privileged-port blocker and cold-start recipe, for ddev#7372 [skip ci] Two failures found while reproducing a start that broke early. Ports below 1024 cannot be published at all: Apple Container's port forwarder runs unprivileged and rejects them with "Binding to ports below 1024 requires root privileges". This is DDEV's default configuration, and it had been masked until now by another router holding 80/443, which made DDEV fall back to ephemeral high ports. Workaround is router_http_port/router_https_port above 1024; a real Apple Container mode needs non-privileged defaults or no port publishing at all. The buildkit node must be recreated, never restarted. Once it exits, buildx restarts it and every build fails with `rbind ... operation not permitted`; `docker rm -f` plus an identical `docker run` fixes it immediately. Capabilities are not the explanation, since they survive a restart, so the cause is unidentified. Since the node exits whenever `container system` restarts, this is the most likely thing to bite when picking the work back up. Adds a cold-start recipe with the required ordering, because the environment does not survive idling: the default network's host bridge is torn down once nothing runs on it, which kills DNS and prevents dnsmasq from rebinding. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> feat(apple-container): auto-detect socktainer, add port and buildkit findings, for ddev#7372 [skip ci] Bind mode was gated behind DDEV_BIND_GLOBAL_CACHE, which is easy to forget: a `ddev start` in a terminal without it uses the volume path and fails in confusing ways. It now turns on automatically when the provider is socktainer. - `pkg/dockerutil/providers.go`: add `IsSocktainer()`, matching `Server.Platform.Name` in the same shape as the existing `IsPodman()`. Move `UseBindGlobalCache()`, `GlobalCacheSource()` and `GlobalCacheMount()` here from `globalconfig`, since detection needs a Docker call and `dockerutil` already imports `globalconfig` rather than the reverse. - `DDEV_BIND_GLOBAL_CACHE=true`/`=false` still forces the behavior either way for testing on other providers. When unset and the provider is not socktainer — including when the provider cannot be reached — detection returns false and rendering is byte-identical to before. Verified by rendering `ddev debug compose-config` both ways. Two failures found while reproducing a start that broke early: - Ports below 1024 cannot be published: Apple Container's forwarder runs unprivileged and rejects them. This is not a new class of problem for DDEV — rootless Podman is already a supported provider with the same restriction and the docs already tell users to configure unprivileged ports. The macOS wrinkle is that there is no `net.ipv4.ip_unprivileged_port_start` escape hatch, so it is mandatory rather than recommended. It had been masked until now by another router holding 80/443, which made DDEV fall back to ephemeral high ports. - The buildkit node must be recreated, never restarted. Once it exits, buildx restarts it and every build fails with `rbind ... operation not permitted`; `docker rm -f` plus an identical `docker run` fixes it. Capabilities are not the explanation, since they survive a restart, so the cause is unidentified. Also adds a cold-start recipe with the required ordering, because the environment does not survive idling: the default network's host bridge is torn down once nothing runs on it, which kills DNS and prevents dnsmasq rebinding. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> docs: say "global-cache bind mount", not "bind mode", for ddev#7372 [skip ci] "Bind mount" on its own is ambiguous in DDEV, where no_bind_mounts already refers to something else entirely: whether the project directory is mounted into the containers. This work bind-mounts only the global cache, so the prose and comments now say so explicitly rather than talking about "bind mode". No behavior change. Also corrects the header, which still described the changes as gated behind an environment variable after they were switched to socktainer auto-detection. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> docs: track upstream socktainer issue/PR status in HANDOFF.md, for ddev#7372 [skip ci] Cross-reference each blocker with its fix's current status (filed, PR open, fix ready but not yet submitted, or investigated-but-not-reproducible), and point to the rfay/socktainer fork's UPSTREAM_ROLLOUT.md for the full ranked plan, so status lives in the branch instead of only in PR comments. feat(apple-container): force Mutagen off on socktainer, for ddev#7372 [skip ci] Mutagen mounts project_mutagen at both /var/www and /tmp/project_mutagen in the web container. On Apple Container that is two attachments of one block-backed volume within a single container, which no configuration can satisfy, so the container never boots: VZErrorDomain Code=2 "The storage device attachment is invalid." Rather than leave every project to discover this, GetPerformanceMode() returns "none" when the provider is socktainer, with a WarningOnce naming the reason. Projects that already resolve to "none" are unaffected and silent. no_bind_mounts normally forces Mutagen on as the only way to get code into the container. It cannot work here either, so it is not honored and gets its own warning instead of failing the same way. Behavior on every other provider is unchanged: IsSocktainer() returns false and both paths keep their previous values. Verified against a project whose only relevant setting was the global performance_mode: mutagen default. The warning appears once per command, the web container gets "bind <project> -> /var/www/html", and no project_mutagen volume is mounted. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> feat(apple-container): stop re-mounting the db volume while its container runs, for ddev#7372 [skip ci] Two DDEV code paths mount the database volume into a throwaway container while the project's own db container already has it. On apple container a volume takes either one writer or any number of readers, never a mix, so the second attachment aborts the helper's boot: VZErrorDomain Code=2 "The storage device attachment is invalid." - getDBVersionFromVolume() ran a GetExistingDBType-* container for this, and util.Failed() made the error fatal, so `ddev start` and `ddev config` both died for any project whose db was running. It now reads the version file with dockerutil.Exec into that running container, which starts no container at all and is cheaper on every provider. - the start-chown-* container mounted the volume to fix ownership. Skipped when the db container is up, since ownership was set on an earlier start. Behavior elsewhere is unchanged: with no running db container both paths do exactly what they did before. Verified with two projects running at once on apple container, which was previously impossible, both serving 200 with no per-project workaround files. `ddev restart` works repeatably (~27s). `ddev start` over an already-running project still fails on apple container's global hostname uniqueness, which is upstream of socktainer and unrelated to these paths. HANDOFF.md records the four socktainer-side findings from the same session (start_period slept rather than probed, HostConfig.PortBindings nil, health probes forced to root, hostname uniqueness) and retires blocker 5 plus the healthcheck and chown workarounds, which are now harmful rather than helpful. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> feat(apple-container): add IsAppleContainer() and report it as its own environment, for ddev#7372 [skip ci] DDEV had no vocabulary for "the runtime is apple container" distinct from "the API in front of it is socktainer" — every check went through IsSocktainer(), and `ddev version` reported ddev-environment=darwin and docker-platform=linux-docker, indistinguishable from any other Docker provider on macOS even though apple container's constraints (single-writer volumes, virtiofs bind mounts, global hostname uniqueness) are unlike any of them. Adds dockerutil.IsAppleContainer(), currently detected through IsSocktainer() since socktainer is the only Docker-compatible API in front of apple container today; the two questions are kept separate since that may not stay true. All apple-container-specific call sites (UseBindGlobalCache, the two Mutagen warnings, GetDockerPlatform, activeDockerProvider, the addon virtiofs-propagation sleep) now go through it instead of IsSocktainer() directly. `ddev version` and `ddev debug port` now report: ddev-environment apple-container (was: darwin) docker-platform apple-container (was: linux-docker) Every other provider (OrbStack, Colima, Podman, ...) and Docker being unreachable were retested and are unaffected. Also folds in an audit of every RunSimpleContainer call site for other double-mounts of the database volume: none exist beyond the two already fixed in the prior commit, and RestoreSnapshot always removes the db container before touching its volume, so it was never at risk. Corrected HANDOFF.md, which had speculatively listed it as untested. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> docs: record restart/db-recreate finding and full rebuild recipe, for ddev#7372 [skip ci] Two things from today's session. First, investigated why `ddev restart` recreates the db/web containers every time on apple container: it isn't a bug. `Restart()` is `Stop()`+`Start()`, and `Stop()` always removes the containers first, so compose has nothing to compare a config hash against on the way back up — the same thing happens on every provider, apple container is just slower at it (likely the volume block-attach cost from blocker 1). Second, tore down and rebuilt the entire apple-container/socktainer stack from nothing (system, socktainer binary, docker context) to confirm it's reproducible, and documented the exact recipe. That rebuild also surfaced and fixed a real socktainer bug: ApiVersion/MinAPIVersion carried a stray "v" prefix that silently failed DDEV's own minimum- Docker-version check regardless of the actual version number. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> docs: reorganize HANDOFF.md by DDEV priority and fix stale branch/PR status, for ddev#7372 [skip ci] Split the numbered "Blockers" list into open vs. fixed, ordered by actual impact on DDEV instead of numeric IDs. Added a fix-branches table near the top, linked to every referenced branch/issue/PR. Corrected stale status (PR ddev#347 and issue ddev#346 are closed, not open) and split out the still-open DNS wrong-network-address bug from the already-fixed AAAA/EDNS0 bug it had been bundled with. Re-ranked the table by DDEV impact rather than the fork's diff-risk-based submission order, and surfaced the still-unbranched exec-upgrade/attachStdin fix, which is the actual cause of the `ddev start` hang. docs: correct HANDOFF.md, the exec-upgrade/attachStdin fix already exists, for ddev#7372 [skip ci] The previous commit added a table row proposing a new branch/issue for "socktainer only upgrades exec connection when stdin is attached." Checking the socktainer fork before filing anything found the fix already exists: fix/exec-hijack-close was rewritten on 2026-08-05 (commit 53cc0f3, local only, not pushed) to fix the attachStdin gating and the EOF-close bug together, superseding the closed PR ddev#347 for both. Move that branch back into the top DDEV-start-blocking tier and correct the prose sections that still described it as a real-but-non-blocking bug.
rfay
added a commit
to rfay/ddev
that referenced
this pull request
Aug 28, 2026
…t, for ddev#7372 [skip ci] - For ddev#7372 Apple Container (via socktainer) cannot run DDEV as-is. The dominant blocker is that Apple Container backs each named volume with an ext4 block image that can only be attached to one running VM at a time, so `ddev-global-cache` — mounted simultaneously by web, db, router and every helper container — fails with `VZErrorDomain Code=2 "The storage device attachment is invalid."`. It does not solve it; it establishes how far DDEV can get and what is left. With these changes plus the host-side workarounds documented in HANDOFF.md, `ddev start` brings web, db and ddev-router to healthy (10.5s each) and traefik routes correctly from the host. Remaining blockers are upstream, and the two that still stop a page from being served are catalogued in HANDOFF.md. All code changes are gated behind `DDEV_BIND_GLOBAL_CACHE=true`. With the variable unset, rendering and behavior are unchanged; the compose templates emit exactly what they did before. - `pkg/globalconfig/global_config.go`: `UseBindGlobalCache()`, `GlobalCacheSource()`, `GlobalCacheMount()`. In bind mode the global cache is a host directory (`~/.ddev/global-cache-bind`) rather than a Docker volume, because virtiofs bind mounts can be shared between running containers. - `pkg/ddevapp/ddevapp.go`: use the helper for every `/mnt/ddev-global-cache` mount; skip volume creation and create the host directory instead; add `copyIntoGlobalCache()`, which copies on the host in bind mode. Copying a directory into a container is unsupported by socktainer and hangs when driven through the API. - `pkg/ddevapp/commands.go`, `pkg/ddevapp/traefik.go`: route their copies through `copyIntoGlobalCache()`. - `pkg/ddevapp/app_compose_template.yaml`, `pkg/ddevapp/router_compose_template.yaml`, `config.go`, `router.go`: add `GlobalCacheMount` / `BindGlobalCache` template vars, omit the `volumes:` block when it would render empty, and place project services on `ddev_default` only, since Apple Container gives a container one NIC and `docker network connect` is a no-op. HANDOFF.md records the full analysis: eleven upstream blockers with reproductions, the host-side workarounds needed (gateway DNS, buildkit node), and six design options for replacing the shared-volume pattern. Three of those options are provider-independent improvements worth doing on their own. Requires macOS with Apple `container` 1.2.0 and `socktainer` 1.2.1, plus the host-side setup in HANDOFF.md (gateway dnsmasq and a hand-created buildkit node — buildx cannot bootstrap one under socktainer). ```bash docker context use socktainer mkdir ~/tmp/appletest && cd ~/tmp/appletest && echo '<?php phpinfo();' > index.php ddev config --project-type=php --docroot=. --project-name=appletest DDEV_BIND_GLOBAL_CACHE=true ddev start ``` To confirm nothing changed for normal providers, run `ddev debug compose-config` with the variable unset and verify the `ddev-global-cache` volume and both networks are still present. No new tests. This is exploratory work behind an environment variable that is off by default, and the paths it touches need an Apple Container host to exercise. `make staticrequired` is clean and `go test -short ./pkg/globalconfig/...` passes. Not for release. `DDEV_BIND_GLOBAL_CACHE` is undocumented and unsupported, and HANDOFF.md should be deleted before any of this merges to main. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> docs: refine shared-volume options with attach-rule testing, for ddev#7372 [skip ci] Testing showed the volume restriction is narrower than first documented. A volume is either attached read-write by exactly one container, or read-only by any number of them (verified with three simultaneous `:ro` attachers). Consequences, all verified rather than reasoned: - A long-lived writer container with `:ro` readers alongside it does NOT work; the exclusivity is on the block device, so a writer blocks every other attach, `:ro` included. Recorded so the pattern is not retried. - A *transient* writer does work: seed the volume read-write, exit, then let the project containers mount it `:ro`. Re-seeding requires every reader to be down, which is what `ddev start` / `ddev restart` already does. - Content written continuously by a running container (npm/Composer caches, n_prefix, corepack, shell history) cannot live in the read-only volume, and ddev-webserver's start.sh would need to stop running mkdir/chown under /mnt/ddev-global-cache/. - The owning-container idea still works if it serves the cache over HTTP instead of the filesystem, which covers downloads but not install prefixes. Adds design options 7 and 8 and marks 7 as the most promising direction, since unlike the bind-mount approach implemented behind DDEV_BIND_GLOBAL_CACHE it does not trade away volume performance. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> docs: add privileged-port blocker and cold-start recipe, for ddev#7372 [skip ci] Two failures found while reproducing a start that broke early. Ports below 1024 cannot be published at all: Apple Container's port forwarder runs unprivileged and rejects them with "Binding to ports below 1024 requires root privileges". This is DDEV's default configuration, and it had been masked until now by another router holding 80/443, which made DDEV fall back to ephemeral high ports. Workaround is router_http_port/router_https_port above 1024; a real Apple Container mode needs non-privileged defaults or no port publishing at all. The buildkit node must be recreated, never restarted. Once it exits, buildx restarts it and every build fails with `rbind ... operation not permitted`; `docker rm -f` plus an identical `docker run` fixes it immediately. Capabilities are not the explanation, since they survive a restart, so the cause is unidentified. Since the node exits whenever `container system` restarts, this is the most likely thing to bite when picking the work back up. Adds a cold-start recipe with the required ordering, because the environment does not survive idling: the default network's host bridge is torn down once nothing runs on it, which kills DNS and prevents dnsmasq from rebinding. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> feat(apple-container): auto-detect socktainer, add port and buildkit findings, for ddev#7372 [skip ci] Bind mode was gated behind DDEV_BIND_GLOBAL_CACHE, which is easy to forget: a `ddev start` in a terminal without it uses the volume path and fails in confusing ways. It now turns on automatically when the provider is socktainer. - `pkg/dockerutil/providers.go`: add `IsSocktainer()`, matching `Server.Platform.Name` in the same shape as the existing `IsPodman()`. Move `UseBindGlobalCache()`, `GlobalCacheSource()` and `GlobalCacheMount()` here from `globalconfig`, since detection needs a Docker call and `dockerutil` already imports `globalconfig` rather than the reverse. - `DDEV_BIND_GLOBAL_CACHE=true`/`=false` still forces the behavior either way for testing on other providers. When unset and the provider is not socktainer — including when the provider cannot be reached — detection returns false and rendering is byte-identical to before. Verified by rendering `ddev debug compose-config` both ways. Two failures found while reproducing a start that broke early: - Ports below 1024 cannot be published: Apple Container's forwarder runs unprivileged and rejects them. This is not a new class of problem for DDEV — rootless Podman is already a supported provider with the same restriction and the docs already tell users to configure unprivileged ports. The macOS wrinkle is that there is no `net.ipv4.ip_unprivileged_port_start` escape hatch, so it is mandatory rather than recommended. It had been masked until now by another router holding 80/443, which made DDEV fall back to ephemeral high ports. - The buildkit node must be recreated, never restarted. Once it exits, buildx restarts it and every build fails with `rbind ... operation not permitted`; `docker rm -f` plus an identical `docker run` fixes it. Capabilities are not the explanation, since they survive a restart, so the cause is unidentified. Also adds a cold-start recipe with the required ordering, because the environment does not survive idling: the default network's host bridge is torn down once nothing runs on it, which kills DNS and prevents dnsmasq rebinding. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> docs: say "global-cache bind mount", not "bind mode", for ddev#7372 [skip ci] "Bind mount" on its own is ambiguous in DDEV, where no_bind_mounts already refers to something else entirely: whether the project directory is mounted into the containers. This work bind-mounts only the global cache, so the prose and comments now say so explicitly rather than talking about "bind mode". No behavior change. Also corrects the header, which still described the changes as gated behind an environment variable after they were switched to socktainer auto-detection. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> docs: track upstream socktainer issue/PR status in HANDOFF.md, for ddev#7372 [skip ci] Cross-reference each blocker with its fix's current status (filed, PR open, fix ready but not yet submitted, or investigated-but-not-reproducible), and point to the rfay/socktainer fork's UPSTREAM_ROLLOUT.md for the full ranked plan, so status lives in the branch instead of only in PR comments. feat(apple-container): force Mutagen off on socktainer, for ddev#7372 [skip ci] Mutagen mounts project_mutagen at both /var/www and /tmp/project_mutagen in the web container. On Apple Container that is two attachments of one block-backed volume within a single container, which no configuration can satisfy, so the container never boots: VZErrorDomain Code=2 "The storage device attachment is invalid." Rather than leave every project to discover this, GetPerformanceMode() returns "none" when the provider is socktainer, with a WarningOnce naming the reason. Projects that already resolve to "none" are unaffected and silent. no_bind_mounts normally forces Mutagen on as the only way to get code into the container. It cannot work here either, so it is not honored and gets its own warning instead of failing the same way. Behavior on every other provider is unchanged: IsSocktainer() returns false and both paths keep their previous values. Verified against a project whose only relevant setting was the global performance_mode: mutagen default. The warning appears once per command, the web container gets "bind <project> -> /var/www/html", and no project_mutagen volume is mounted. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> feat(apple-container): stop re-mounting the db volume while its container runs, for ddev#7372 [skip ci] Two DDEV code paths mount the database volume into a throwaway container while the project's own db container already has it. On apple container a volume takes either one writer or any number of readers, never a mix, so the second attachment aborts the helper's boot: VZErrorDomain Code=2 "The storage device attachment is invalid." - getDBVersionFromVolume() ran a GetExistingDBType-* container for this, and util.Failed() made the error fatal, so `ddev start` and `ddev config` both died for any project whose db was running. It now reads the version file with dockerutil.Exec into that running container, which starts no container at all and is cheaper on every provider. - the start-chown-* container mounted the volume to fix ownership. Skipped when the db container is up, since ownership was set on an earlier start. Behavior elsewhere is unchanged: with no running db container both paths do exactly what they did before. Verified with two projects running at once on apple container, which was previously impossible, both serving 200 with no per-project workaround files. `ddev restart` works repeatably (~27s). `ddev start` over an already-running project still fails on apple container's global hostname uniqueness, which is upstream of socktainer and unrelated to these paths. HANDOFF.md records the four socktainer-side findings from the same session (start_period slept rather than probed, HostConfig.PortBindings nil, health probes forced to root, hostname uniqueness) and retires blocker 5 plus the healthcheck and chown workarounds, which are now harmful rather than helpful. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> feat(apple-container): add IsAppleContainer() and report it as its own environment, for ddev#7372 [skip ci] DDEV had no vocabulary for "the runtime is apple container" distinct from "the API in front of it is socktainer" — every check went through IsSocktainer(), and `ddev version` reported ddev-environment=darwin and docker-platform=linux-docker, indistinguishable from any other Docker provider on macOS even though apple container's constraints (single-writer volumes, virtiofs bind mounts, global hostname uniqueness) are unlike any of them. Adds dockerutil.IsAppleContainer(), currently detected through IsSocktainer() since socktainer is the only Docker-compatible API in front of apple container today; the two questions are kept separate since that may not stay true. All apple-container-specific call sites (UseBindGlobalCache, the two Mutagen warnings, GetDockerPlatform, activeDockerProvider, the addon virtiofs-propagation sleep) now go through it instead of IsSocktainer() directly. `ddev version` and `ddev debug port` now report: ddev-environment apple-container (was: darwin) docker-platform apple-container (was: linux-docker) Every other provider (OrbStack, Colima, Podman, ...) and Docker being unreachable were retested and are unaffected. Also folds in an audit of every RunSimpleContainer call site for other double-mounts of the database volume: none exist beyond the two already fixed in the prior commit, and RestoreSnapshot always removes the db container before touching its volume, so it was never at risk. Corrected HANDOFF.md, which had speculatively listed it as untested. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> docs: record restart/db-recreate finding and full rebuild recipe, for ddev#7372 [skip ci] Two things from today's session. First, investigated why `ddev restart` recreates the db/web containers every time on apple container: it isn't a bug. `Restart()` is `Stop()`+`Start()`, and `Stop()` always removes the containers first, so compose has nothing to compare a config hash against on the way back up — the same thing happens on every provider, apple container is just slower at it (likely the volume block-attach cost from blocker 1). Second, tore down and rebuilt the entire apple-container/socktainer stack from nothing (system, socktainer binary, docker context) to confirm it's reproducible, and documented the exact recipe. That rebuild also surfaced and fixed a real socktainer bug: ApiVersion/MinAPIVersion carried a stray "v" prefix that silently failed DDEV's own minimum- Docker-version check regardless of the actual version number. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> docs: reorganize HANDOFF.md by DDEV priority and fix stale branch/PR status, for ddev#7372 [skip ci] Split the numbered "Blockers" list into open vs. fixed, ordered by actual impact on DDEV instead of numeric IDs. Added a fix-branches table near the top, linked to every referenced branch/issue/PR. Corrected stale status (PR ddev#347 and issue ddev#346 are closed, not open) and split out the still-open DNS wrong-network-address bug from the already-fixed AAAA/EDNS0 bug it had been bundled with. Re-ranked the table by DDEV impact rather than the fork's diff-risk-based submission order, and surfaced the still-unbranched exec-upgrade/attachStdin fix, which is the actual cause of the `ddev start` hang. docs: correct HANDOFF.md, the exec-upgrade/attachStdin fix already exists, for ddev#7372 [skip ci] The previous commit added a table row proposing a new branch/issue for "socktainer only upgrades exec connection when stdin is attached." Checking the socktainer fork before filing anything found the fix already exists: fix/exec-hijack-close was rewritten on 2026-08-05 (commit 53cc0f3, local only, not pushed) to fix the attachStdin gating and the EOF-close bug together, superseding the closed PR ddev#347 for both. Move that branch back into the top DDEV-start-blocking tier and correct the prose sections that still described it as a real-but-non-blocking bug.
rfay
added a commit
to rfay/ddev
that referenced
this pull request
Sep 16, 2026
…t, for ddev#7372 [skip ci] - For ddev#7372 Apple Container (via socktainer) cannot run DDEV as-is. The dominant blocker is that Apple Container backs each named volume with an ext4 block image that can only be attached to one running VM at a time, so `ddev-global-cache` — mounted simultaneously by web, db, router and every helper container — fails with `VZErrorDomain Code=2 "The storage device attachment is invalid."`. It does not solve it; it establishes how far DDEV can get and what is left. With these changes plus the host-side workarounds documented in HANDOFF.md, `ddev start` brings web, db and ddev-router to healthy (10.5s each) and traefik routes correctly from the host. Remaining blockers are upstream, and the two that still stop a page from being served are catalogued in HANDOFF.md. All code changes are gated behind `DDEV_BIND_GLOBAL_CACHE=true`. With the variable unset, rendering and behavior are unchanged; the compose templates emit exactly what they did before. - `pkg/globalconfig/global_config.go`: `UseBindGlobalCache()`, `GlobalCacheSource()`, `GlobalCacheMount()`. In bind mode the global cache is a host directory (`~/.ddev/global-cache-bind`) rather than a Docker volume, because virtiofs bind mounts can be shared between running containers. - `pkg/ddevapp/ddevapp.go`: use the helper for every `/mnt/ddev-global-cache` mount; skip volume creation and create the host directory instead; add `copyIntoGlobalCache()`, which copies on the host in bind mode. Copying a directory into a container is unsupported by socktainer and hangs when driven through the API. - `pkg/ddevapp/commands.go`, `pkg/ddevapp/traefik.go`: route their copies through `copyIntoGlobalCache()`. - `pkg/ddevapp/app_compose_template.yaml`, `pkg/ddevapp/router_compose_template.yaml`, `config.go`, `router.go`: add `GlobalCacheMount` / `BindGlobalCache` template vars, omit the `volumes:` block when it would render empty, and place project services on `ddev_default` only, since Apple Container gives a container one NIC and `docker network connect` is a no-op. HANDOFF.md records the full analysis: eleven upstream blockers with reproductions, the host-side workarounds needed (gateway DNS, buildkit node), and six design options for replacing the shared-volume pattern. Three of those options are provider-independent improvements worth doing on their own. Requires macOS with Apple `container` 1.2.0 and `socktainer` 1.2.1, plus the host-side setup in HANDOFF.md (gateway dnsmasq and a hand-created buildkit node — buildx cannot bootstrap one under socktainer). ```bash docker context use socktainer mkdir ~/tmp/appletest && cd ~/tmp/appletest && echo '<?php phpinfo();' > index.php ddev config --project-type=php --docroot=. --project-name=appletest DDEV_BIND_GLOBAL_CACHE=true ddev start ``` To confirm nothing changed for normal providers, run `ddev debug compose-config` with the variable unset and verify the `ddev-global-cache` volume and both networks are still present. No new tests. This is exploratory work behind an environment variable that is off by default, and the paths it touches need an Apple Container host to exercise. `make staticrequired` is clean and `go test -short ./pkg/globalconfig/...` passes. Not for release. `DDEV_BIND_GLOBAL_CACHE` is undocumented and unsupported, and HANDOFF.md should be deleted before any of this merges to main. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> docs: refine shared-volume options with attach-rule testing, for ddev#7372 [skip ci] Testing showed the volume restriction is narrower than first documented. A volume is either attached read-write by exactly one container, or read-only by any number of them (verified with three simultaneous `:ro` attachers). Consequences, all verified rather than reasoned: - A long-lived writer container with `:ro` readers alongside it does NOT work; the exclusivity is on the block device, so a writer blocks every other attach, `:ro` included. Recorded so the pattern is not retried. - A *transient* writer does work: seed the volume read-write, exit, then let the project containers mount it `:ro`. Re-seeding requires every reader to be down, which is what `ddev start` / `ddev restart` already does. - Content written continuously by a running container (npm/Composer caches, n_prefix, corepack, shell history) cannot live in the read-only volume, and ddev-webserver's start.sh would need to stop running mkdir/chown under /mnt/ddev-global-cache/. - The owning-container idea still works if it serves the cache over HTTP instead of the filesystem, which covers downloads but not install prefixes. Adds design options 7 and 8 and marks 7 as the most promising direction, since unlike the bind-mount approach implemented behind DDEV_BIND_GLOBAL_CACHE it does not trade away volume performance. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> docs: add privileged-port blocker and cold-start recipe, for ddev#7372 [skip ci] Two failures found while reproducing a start that broke early. Ports below 1024 cannot be published at all: Apple Container's port forwarder runs unprivileged and rejects them with "Binding to ports below 1024 requires root privileges". This is DDEV's default configuration, and it had been masked until now by another router holding 80/443, which made DDEV fall back to ephemeral high ports. Workaround is router_http_port/router_https_port above 1024; a real Apple Container mode needs non-privileged defaults or no port publishing at all. The buildkit node must be recreated, never restarted. Once it exits, buildx restarts it and every build fails with `rbind ... operation not permitted`; `docker rm -f` plus an identical `docker run` fixes it immediately. Capabilities are not the explanation, since they survive a restart, so the cause is unidentified. Since the node exits whenever `container system` restarts, this is the most likely thing to bite when picking the work back up. Adds a cold-start recipe with the required ordering, because the environment does not survive idling: the default network's host bridge is torn down once nothing runs on it, which kills DNS and prevents dnsmasq from rebinding. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> feat(apple-container): auto-detect socktainer, add port and buildkit findings, for ddev#7372 [skip ci] Bind mode was gated behind DDEV_BIND_GLOBAL_CACHE, which is easy to forget: a `ddev start` in a terminal without it uses the volume path and fails in confusing ways. It now turns on automatically when the provider is socktainer. - `pkg/dockerutil/providers.go`: add `IsSocktainer()`, matching `Server.Platform.Name` in the same shape as the existing `IsPodman()`. Move `UseBindGlobalCache()`, `GlobalCacheSource()` and `GlobalCacheMount()` here from `globalconfig`, since detection needs a Docker call and `dockerutil` already imports `globalconfig` rather than the reverse. - `DDEV_BIND_GLOBAL_CACHE=true`/`=false` still forces the behavior either way for testing on other providers. When unset and the provider is not socktainer — including when the provider cannot be reached — detection returns false and rendering is byte-identical to before. Verified by rendering `ddev debug compose-config` both ways. Two failures found while reproducing a start that broke early: - Ports below 1024 cannot be published: Apple Container's forwarder runs unprivileged and rejects them. This is not a new class of problem for DDEV — rootless Podman is already a supported provider with the same restriction and the docs already tell users to configure unprivileged ports. The macOS wrinkle is that there is no `net.ipv4.ip_unprivileged_port_start` escape hatch, so it is mandatory rather than recommended. It had been masked until now by another router holding 80/443, which made DDEV fall back to ephemeral high ports. - The buildkit node must be recreated, never restarted. Once it exits, buildx restarts it and every build fails with `rbind ... operation not permitted`; `docker rm -f` plus an identical `docker run` fixes it. Capabilities are not the explanation, since they survive a restart, so the cause is unidentified. Also adds a cold-start recipe with the required ordering, because the environment does not survive idling: the default network's host bridge is torn down once nothing runs on it, which kills DNS and prevents dnsmasq rebinding. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> docs: say "global-cache bind mount", not "bind mode", for ddev#7372 [skip ci] "Bind mount" on its own is ambiguous in DDEV, where no_bind_mounts already refers to something else entirely: whether the project directory is mounted into the containers. This work bind-mounts only the global cache, so the prose and comments now say so explicitly rather than talking about "bind mode". No behavior change. Also corrects the header, which still described the changes as gated behind an environment variable after they were switched to socktainer auto-detection. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> docs: track upstream socktainer issue/PR status in HANDOFF.md, for ddev#7372 [skip ci] Cross-reference each blocker with its fix's current status (filed, PR open, fix ready but not yet submitted, or investigated-but-not-reproducible), and point to the rfay/socktainer fork's UPSTREAM_ROLLOUT.md for the full ranked plan, so status lives in the branch instead of only in PR comments. feat(apple-container): force Mutagen off on socktainer, for ddev#7372 [skip ci] Mutagen mounts project_mutagen at both /var/www and /tmp/project_mutagen in the web container. On Apple Container that is two attachments of one block-backed volume within a single container, which no configuration can satisfy, so the container never boots: VZErrorDomain Code=2 "The storage device attachment is invalid." Rather than leave every project to discover this, GetPerformanceMode() returns "none" when the provider is socktainer, with a WarningOnce naming the reason. Projects that already resolve to "none" are unaffected and silent. no_bind_mounts normally forces Mutagen on as the only way to get code into the container. It cannot work here either, so it is not honored and gets its own warning instead of failing the same way. Behavior on every other provider is unchanged: IsSocktainer() returns false and both paths keep their previous values. Verified against a project whose only relevant setting was the global performance_mode: mutagen default. The warning appears once per command, the web container gets "bind <project> -> /var/www/html", and no project_mutagen volume is mounted. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> feat(apple-container): stop re-mounting the db volume while its container runs, for ddev#7372 [skip ci] Two DDEV code paths mount the database volume into a throwaway container while the project's own db container already has it. On apple container a volume takes either one writer or any number of readers, never a mix, so the second attachment aborts the helper's boot: VZErrorDomain Code=2 "The storage device attachment is invalid." - getDBVersionFromVolume() ran a GetExistingDBType-* container for this, and util.Failed() made the error fatal, so `ddev start` and `ddev config` both died for any project whose db was running. It now reads the version file with dockerutil.Exec into that running container, which starts no container at all and is cheaper on every provider. - the start-chown-* container mounted the volume to fix ownership. Skipped when the db container is up, since ownership was set on an earlier start. Behavior elsewhere is unchanged: with no running db container both paths do exactly what they did before. Verified with two projects running at once on apple container, which was previously impossible, both serving 200 with no per-project workaround files. `ddev restart` works repeatably (~27s). `ddev start` over an already-running project still fails on apple container's global hostname uniqueness, which is upstream of socktainer and unrelated to these paths. HANDOFF.md records the four socktainer-side findings from the same session (start_period slept rather than probed, HostConfig.PortBindings nil, health probes forced to root, hostname uniqueness) and retires blocker 5 plus the healthcheck and chown workarounds, which are now harmful rather than helpful. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> feat(apple-container): add IsAppleContainer() and report it as its own environment, for ddev#7372 [skip ci] DDEV had no vocabulary for "the runtime is apple container" distinct from "the API in front of it is socktainer" — every check went through IsSocktainer(), and `ddev version` reported ddev-environment=darwin and docker-platform=linux-docker, indistinguishable from any other Docker provider on macOS even though apple container's constraints (single-writer volumes, virtiofs bind mounts, global hostname uniqueness) are unlike any of them. Adds dockerutil.IsAppleContainer(), currently detected through IsSocktainer() since socktainer is the only Docker-compatible API in front of apple container today; the two questions are kept separate since that may not stay true. All apple-container-specific call sites (UseBindGlobalCache, the two Mutagen warnings, GetDockerPlatform, activeDockerProvider, the addon virtiofs-propagation sleep) now go through it instead of IsSocktainer() directly. `ddev version` and `ddev debug port` now report: ddev-environment apple-container (was: darwin) docker-platform apple-container (was: linux-docker) Every other provider (OrbStack, Colima, Podman, ...) and Docker being unreachable were retested and are unaffected. Also folds in an audit of every RunSimpleContainer call site for other double-mounts of the database volume: none exist beyond the two already fixed in the prior commit, and RestoreSnapshot always removes the db container before touching its volume, so it was never at risk. Corrected HANDOFF.md, which had speculatively listed it as untested. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> docs: record restart/db-recreate finding and full rebuild recipe, for ddev#7372 [skip ci] Two things from today's session. First, investigated why `ddev restart` recreates the db/web containers every time on apple container: it isn't a bug. `Restart()` is `Stop()`+`Start()`, and `Stop()` always removes the containers first, so compose has nothing to compare a config hash against on the way back up — the same thing happens on every provider, apple container is just slower at it (likely the volume block-attach cost from blocker 1). Second, tore down and rebuilt the entire apple-container/socktainer stack from nothing (system, socktainer binary, docker context) to confirm it's reproducible, and documented the exact recipe. That rebuild also surfaced and fixed a real socktainer bug: ApiVersion/MinAPIVersion carried a stray "v" prefix that silently failed DDEV's own minimum- Docker-version check regardless of the actual version number. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> docs: reorganize HANDOFF.md by DDEV priority and fix stale branch/PR status, for ddev#7372 [skip ci] Split the numbered "Blockers" list into open vs. fixed, ordered by actual impact on DDEV instead of numeric IDs. Added a fix-branches table near the top, linked to every referenced branch/issue/PR. Corrected stale status (PR ddev#347 and issue ddev#346 are closed, not open) and split out the still-open DNS wrong-network-address bug from the already-fixed AAAA/EDNS0 bug it had been bundled with. Re-ranked the table by DDEV impact rather than the fork's diff-risk-based submission order, and surfaced the still-unbranched exec-upgrade/attachStdin fix, which is the actual cause of the `ddev start` hang. docs: correct HANDOFF.md, the exec-upgrade/attachStdin fix already exists, for ddev#7372 [skip ci] The previous commit added a table row proposing a new branch/issue for "socktainer only upgrades exec connection when stdin is attached." Checking the socktainer fork before filing anything found the fix already exists: fix/exec-hijack-close was rewritten on 2026-08-05 (commit 53cc0f3, local only, not pushed) to fix the attachStdin gating and the EOF-close bug together, superseding the closed PR ddev#347 for both. Move that branch back into the top DDEV-start-blocking tier and correct the prose sections that still described it as a real-but-non-blocking bug.
rfay
added a commit
to rfay/ddev
that referenced
this pull request
Sep 23, 2026
…t, for ddev#7372 [skip ci] - For ddev#7372 Apple Container (via socktainer) cannot run DDEV as-is. The dominant blocker is that Apple Container backs each named volume with an ext4 block image that can only be attached to one running VM at a time, so `ddev-global-cache` — mounted simultaneously by web, db, router and every helper container — fails with `VZErrorDomain Code=2 "The storage device attachment is invalid."`. It does not solve it; it establishes how far DDEV can get and what is left. With these changes plus the host-side workarounds documented in HANDOFF.md, `ddev start` brings web, db and ddev-router to healthy (10.5s each) and traefik routes correctly from the host. Remaining blockers are upstream, and the two that still stop a page from being served are catalogued in HANDOFF.md. All code changes are gated behind `DDEV_BIND_GLOBAL_CACHE=true`. With the variable unset, rendering and behavior are unchanged; the compose templates emit exactly what they did before. - `pkg/globalconfig/global_config.go`: `UseBindGlobalCache()`, `GlobalCacheSource()`, `GlobalCacheMount()`. In bind mode the global cache is a host directory (`~/.ddev/global-cache-bind`) rather than a Docker volume, because virtiofs bind mounts can be shared between running containers. - `pkg/ddevapp/ddevapp.go`: use the helper for every `/mnt/ddev-global-cache` mount; skip volume creation and create the host directory instead; add `copyIntoGlobalCache()`, which copies on the host in bind mode. Copying a directory into a container is unsupported by socktainer and hangs when driven through the API. - `pkg/ddevapp/commands.go`, `pkg/ddevapp/traefik.go`: route their copies through `copyIntoGlobalCache()`. - `pkg/ddevapp/app_compose_template.yaml`, `pkg/ddevapp/router_compose_template.yaml`, `config.go`, `router.go`: add `GlobalCacheMount` / `BindGlobalCache` template vars, omit the `volumes:` block when it would render empty, and place project services on `ddev_default` only, since Apple Container gives a container one NIC and `docker network connect` is a no-op. HANDOFF.md records the full analysis: eleven upstream blockers with reproductions, the host-side workarounds needed (gateway DNS, buildkit node), and six design options for replacing the shared-volume pattern. Three of those options are provider-independent improvements worth doing on their own. Requires macOS with Apple `container` 1.2.0 and `socktainer` 1.2.1, plus the host-side setup in HANDOFF.md (gateway dnsmasq and a hand-created buildkit node — buildx cannot bootstrap one under socktainer). ```bash docker context use socktainer mkdir ~/tmp/appletest && cd ~/tmp/appletest && echo '<?php phpinfo();' > index.php ddev config --project-type=php --docroot=. --project-name=appletest DDEV_BIND_GLOBAL_CACHE=true ddev start ``` To confirm nothing changed for normal providers, run `ddev debug compose-config` with the variable unset and verify the `ddev-global-cache` volume and both networks are still present. No new tests. This is exploratory work behind an environment variable that is off by default, and the paths it touches need an Apple Container host to exercise. `make staticrequired` is clean and `go test -short ./pkg/globalconfig/...` passes. Not for release. `DDEV_BIND_GLOBAL_CACHE` is undocumented and unsupported, and HANDOFF.md should be deleted before any of this merges to main. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> docs: refine shared-volume options with attach-rule testing, for ddev#7372 [skip ci] Testing showed the volume restriction is narrower than first documented. A volume is either attached read-write by exactly one container, or read-only by any number of them (verified with three simultaneous `:ro` attachers). Consequences, all verified rather than reasoned: - A long-lived writer container with `:ro` readers alongside it does NOT work; the exclusivity is on the block device, so a writer blocks every other attach, `:ro` included. Recorded so the pattern is not retried. - A *transient* writer does work: seed the volume read-write, exit, then let the project containers mount it `:ro`. Re-seeding requires every reader to be down, which is what `ddev start` / `ddev restart` already does. - Content written continuously by a running container (npm/Composer caches, n_prefix, corepack, shell history) cannot live in the read-only volume, and ddev-webserver's start.sh would need to stop running mkdir/chown under /mnt/ddev-global-cache/. - The owning-container idea still works if it serves the cache over HTTP instead of the filesystem, which covers downloads but not install prefixes. Adds design options 7 and 8 and marks 7 as the most promising direction, since unlike the bind-mount approach implemented behind DDEV_BIND_GLOBAL_CACHE it does not trade away volume performance. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> docs: add privileged-port blocker and cold-start recipe, for ddev#7372 [skip ci] Two failures found while reproducing a start that broke early. Ports below 1024 cannot be published at all: Apple Container's port forwarder runs unprivileged and rejects them with "Binding to ports below 1024 requires root privileges". This is DDEV's default configuration, and it had been masked until now by another router holding 80/443, which made DDEV fall back to ephemeral high ports. Workaround is router_http_port/router_https_port above 1024; a real Apple Container mode needs non-privileged defaults or no port publishing at all. The buildkit node must be recreated, never restarted. Once it exits, buildx restarts it and every build fails with `rbind ... operation not permitted`; `docker rm -f` plus an identical `docker run` fixes it immediately. Capabilities are not the explanation, since they survive a restart, so the cause is unidentified. Since the node exits whenever `container system` restarts, this is the most likely thing to bite when picking the work back up. Adds a cold-start recipe with the required ordering, because the environment does not survive idling: the default network's host bridge is torn down once nothing runs on it, which kills DNS and prevents dnsmasq from rebinding. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> feat(apple-container): auto-detect socktainer, add port and buildkit findings, for ddev#7372 [skip ci] Bind mode was gated behind DDEV_BIND_GLOBAL_CACHE, which is easy to forget: a `ddev start` in a terminal without it uses the volume path and fails in confusing ways. It now turns on automatically when the provider is socktainer. - `pkg/dockerutil/providers.go`: add `IsSocktainer()`, matching `Server.Platform.Name` in the same shape as the existing `IsPodman()`. Move `UseBindGlobalCache()`, `GlobalCacheSource()` and `GlobalCacheMount()` here from `globalconfig`, since detection needs a Docker call and `dockerutil` already imports `globalconfig` rather than the reverse. - `DDEV_BIND_GLOBAL_CACHE=true`/`=false` still forces the behavior either way for testing on other providers. When unset and the provider is not socktainer — including when the provider cannot be reached — detection returns false and rendering is byte-identical to before. Verified by rendering `ddev debug compose-config` both ways. Two failures found while reproducing a start that broke early: - Ports below 1024 cannot be published: Apple Container's forwarder runs unprivileged and rejects them. This is not a new class of problem for DDEV — rootless Podman is already a supported provider with the same restriction and the docs already tell users to configure unprivileged ports. The macOS wrinkle is that there is no `net.ipv4.ip_unprivileged_port_start` escape hatch, so it is mandatory rather than recommended. It had been masked until now by another router holding 80/443, which made DDEV fall back to ephemeral high ports. - The buildkit node must be recreated, never restarted. Once it exits, buildx restarts it and every build fails with `rbind ... operation not permitted`; `docker rm -f` plus an identical `docker run` fixes it. Capabilities are not the explanation, since they survive a restart, so the cause is unidentified. Also adds a cold-start recipe with the required ordering, because the environment does not survive idling: the default network's host bridge is torn down once nothing runs on it, which kills DNS and prevents dnsmasq rebinding. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> docs: say "global-cache bind mount", not "bind mode", for ddev#7372 [skip ci] "Bind mount" on its own is ambiguous in DDEV, where no_bind_mounts already refers to something else entirely: whether the project directory is mounted into the containers. This work bind-mounts only the global cache, so the prose and comments now say so explicitly rather than talking about "bind mode". No behavior change. Also corrects the header, which still described the changes as gated behind an environment variable after they were switched to socktainer auto-detection. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> docs: track upstream socktainer issue/PR status in HANDOFF.md, for ddev#7372 [skip ci] Cross-reference each blocker with its fix's current status (filed, PR open, fix ready but not yet submitted, or investigated-but-not-reproducible), and point to the rfay/socktainer fork's UPSTREAM_ROLLOUT.md for the full ranked plan, so status lives in the branch instead of only in PR comments. feat(apple-container): force Mutagen off on socktainer, for ddev#7372 [skip ci] Mutagen mounts project_mutagen at both /var/www and /tmp/project_mutagen in the web container. On Apple Container that is two attachments of one block-backed volume within a single container, which no configuration can satisfy, so the container never boots: VZErrorDomain Code=2 "The storage device attachment is invalid." Rather than leave every project to discover this, GetPerformanceMode() returns "none" when the provider is socktainer, with a WarningOnce naming the reason. Projects that already resolve to "none" are unaffected and silent. no_bind_mounts normally forces Mutagen on as the only way to get code into the container. It cannot work here either, so it is not honored and gets its own warning instead of failing the same way. Behavior on every other provider is unchanged: IsSocktainer() returns false and both paths keep their previous values. Verified against a project whose only relevant setting was the global performance_mode: mutagen default. The warning appears once per command, the web container gets "bind <project> -> /var/www/html", and no project_mutagen volume is mounted. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> feat(apple-container): stop re-mounting the db volume while its container runs, for ddev#7372 [skip ci] Two DDEV code paths mount the database volume into a throwaway container while the project's own db container already has it. On apple container a volume takes either one writer or any number of readers, never a mix, so the second attachment aborts the helper's boot: VZErrorDomain Code=2 "The storage device attachment is invalid." - getDBVersionFromVolume() ran a GetExistingDBType-* container for this, and util.Failed() made the error fatal, so `ddev start` and `ddev config` both died for any project whose db was running. It now reads the version file with dockerutil.Exec into that running container, which starts no container at all and is cheaper on every provider. - the start-chown-* container mounted the volume to fix ownership. Skipped when the db container is up, since ownership was set on an earlier start. Behavior elsewhere is unchanged: with no running db container both paths do exactly what they did before. Verified with two projects running at once on apple container, which was previously impossible, both serving 200 with no per-project workaround files. `ddev restart` works repeatably (~27s). `ddev start` over an already-running project still fails on apple container's global hostname uniqueness, which is upstream of socktainer and unrelated to these paths. HANDOFF.md records the four socktainer-side findings from the same session (start_period slept rather than probed, HostConfig.PortBindings nil, health probes forced to root, hostname uniqueness) and retires blocker 5 plus the healthcheck and chown workarounds, which are now harmful rather than helpful. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> feat(apple-container): add IsAppleContainer() and report it as its own environment, for ddev#7372 [skip ci] DDEV had no vocabulary for "the runtime is apple container" distinct from "the API in front of it is socktainer" — every check went through IsSocktainer(), and `ddev version` reported ddev-environment=darwin and docker-platform=linux-docker, indistinguishable from any other Docker provider on macOS even though apple container's constraints (single-writer volumes, virtiofs bind mounts, global hostname uniqueness) are unlike any of them. Adds dockerutil.IsAppleContainer(), currently detected through IsSocktainer() since socktainer is the only Docker-compatible API in front of apple container today; the two questions are kept separate since that may not stay true. All apple-container-specific call sites (UseBindGlobalCache, the two Mutagen warnings, GetDockerPlatform, activeDockerProvider, the addon virtiofs-propagation sleep) now go through it instead of IsSocktainer() directly. `ddev version` and `ddev debug port` now report: ddev-environment apple-container (was: darwin) docker-platform apple-container (was: linux-docker) Every other provider (OrbStack, Colima, Podman, ...) and Docker being unreachable were retested and are unaffected. Also folds in an audit of every RunSimpleContainer call site for other double-mounts of the database volume: none exist beyond the two already fixed in the prior commit, and RestoreSnapshot always removes the db container before touching its volume, so it was never at risk. Corrected HANDOFF.md, which had speculatively listed it as untested. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> docs: record restart/db-recreate finding and full rebuild recipe, for ddev#7372 [skip ci] Two things from today's session. First, investigated why `ddev restart` recreates the db/web containers every time on apple container: it isn't a bug. `Restart()` is `Stop()`+`Start()`, and `Stop()` always removes the containers first, so compose has nothing to compare a config hash against on the way back up — the same thing happens on every provider, apple container is just slower at it (likely the volume block-attach cost from blocker 1). Second, tore down and rebuilt the entire apple-container/socktainer stack from nothing (system, socktainer binary, docker context) to confirm it's reproducible, and documented the exact recipe. That rebuild also surfaced and fixed a real socktainer bug: ApiVersion/MinAPIVersion carried a stray "v" prefix that silently failed DDEV's own minimum- Docker-version check regardless of the actual version number. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> docs: reorganize HANDOFF.md by DDEV priority and fix stale branch/PR status, for ddev#7372 [skip ci] Split the numbered "Blockers" list into open vs. fixed, ordered by actual impact on DDEV instead of numeric IDs. Added a fix-branches table near the top, linked to every referenced branch/issue/PR. Corrected stale status (PR ddev#347 and issue ddev#346 are closed, not open) and split out the still-open DNS wrong-network-address bug from the already-fixed AAAA/EDNS0 bug it had been bundled with. Re-ranked the table by DDEV impact rather than the fork's diff-risk-based submission order, and surfaced the still-unbranched exec-upgrade/attachStdin fix, which is the actual cause of the `ddev start` hang. docs: correct HANDOFF.md, the exec-upgrade/attachStdin fix already exists, for ddev#7372 [skip ci] The previous commit added a table row proposing a new branch/issue for "socktainer only upgrades exec connection when stdin is attached." Checking the socktainer fork before filing anything found the fix already exists: fix/exec-hijack-close was rewritten on 2026-08-05 (commit 53cc0f3, local only, not pushed) to fix the attachStdin gating and the EOF-close bug together, superseding the closed PR ddev#347 for both. Move that branch back into the top DDEV-start-blocking tier and correct the prose sections that still described it as a real-but-non-blocking bug.
rfay
added a commit
to rfay/ddev
that referenced
this pull request
Oct 11, 2026
…t, for ddev#7372 [skip ci] - For ddev#7372 Apple Container (via socktainer) cannot run DDEV as-is. The dominant blocker is that Apple Container backs each named volume with an ext4 block image that can only be attached to one running VM at a time, so `ddev-global-cache` — mounted simultaneously by web, db, router and every helper container — fails with `VZErrorDomain Code=2 "The storage device attachment is invalid."`. It does not solve it; it establishes how far DDEV can get and what is left. With these changes plus the host-side workarounds documented in HANDOFF.md, `ddev start` brings web, db and ddev-router to healthy (10.5s each) and traefik routes correctly from the host. Remaining blockers are upstream, and the two that still stop a page from being served are catalogued in HANDOFF.md. All code changes are gated behind `DDEV_BIND_GLOBAL_CACHE=true`. With the variable unset, rendering and behavior are unchanged; the compose templates emit exactly what they did before. - `pkg/globalconfig/global_config.go`: `UseBindGlobalCache()`, `GlobalCacheSource()`, `GlobalCacheMount()`. In bind mode the global cache is a host directory (`~/.ddev/global-cache-bind`) rather than a Docker volume, because virtiofs bind mounts can be shared between running containers. - `pkg/ddevapp/ddevapp.go`: use the helper for every `/mnt/ddev-global-cache` mount; skip volume creation and create the host directory instead; add `copyIntoGlobalCache()`, which copies on the host in bind mode. Copying a directory into a container is unsupported by socktainer and hangs when driven through the API. - `pkg/ddevapp/commands.go`, `pkg/ddevapp/traefik.go`: route their copies through `copyIntoGlobalCache()`. - `pkg/ddevapp/app_compose_template.yaml`, `pkg/ddevapp/router_compose_template.yaml`, `config.go`, `router.go`: add `GlobalCacheMount` / `BindGlobalCache` template vars, omit the `volumes:` block when it would render empty, and place project services on `ddev_default` only, since Apple Container gives a container one NIC and `docker network connect` is a no-op. HANDOFF.md records the full analysis: eleven upstream blockers with reproductions, the host-side workarounds needed (gateway DNS, buildkit node), and six design options for replacing the shared-volume pattern. Three of those options are provider-independent improvements worth doing on their own. Requires macOS with Apple `container` 1.2.0 and `socktainer` 1.2.1, plus the host-side setup in HANDOFF.md (gateway dnsmasq and a hand-created buildkit node — buildx cannot bootstrap one under socktainer). ```bash docker context use socktainer mkdir ~/tmp/appletest && cd ~/tmp/appletest && echo '<?php phpinfo();' > index.php ddev config --project-type=php --docroot=. --project-name=appletest DDEV_BIND_GLOBAL_CACHE=true ddev start ``` To confirm nothing changed for normal providers, run `ddev debug compose-config` with the variable unset and verify the `ddev-global-cache` volume and both networks are still present. No new tests. This is exploratory work behind an environment variable that is off by default, and the paths it touches need an Apple Container host to exercise. `make staticrequired` is clean and `go test -short ./pkg/globalconfig/...` passes. Not for release. `DDEV_BIND_GLOBAL_CACHE` is undocumented and unsupported, and HANDOFF.md should be deleted before any of this merges to main. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> docs: refine shared-volume options with attach-rule testing, for ddev#7372 [skip ci] Testing showed the volume restriction is narrower than first documented. A volume is either attached read-write by exactly one container, or read-only by any number of them (verified with three simultaneous `:ro` attachers). Consequences, all verified rather than reasoned: - A long-lived writer container with `:ro` readers alongside it does NOT work; the exclusivity is on the block device, so a writer blocks every other attach, `:ro` included. Recorded so the pattern is not retried. - A *transient* writer does work: seed the volume read-write, exit, then let the project containers mount it `:ro`. Re-seeding requires every reader to be down, which is what `ddev start` / `ddev restart` already does. - Content written continuously by a running container (npm/Composer caches, n_prefix, corepack, shell history) cannot live in the read-only volume, and ddev-webserver's start.sh would need to stop running mkdir/chown under /mnt/ddev-global-cache/. - The owning-container idea still works if it serves the cache over HTTP instead of the filesystem, which covers downloads but not install prefixes. Adds design options 7 and 8 and marks 7 as the most promising direction, since unlike the bind-mount approach implemented behind DDEV_BIND_GLOBAL_CACHE it does not trade away volume performance. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> docs: add privileged-port blocker and cold-start recipe, for ddev#7372 [skip ci] Two failures found while reproducing a start that broke early. Ports below 1024 cannot be published at all: Apple Container's port forwarder runs unprivileged and rejects them with "Binding to ports below 1024 requires root privileges". This is DDEV's default configuration, and it had been masked until now by another router holding 80/443, which made DDEV fall back to ephemeral high ports. Workaround is router_http_port/router_https_port above 1024; a real Apple Container mode needs non-privileged defaults or no port publishing at all. The buildkit node must be recreated, never restarted. Once it exits, buildx restarts it and every build fails with `rbind ... operation not permitted`; `docker rm -f` plus an identical `docker run` fixes it immediately. Capabilities are not the explanation, since they survive a restart, so the cause is unidentified. Since the node exits whenever `container system` restarts, this is the most likely thing to bite when picking the work back up. Adds a cold-start recipe with the required ordering, because the environment does not survive idling: the default network's host bridge is torn down once nothing runs on it, which kills DNS and prevents dnsmasq from rebinding. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> feat(apple-container): auto-detect socktainer, add port and buildkit findings, for ddev#7372 [skip ci] Bind mode was gated behind DDEV_BIND_GLOBAL_CACHE, which is easy to forget: a `ddev start` in a terminal without it uses the volume path and fails in confusing ways. It now turns on automatically when the provider is socktainer. - `pkg/dockerutil/providers.go`: add `IsSocktainer()`, matching `Server.Platform.Name` in the same shape as the existing `IsPodman()`. Move `UseBindGlobalCache()`, `GlobalCacheSource()` and `GlobalCacheMount()` here from `globalconfig`, since detection needs a Docker call and `dockerutil` already imports `globalconfig` rather than the reverse. - `DDEV_BIND_GLOBAL_CACHE=true`/`=false` still forces the behavior either way for testing on other providers. When unset and the provider is not socktainer — including when the provider cannot be reached — detection returns false and rendering is byte-identical to before. Verified by rendering `ddev debug compose-config` both ways. Two failures found while reproducing a start that broke early: - Ports below 1024 cannot be published: Apple Container's forwarder runs unprivileged and rejects them. This is not a new class of problem for DDEV — rootless Podman is already a supported provider with the same restriction and the docs already tell users to configure unprivileged ports. The macOS wrinkle is that there is no `net.ipv4.ip_unprivileged_port_start` escape hatch, so it is mandatory rather than recommended. It had been masked until now by another router holding 80/443, which made DDEV fall back to ephemeral high ports. - The buildkit node must be recreated, never restarted. Once it exits, buildx restarts it and every build fails with `rbind ... operation not permitted`; `docker rm -f` plus an identical `docker run` fixes it. Capabilities are not the explanation, since they survive a restart, so the cause is unidentified. Also adds a cold-start recipe with the required ordering, because the environment does not survive idling: the default network's host bridge is torn down once nothing runs on it, which kills DNS and prevents dnsmasq rebinding. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> docs: say "global-cache bind mount", not "bind mode", for ddev#7372 [skip ci] "Bind mount" on its own is ambiguous in DDEV, where no_bind_mounts already refers to something else entirely: whether the project directory is mounted into the containers. This work bind-mounts only the global cache, so the prose and comments now say so explicitly rather than talking about "bind mode". No behavior change. Also corrects the header, which still described the changes as gated behind an environment variable after they were switched to socktainer auto-detection. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> docs: track upstream socktainer issue/PR status in HANDOFF.md, for ddev#7372 [skip ci] Cross-reference each blocker with its fix's current status (filed, PR open, fix ready but not yet submitted, or investigated-but-not-reproducible), and point to the rfay/socktainer fork's UPSTREAM_ROLLOUT.md for the full ranked plan, so status lives in the branch instead of only in PR comments. feat(apple-container): force Mutagen off on socktainer, for ddev#7372 [skip ci] Mutagen mounts project_mutagen at both /var/www and /tmp/project_mutagen in the web container. On Apple Container that is two attachments of one block-backed volume within a single container, which no configuration can satisfy, so the container never boots: VZErrorDomain Code=2 "The storage device attachment is invalid." Rather than leave every project to discover this, GetPerformanceMode() returns "none" when the provider is socktainer, with a WarningOnce naming the reason. Projects that already resolve to "none" are unaffected and silent. no_bind_mounts normally forces Mutagen on as the only way to get code into the container. It cannot work here either, so it is not honored and gets its own warning instead of failing the same way. Behavior on every other provider is unchanged: IsSocktainer() returns false and both paths keep their previous values. Verified against a project whose only relevant setting was the global performance_mode: mutagen default. The warning appears once per command, the web container gets "bind <project> -> /var/www/html", and no project_mutagen volume is mounted. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> feat(apple-container): stop re-mounting the db volume while its container runs, for ddev#7372 [skip ci] Two DDEV code paths mount the database volume into a throwaway container while the project's own db container already has it. On apple container a volume takes either one writer or any number of readers, never a mix, so the second attachment aborts the helper's boot: VZErrorDomain Code=2 "The storage device attachment is invalid." - getDBVersionFromVolume() ran a GetExistingDBType-* container for this, and util.Failed() made the error fatal, so `ddev start` and `ddev config` both died for any project whose db was running. It now reads the version file with dockerutil.Exec into that running container, which starts no container at all and is cheaper on every provider. - the start-chown-* container mounted the volume to fix ownership. Skipped when the db container is up, since ownership was set on an earlier start. Behavior elsewhere is unchanged: with no running db container both paths do exactly what they did before. Verified with two projects running at once on apple container, which was previously impossible, both serving 200 with no per-project workaround files. `ddev restart` works repeatably (~27s). `ddev start` over an already-running project still fails on apple container's global hostname uniqueness, which is upstream of socktainer and unrelated to these paths. HANDOFF.md records the four socktainer-side findings from the same session (start_period slept rather than probed, HostConfig.PortBindings nil, health probes forced to root, hostname uniqueness) and retires blocker 5 plus the healthcheck and chown workarounds, which are now harmful rather than helpful. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> feat(apple-container): add IsAppleContainer() and report it as its own environment, for ddev#7372 [skip ci] DDEV had no vocabulary for "the runtime is apple container" distinct from "the API in front of it is socktainer" — every check went through IsSocktainer(), and `ddev version` reported ddev-environment=darwin and docker-platform=linux-docker, indistinguishable from any other Docker provider on macOS even though apple container's constraints (single-writer volumes, virtiofs bind mounts, global hostname uniqueness) are unlike any of them. Adds dockerutil.IsAppleContainer(), currently detected through IsSocktainer() since socktainer is the only Docker-compatible API in front of apple container today; the two questions are kept separate since that may not stay true. All apple-container-specific call sites (UseBindGlobalCache, the two Mutagen warnings, GetDockerPlatform, activeDockerProvider, the addon virtiofs-propagation sleep) now go through it instead of IsSocktainer() directly. `ddev version` and `ddev debug port` now report: ddev-environment apple-container (was: darwin) docker-platform apple-container (was: linux-docker) Every other provider (OrbStack, Colima, Podman, ...) and Docker being unreachable were retested and are unaffected. Also folds in an audit of every RunSimpleContainer call site for other double-mounts of the database volume: none exist beyond the two already fixed in the prior commit, and RestoreSnapshot always removes the db container before touching its volume, so it was never at risk. Corrected HANDOFF.md, which had speculatively listed it as untested. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> docs: record restart/db-recreate finding and full rebuild recipe, for ddev#7372 [skip ci] Two things from today's session. First, investigated why `ddev restart` recreates the db/web containers every time on apple container: it isn't a bug. `Restart()` is `Stop()`+`Start()`, and `Stop()` always removes the containers first, so compose has nothing to compare a config hash against on the way back up — the same thing happens on every provider, apple container is just slower at it (likely the volume block-attach cost from blocker 1). Second, tore down and rebuilt the entire apple-container/socktainer stack from nothing (system, socktainer binary, docker context) to confirm it's reproducible, and documented the exact recipe. That rebuild also surfaced and fixed a real socktainer bug: ApiVersion/MinAPIVersion carried a stray "v" prefix that silently failed DDEV's own minimum- Docker-version check regardless of the actual version number. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> docs: reorganize HANDOFF.md by DDEV priority and fix stale branch/PR status, for ddev#7372 [skip ci] Split the numbered "Blockers" list into open vs. fixed, ordered by actual impact on DDEV instead of numeric IDs. Added a fix-branches table near the top, linked to every referenced branch/issue/PR. Corrected stale status (PR ddev#347 and issue ddev#346 are closed, not open) and split out the still-open DNS wrong-network-address bug from the already-fixed AAAA/EDNS0 bug it had been bundled with. Re-ranked the table by DDEV impact rather than the fork's diff-risk-based submission order, and surfaced the still-unbranched exec-upgrade/attachStdin fix, which is the actual cause of the `ddev start` hang. docs: correct HANDOFF.md, the exec-upgrade/attachStdin fix already exists, for ddev#7372 [skip ci] The previous commit added a table row proposing a new branch/issue for "socktainer only upgrades exec connection when stdin is attached." Checking the socktainer fork before filing anything found the fix already exists: fix/exec-hijack-close was rewritten on 2026-08-05 (commit 53cc0f3, local only, not pushed) to fix the attachStdin gating and the EOF-close bug together, superseding the closed PR ddev#347 for both. Move that branch back into the top DDEV-start-blocking tier and correct the prose sections that still described it as a real-but-non-blocking bug.
rfay
added a commit
to rfay/ddev
that referenced
this pull request
Oct 12, 2026
…t, for ddev#7372 [skip ci] - For ddev#7372 Apple Container (via socktainer) cannot run DDEV as-is. The dominant blocker is that Apple Container backs each named volume with an ext4 block image that can only be attached to one running VM at a time, so `ddev-global-cache` — mounted simultaneously by web, db, router and every helper container — fails with `VZErrorDomain Code=2 "The storage device attachment is invalid."`. It does not solve it; it establishes how far DDEV can get and what is left. With these changes plus the host-side workarounds documented in HANDOFF.md, `ddev start` brings web, db and ddev-router to healthy (10.5s each) and traefik routes correctly from the host. Remaining blockers are upstream, and the two that still stop a page from being served are catalogued in HANDOFF.md. All code changes are gated behind `DDEV_BIND_GLOBAL_CACHE=true`. With the variable unset, rendering and behavior are unchanged; the compose templates emit exactly what they did before. - `pkg/globalconfig/global_config.go`: `UseBindGlobalCache()`, `GlobalCacheSource()`, `GlobalCacheMount()`. In bind mode the global cache is a host directory (`~/.ddev/global-cache-bind`) rather than a Docker volume, because virtiofs bind mounts can be shared between running containers. - `pkg/ddevapp/ddevapp.go`: use the helper for every `/mnt/ddev-global-cache` mount; skip volume creation and create the host directory instead; add `copyIntoGlobalCache()`, which copies on the host in bind mode. Copying a directory into a container is unsupported by socktainer and hangs when driven through the API. - `pkg/ddevapp/commands.go`, `pkg/ddevapp/traefik.go`: route their copies through `copyIntoGlobalCache()`. - `pkg/ddevapp/app_compose_template.yaml`, `pkg/ddevapp/router_compose_template.yaml`, `config.go`, `router.go`: add `GlobalCacheMount` / `BindGlobalCache` template vars, omit the `volumes:` block when it would render empty, and place project services on `ddev_default` only, since Apple Container gives a container one NIC and `docker network connect` is a no-op. HANDOFF.md records the full analysis: eleven upstream blockers with reproductions, the host-side workarounds needed (gateway DNS, buildkit node), and six design options for replacing the shared-volume pattern. Three of those options are provider-independent improvements worth doing on their own. Requires macOS with Apple `container` 1.2.0 and `socktainer` 1.2.1, plus the host-side setup in HANDOFF.md (gateway dnsmasq and a hand-created buildkit node — buildx cannot bootstrap one under socktainer). ```bash docker context use socktainer mkdir ~/tmp/appletest && cd ~/tmp/appletest && echo '<?php phpinfo();' > index.php ddev config --project-type=php --docroot=. --project-name=appletest DDEV_BIND_GLOBAL_CACHE=true ddev start ``` To confirm nothing changed for normal providers, run `ddev debug compose-config` with the variable unset and verify the `ddev-global-cache` volume and both networks are still present. No new tests. This is exploratory work behind an environment variable that is off by default, and the paths it touches need an Apple Container host to exercise. `make staticrequired` is clean and `go test -short ./pkg/globalconfig/...` passes. Not for release. `DDEV_BIND_GLOBAL_CACHE` is undocumented and unsupported, and HANDOFF.md should be deleted before any of this merges to main. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> docs: refine shared-volume options with attach-rule testing, for ddev#7372 [skip ci] Testing showed the volume restriction is narrower than first documented. A volume is either attached read-write by exactly one container, or read-only by any number of them (verified with three simultaneous `:ro` attachers). Consequences, all verified rather than reasoned: - A long-lived writer container with `:ro` readers alongside it does NOT work; the exclusivity is on the block device, so a writer blocks every other attach, `:ro` included. Recorded so the pattern is not retried. - A *transient* writer does work: seed the volume read-write, exit, then let the project containers mount it `:ro`. Re-seeding requires every reader to be down, which is what `ddev start` / `ddev restart` already does. - Content written continuously by a running container (npm/Composer caches, n_prefix, corepack, shell history) cannot live in the read-only volume, and ddev-webserver's start.sh would need to stop running mkdir/chown under /mnt/ddev-global-cache/. - The owning-container idea still works if it serves the cache over HTTP instead of the filesystem, which covers downloads but not install prefixes. Adds design options 7 and 8 and marks 7 as the most promising direction, since unlike the bind-mount approach implemented behind DDEV_BIND_GLOBAL_CACHE it does not trade away volume performance. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> docs: add privileged-port blocker and cold-start recipe, for ddev#7372 [skip ci] Two failures found while reproducing a start that broke early. Ports below 1024 cannot be published at all: Apple Container's port forwarder runs unprivileged and rejects them with "Binding to ports below 1024 requires root privileges". This is DDEV's default configuration, and it had been masked until now by another router holding 80/443, which made DDEV fall back to ephemeral high ports. Workaround is router_http_port/router_https_port above 1024; a real Apple Container mode needs non-privileged defaults or no port publishing at all. The buildkit node must be recreated, never restarted. Once it exits, buildx restarts it and every build fails with `rbind ... operation not permitted`; `docker rm -f` plus an identical `docker run` fixes it immediately. Capabilities are not the explanation, since they survive a restart, so the cause is unidentified. Since the node exits whenever `container system` restarts, this is the most likely thing to bite when picking the work back up. Adds a cold-start recipe with the required ordering, because the environment does not survive idling: the default network's host bridge is torn down once nothing runs on it, which kills DNS and prevents dnsmasq from rebinding. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> feat(apple-container): auto-detect socktainer, add port and buildkit findings, for ddev#7372 [skip ci] Bind mode was gated behind DDEV_BIND_GLOBAL_CACHE, which is easy to forget: a `ddev start` in a terminal without it uses the volume path and fails in confusing ways. It now turns on automatically when the provider is socktainer. - `pkg/dockerutil/providers.go`: add `IsSocktainer()`, matching `Server.Platform.Name` in the same shape as the existing `IsPodman()`. Move `UseBindGlobalCache()`, `GlobalCacheSource()` and `GlobalCacheMount()` here from `globalconfig`, since detection needs a Docker call and `dockerutil` already imports `globalconfig` rather than the reverse. - `DDEV_BIND_GLOBAL_CACHE=true`/`=false` still forces the behavior either way for testing on other providers. When unset and the provider is not socktainer — including when the provider cannot be reached — detection returns false and rendering is byte-identical to before. Verified by rendering `ddev debug compose-config` both ways. Two failures found while reproducing a start that broke early: - Ports below 1024 cannot be published: Apple Container's forwarder runs unprivileged and rejects them. This is not a new class of problem for DDEV — rootless Podman is already a supported provider with the same restriction and the docs already tell users to configure unprivileged ports. The macOS wrinkle is that there is no `net.ipv4.ip_unprivileged_port_start` escape hatch, so it is mandatory rather than recommended. It had been masked until now by another router holding 80/443, which made DDEV fall back to ephemeral high ports. - The buildkit node must be recreated, never restarted. Once it exits, buildx restarts it and every build fails with `rbind ... operation not permitted`; `docker rm -f` plus an identical `docker run` fixes it. Capabilities are not the explanation, since they survive a restart, so the cause is unidentified. Also adds a cold-start recipe with the required ordering, because the environment does not survive idling: the default network's host bridge is torn down once nothing runs on it, which kills DNS and prevents dnsmasq rebinding. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> docs: say "global-cache bind mount", not "bind mode", for ddev#7372 [skip ci] "Bind mount" on its own is ambiguous in DDEV, where no_bind_mounts already refers to something else entirely: whether the project directory is mounted into the containers. This work bind-mounts only the global cache, so the prose and comments now say so explicitly rather than talking about "bind mode". No behavior change. Also corrects the header, which still described the changes as gated behind an environment variable after they were switched to socktainer auto-detection. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> docs: track upstream socktainer issue/PR status in HANDOFF.md, for ddev#7372 [skip ci] Cross-reference each blocker with its fix's current status (filed, PR open, fix ready but not yet submitted, or investigated-but-not-reproducible), and point to the rfay/socktainer fork's UPSTREAM_ROLLOUT.md for the full ranked plan, so status lives in the branch instead of only in PR comments. feat(apple-container): force Mutagen off on socktainer, for ddev#7372 [skip ci] Mutagen mounts project_mutagen at both /var/www and /tmp/project_mutagen in the web container. On Apple Container that is two attachments of one block-backed volume within a single container, which no configuration can satisfy, so the container never boots: VZErrorDomain Code=2 "The storage device attachment is invalid." Rather than leave every project to discover this, GetPerformanceMode() returns "none" when the provider is socktainer, with a WarningOnce naming the reason. Projects that already resolve to "none" are unaffected and silent. no_bind_mounts normally forces Mutagen on as the only way to get code into the container. It cannot work here either, so it is not honored and gets its own warning instead of failing the same way. Behavior on every other provider is unchanged: IsSocktainer() returns false and both paths keep their previous values. Verified against a project whose only relevant setting was the global performance_mode: mutagen default. The warning appears once per command, the web container gets "bind <project> -> /var/www/html", and no project_mutagen volume is mounted. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> feat(apple-container): stop re-mounting the db volume while its container runs, for ddev#7372 [skip ci] Two DDEV code paths mount the database volume into a throwaway container while the project's own db container already has it. On apple container a volume takes either one writer or any number of readers, never a mix, so the second attachment aborts the helper's boot: VZErrorDomain Code=2 "The storage device attachment is invalid." - getDBVersionFromVolume() ran a GetExistingDBType-* container for this, and util.Failed() made the error fatal, so `ddev start` and `ddev config` both died for any project whose db was running. It now reads the version file with dockerutil.Exec into that running container, which starts no container at all and is cheaper on every provider. - the start-chown-* container mounted the volume to fix ownership. Skipped when the db container is up, since ownership was set on an earlier start. Behavior elsewhere is unchanged: with no running db container both paths do exactly what they did before. Verified with two projects running at once on apple container, which was previously impossible, both serving 200 with no per-project workaround files. `ddev restart` works repeatably (~27s). `ddev start` over an already-running project still fails on apple container's global hostname uniqueness, which is upstream of socktainer and unrelated to these paths. HANDOFF.md records the four socktainer-side findings from the same session (start_period slept rather than probed, HostConfig.PortBindings nil, health probes forced to root, hostname uniqueness) and retires blocker 5 plus the healthcheck and chown workarounds, which are now harmful rather than helpful. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> feat(apple-container): add IsAppleContainer() and report it as its own environment, for ddev#7372 [skip ci] DDEV had no vocabulary for "the runtime is apple container" distinct from "the API in front of it is socktainer" — every check went through IsSocktainer(), and `ddev version` reported ddev-environment=darwin and docker-platform=linux-docker, indistinguishable from any other Docker provider on macOS even though apple container's constraints (single-writer volumes, virtiofs bind mounts, global hostname uniqueness) are unlike any of them. Adds dockerutil.IsAppleContainer(), currently detected through IsSocktainer() since socktainer is the only Docker-compatible API in front of apple container today; the two questions are kept separate since that may not stay true. All apple-container-specific call sites (UseBindGlobalCache, the two Mutagen warnings, GetDockerPlatform, activeDockerProvider, the addon virtiofs-propagation sleep) now go through it instead of IsSocktainer() directly. `ddev version` and `ddev debug port` now report: ddev-environment apple-container (was: darwin) docker-platform apple-container (was: linux-docker) Every other provider (OrbStack, Colima, Podman, ...) and Docker being unreachable were retested and are unaffected. Also folds in an audit of every RunSimpleContainer call site for other double-mounts of the database volume: none exist beyond the two already fixed in the prior commit, and RestoreSnapshot always removes the db container before touching its volume, so it was never at risk. Corrected HANDOFF.md, which had speculatively listed it as untested. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> docs: record restart/db-recreate finding and full rebuild recipe, for ddev#7372 [skip ci] Two things from today's session. First, investigated why `ddev restart` recreates the db/web containers every time on apple container: it isn't a bug. `Restart()` is `Stop()`+`Start()`, and `Stop()` always removes the containers first, so compose has nothing to compare a config hash against on the way back up — the same thing happens on every provider, apple container is just slower at it (likely the volume block-attach cost from blocker 1). Second, tore down and rebuilt the entire apple-container/socktainer stack from nothing (system, socktainer binary, docker context) to confirm it's reproducible, and documented the exact recipe. That rebuild also surfaced and fixed a real socktainer bug: ApiVersion/MinAPIVersion carried a stray "v" prefix that silently failed DDEV's own minimum- Docker-version check regardless of the actual version number. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> docs: reorganize HANDOFF.md by DDEV priority and fix stale branch/PR status, for ddev#7372 [skip ci] Split the numbered "Blockers" list into open vs. fixed, ordered by actual impact on DDEV instead of numeric IDs. Added a fix-branches table near the top, linked to every referenced branch/issue/PR. Corrected stale status (PR ddev#347 and issue ddev#346 are closed, not open) and split out the still-open DNS wrong-network-address bug from the already-fixed AAAA/EDNS0 bug it had been bundled with. Re-ranked the table by DDEV impact rather than the fork's diff-risk-based submission order, and surfaced the still-unbranched exec-upgrade/attachStdin fix, which is the actual cause of the `ddev start` hang. docs: correct HANDOFF.md, the exec-upgrade/attachStdin fix already exists, for ddev#7372 [skip ci] The previous commit added a table row proposing a new branch/issue for "socktainer only upgrades exec connection when stdin is attached." Checking the socktainer fork before filing anything found the fix already exists: fix/exec-hijack-close was rewritten on 2026-08-05 (commit 53cc0f3, local only, not pushed) to fix the attachStdin gating and the EOF-close bug together, superseding the closed PR ddev#347 for both. Move that branch back into the top DDEV-start-blocking tier and correct the prose sections that still described it as a real-but-non-blocking bug.
rfay
added a commit
to rfay/ddev
that referenced
this pull request
Oct 20, 2026
…t, for ddev#7372 [skip ci] - For ddev#7372 Apple Container (via socktainer) cannot run DDEV as-is. The dominant blocker is that Apple Container backs each named volume with an ext4 block image that can only be attached to one running VM at a time, so `ddev-global-cache` — mounted simultaneously by web, db, router and every helper container — fails with `VZErrorDomain Code=2 "The storage device attachment is invalid."`. It does not solve it; it establishes how far DDEV can get and what is left. With these changes plus the host-side workarounds documented in HANDOFF.md, `ddev start` brings web, db and ddev-router to healthy (10.5s each) and traefik routes correctly from the host. Remaining blockers are upstream, and the two that still stop a page from being served are catalogued in HANDOFF.md. All code changes are gated behind `DDEV_BIND_GLOBAL_CACHE=true`. With the variable unset, rendering and behavior are unchanged; the compose templates emit exactly what they did before. - `pkg/globalconfig/global_config.go`: `UseBindGlobalCache()`, `GlobalCacheSource()`, `GlobalCacheMount()`. In bind mode the global cache is a host directory (`~/.ddev/global-cache-bind`) rather than a Docker volume, because virtiofs bind mounts can be shared between running containers. - `pkg/ddevapp/ddevapp.go`: use the helper for every `/mnt/ddev-global-cache` mount; skip volume creation and create the host directory instead; add `copyIntoGlobalCache()`, which copies on the host in bind mode. Copying a directory into a container is unsupported by socktainer and hangs when driven through the API. - `pkg/ddevapp/commands.go`, `pkg/ddevapp/traefik.go`: route their copies through `copyIntoGlobalCache()`. - `pkg/ddevapp/app_compose_template.yaml`, `pkg/ddevapp/router_compose_template.yaml`, `config.go`, `router.go`: add `GlobalCacheMount` / `BindGlobalCache` template vars, omit the `volumes:` block when it would render empty, and place project services on `ddev_default` only, since Apple Container gives a container one NIC and `docker network connect` is a no-op. HANDOFF.md records the full analysis: eleven upstream blockers with reproductions, the host-side workarounds needed (gateway DNS, buildkit node), and six design options for replacing the shared-volume pattern. Three of those options are provider-independent improvements worth doing on their own. Requires macOS with Apple `container` 1.2.0 and `socktainer` 1.2.1, plus the host-side setup in HANDOFF.md (gateway dnsmasq and a hand-created buildkit node — buildx cannot bootstrap one under socktainer). ```bash docker context use socktainer mkdir ~/tmp/appletest && cd ~/tmp/appletest && echo '<?php phpinfo();' > index.php ddev config --project-type=php --docroot=. --project-name=appletest DDEV_BIND_GLOBAL_CACHE=true ddev start ``` To confirm nothing changed for normal providers, run `ddev debug compose-config` with the variable unset and verify the `ddev-global-cache` volume and both networks are still present. No new tests. This is exploratory work behind an environment variable that is off by default, and the paths it touches need an Apple Container host to exercise. `make staticrequired` is clean and `go test -short ./pkg/globalconfig/...` passes. Not for release. `DDEV_BIND_GLOBAL_CACHE` is undocumented and unsupported, and HANDOFF.md should be deleted before any of this merges to main. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> docs: refine shared-volume options with attach-rule testing, for ddev#7372 [skip ci] Testing showed the volume restriction is narrower than first documented. A volume is either attached read-write by exactly one container, or read-only by any number of them (verified with three simultaneous `:ro` attachers). Consequences, all verified rather than reasoned: - A long-lived writer container with `:ro` readers alongside it does NOT work; the exclusivity is on the block device, so a writer blocks every other attach, `:ro` included. Recorded so the pattern is not retried. - A *transient* writer does work: seed the volume read-write, exit, then let the project containers mount it `:ro`. Re-seeding requires every reader to be down, which is what `ddev start` / `ddev restart` already does. - Content written continuously by a running container (npm/Composer caches, n_prefix, corepack, shell history) cannot live in the read-only volume, and ddev-webserver's start.sh would need to stop running mkdir/chown under /mnt/ddev-global-cache/. - The owning-container idea still works if it serves the cache over HTTP instead of the filesystem, which covers downloads but not install prefixes. Adds design options 7 and 8 and marks 7 as the most promising direction, since unlike the bind-mount approach implemented behind DDEV_BIND_GLOBAL_CACHE it does not trade away volume performance. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> docs: add privileged-port blocker and cold-start recipe, for ddev#7372 [skip ci] Two failures found while reproducing a start that broke early. Ports below 1024 cannot be published at all: Apple Container's port forwarder runs unprivileged and rejects them with "Binding to ports below 1024 requires root privileges". This is DDEV's default configuration, and it had been masked until now by another router holding 80/443, which made DDEV fall back to ephemeral high ports. Workaround is router_http_port/router_https_port above 1024; a real Apple Container mode needs non-privileged defaults or no port publishing at all. The buildkit node must be recreated, never restarted. Once it exits, buildx restarts it and every build fails with `rbind ... operation not permitted`; `docker rm -f` plus an identical `docker run` fixes it immediately. Capabilities are not the explanation, since they survive a restart, so the cause is unidentified. Since the node exits whenever `container system` restarts, this is the most likely thing to bite when picking the work back up. Adds a cold-start recipe with the required ordering, because the environment does not survive idling: the default network's host bridge is torn down once nothing runs on it, which kills DNS and prevents dnsmasq from rebinding. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> feat(apple-container): auto-detect socktainer, add port and buildkit findings, for ddev#7372 [skip ci] Bind mode was gated behind DDEV_BIND_GLOBAL_CACHE, which is easy to forget: a `ddev start` in a terminal without it uses the volume path and fails in confusing ways. It now turns on automatically when the provider is socktainer. - `pkg/dockerutil/providers.go`: add `IsSocktainer()`, matching `Server.Platform.Name` in the same shape as the existing `IsPodman()`. Move `UseBindGlobalCache()`, `GlobalCacheSource()` and `GlobalCacheMount()` here from `globalconfig`, since detection needs a Docker call and `dockerutil` already imports `globalconfig` rather than the reverse. - `DDEV_BIND_GLOBAL_CACHE=true`/`=false` still forces the behavior either way for testing on other providers. When unset and the provider is not socktainer — including when the provider cannot be reached — detection returns false and rendering is byte-identical to before. Verified by rendering `ddev debug compose-config` both ways. Two failures found while reproducing a start that broke early: - Ports below 1024 cannot be published: Apple Container's forwarder runs unprivileged and rejects them. This is not a new class of problem for DDEV — rootless Podman is already a supported provider with the same restriction and the docs already tell users to configure unprivileged ports. The macOS wrinkle is that there is no `net.ipv4.ip_unprivileged_port_start` escape hatch, so it is mandatory rather than recommended. It had been masked until now by another router holding 80/443, which made DDEV fall back to ephemeral high ports. - The buildkit node must be recreated, never restarted. Once it exits, buildx restarts it and every build fails with `rbind ... operation not permitted`; `docker rm -f` plus an identical `docker run` fixes it. Capabilities are not the explanation, since they survive a restart, so the cause is unidentified. Also adds a cold-start recipe with the required ordering, because the environment does not survive idling: the default network's host bridge is torn down once nothing runs on it, which kills DNS and prevents dnsmasq rebinding. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> docs: say "global-cache bind mount", not "bind mode", for ddev#7372 [skip ci] "Bind mount" on its own is ambiguous in DDEV, where no_bind_mounts already refers to something else entirely: whether the project directory is mounted into the containers. This work bind-mounts only the global cache, so the prose and comments now say so explicitly rather than talking about "bind mode". No behavior change. Also corrects the header, which still described the changes as gated behind an environment variable after they were switched to socktainer auto-detection. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> docs: track upstream socktainer issue/PR status in HANDOFF.md, for ddev#7372 [skip ci] Cross-reference each blocker with its fix's current status (filed, PR open, fix ready but not yet submitted, or investigated-but-not-reproducible), and point to the rfay/socktainer fork's UPSTREAM_ROLLOUT.md for the full ranked plan, so status lives in the branch instead of only in PR comments. feat(apple-container): force Mutagen off on socktainer, for ddev#7372 [skip ci] Mutagen mounts project_mutagen at both /var/www and /tmp/project_mutagen in the web container. On Apple Container that is two attachments of one block-backed volume within a single container, which no configuration can satisfy, so the container never boots: VZErrorDomain Code=2 "The storage device attachment is invalid." Rather than leave every project to discover this, GetPerformanceMode() returns "none" when the provider is socktainer, with a WarningOnce naming the reason. Projects that already resolve to "none" are unaffected and silent. no_bind_mounts normally forces Mutagen on as the only way to get code into the container. It cannot work here either, so it is not honored and gets its own warning instead of failing the same way. Behavior on every other provider is unchanged: IsSocktainer() returns false and both paths keep their previous values. Verified against a project whose only relevant setting was the global performance_mode: mutagen default. The warning appears once per command, the web container gets "bind <project> -> /var/www/html", and no project_mutagen volume is mounted. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> feat(apple-container): stop re-mounting the db volume while its container runs, for ddev#7372 [skip ci] Two DDEV code paths mount the database volume into a throwaway container while the project's own db container already has it. On apple container a volume takes either one writer or any number of readers, never a mix, so the second attachment aborts the helper's boot: VZErrorDomain Code=2 "The storage device attachment is invalid." - getDBVersionFromVolume() ran a GetExistingDBType-* container for this, and util.Failed() made the error fatal, so `ddev start` and `ddev config` both died for any project whose db was running. It now reads the version file with dockerutil.Exec into that running container, which starts no container at all and is cheaper on every provider. - the start-chown-* container mounted the volume to fix ownership. Skipped when the db container is up, since ownership was set on an earlier start. Behavior elsewhere is unchanged: with no running db container both paths do exactly what they did before. Verified with two projects running at once on apple container, which was previously impossible, both serving 200 with no per-project workaround files. `ddev restart` works repeatably (~27s). `ddev start` over an already-running project still fails on apple container's global hostname uniqueness, which is upstream of socktainer and unrelated to these paths. HANDOFF.md records the four socktainer-side findings from the same session (start_period slept rather than probed, HostConfig.PortBindings nil, health probes forced to root, hostname uniqueness) and retires blocker 5 plus the healthcheck and chown workarounds, which are now harmful rather than helpful. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> feat(apple-container): add IsAppleContainer() and report it as its own environment, for ddev#7372 [skip ci] DDEV had no vocabulary for "the runtime is apple container" distinct from "the API in front of it is socktainer" — every check went through IsSocktainer(), and `ddev version` reported ddev-environment=darwin and docker-platform=linux-docker, indistinguishable from any other Docker provider on macOS even though apple container's constraints (single-writer volumes, virtiofs bind mounts, global hostname uniqueness) are unlike any of them. Adds dockerutil.IsAppleContainer(), currently detected through IsSocktainer() since socktainer is the only Docker-compatible API in front of apple container today; the two questions are kept separate since that may not stay true. All apple-container-specific call sites (UseBindGlobalCache, the two Mutagen warnings, GetDockerPlatform, activeDockerProvider, the addon virtiofs-propagation sleep) now go through it instead of IsSocktainer() directly. `ddev version` and `ddev debug port` now report: ddev-environment apple-container (was: darwin) docker-platform apple-container (was: linux-docker) Every other provider (OrbStack, Colima, Podman, ...) and Docker being unreachable were retested and are unaffected. Also folds in an audit of every RunSimpleContainer call site for other double-mounts of the database volume: none exist beyond the two already fixed in the prior commit, and RestoreSnapshot always removes the db container before touching its volume, so it was never at risk. Corrected HANDOFF.md, which had speculatively listed it as untested. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> docs: record restart/db-recreate finding and full rebuild recipe, for ddev#7372 [skip ci] Two things from today's session. First, investigated why `ddev restart` recreates the db/web containers every time on apple container: it isn't a bug. `Restart()` is `Stop()`+`Start()`, and `Stop()` always removes the containers first, so compose has nothing to compare a config hash against on the way back up — the same thing happens on every provider, apple container is just slower at it (likely the volume block-attach cost from blocker 1). Second, tore down and rebuilt the entire apple-container/socktainer stack from nothing (system, socktainer binary, docker context) to confirm it's reproducible, and documented the exact recipe. That rebuild also surfaced and fixed a real socktainer bug: ApiVersion/MinAPIVersion carried a stray "v" prefix that silently failed DDEV's own minimum- Docker-version check regardless of the actual version number. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> docs: reorganize HANDOFF.md by DDEV priority and fix stale branch/PR status, for ddev#7372 [skip ci] Split the numbered "Blockers" list into open vs. fixed, ordered by actual impact on DDEV instead of numeric IDs. Added a fix-branches table near the top, linked to every referenced branch/issue/PR. Corrected stale status (PR ddev#347 and issue ddev#346 are closed, not open) and split out the still-open DNS wrong-network-address bug from the already-fixed AAAA/EDNS0 bug it had been bundled with. Re-ranked the table by DDEV impact rather than the fork's diff-risk-based submission order, and surfaced the still-unbranched exec-upgrade/attachStdin fix, which is the actual cause of the `ddev start` hang. docs: correct HANDOFF.md, the exec-upgrade/attachStdin fix already exists, for ddev#7372 [skip ci] The previous commit added a table row proposing a new branch/issue for "socktainer only upgrades exec connection when stdin is attached." Checking the socktainer fork before filing anything found the fix already exists: fix/exec-hijack-close was rewritten on 2026-08-05 (commit 53cc0f3, local only, not pushed) to fix the attachStdin gating and the EOF-close bug together, superseding the closed PR ddev#347 for both. Move that branch back into the top DDEV-start-blocking tier and correct the prose sections that still described it as a real-but-non-blocking bug.
rfay
added a commit
to rfay/ddev
that referenced
this pull request
Oct 21, 2026
…t, for ddev#7372 [skip ci] - For ddev#7372 Apple Container (via socktainer) cannot run DDEV as-is. The dominant blocker is that Apple Container backs each named volume with an ext4 block image that can only be attached to one running VM at a time, so `ddev-global-cache` — mounted simultaneously by web, db, router and every helper container — fails with `VZErrorDomain Code=2 "The storage device attachment is invalid."`. It does not solve it; it establishes how far DDEV can get and what is left. With these changes plus the host-side workarounds documented in HANDOFF.md, `ddev start` brings web, db and ddev-router to healthy (10.5s each) and traefik routes correctly from the host. Remaining blockers are upstream, and the two that still stop a page from being served are catalogued in HANDOFF.md. All code changes are gated behind `DDEV_BIND_GLOBAL_CACHE=true`. With the variable unset, rendering and behavior are unchanged; the compose templates emit exactly what they did before. - `pkg/globalconfig/global_config.go`: `UseBindGlobalCache()`, `GlobalCacheSource()`, `GlobalCacheMount()`. In bind mode the global cache is a host directory (`~/.ddev/global-cache-bind`) rather than a Docker volume, because virtiofs bind mounts can be shared between running containers. - `pkg/ddevapp/ddevapp.go`: use the helper for every `/mnt/ddev-global-cache` mount; skip volume creation and create the host directory instead; add `copyIntoGlobalCache()`, which copies on the host in bind mode. Copying a directory into a container is unsupported by socktainer and hangs when driven through the API. - `pkg/ddevapp/commands.go`, `pkg/ddevapp/traefik.go`: route their copies through `copyIntoGlobalCache()`. - `pkg/ddevapp/app_compose_template.yaml`, `pkg/ddevapp/router_compose_template.yaml`, `config.go`, `router.go`: add `GlobalCacheMount` / `BindGlobalCache` template vars, omit the `volumes:` block when it would render empty, and place project services on `ddev_default` only, since Apple Container gives a container one NIC and `docker network connect` is a no-op. HANDOFF.md records the full analysis: eleven upstream blockers with reproductions, the host-side workarounds needed (gateway DNS, buildkit node), and six design options for replacing the shared-volume pattern. Three of those options are provider-independent improvements worth doing on their own. Requires macOS with Apple `container` 1.2.0 and `socktainer` 1.2.1, plus the host-side setup in HANDOFF.md (gateway dnsmasq and a hand-created buildkit node — buildx cannot bootstrap one under socktainer). ```bash docker context use socktainer mkdir ~/tmp/appletest && cd ~/tmp/appletest && echo '<?php phpinfo();' > index.php ddev config --project-type=php --docroot=. --project-name=appletest DDEV_BIND_GLOBAL_CACHE=true ddev start ``` To confirm nothing changed for normal providers, run `ddev debug compose-config` with the variable unset and verify the `ddev-global-cache` volume and both networks are still present. No new tests. This is exploratory work behind an environment variable that is off by default, and the paths it touches need an Apple Container host to exercise. `make staticrequired` is clean and `go test -short ./pkg/globalconfig/...` passes. Not for release. `DDEV_BIND_GLOBAL_CACHE` is undocumented and unsupported, and HANDOFF.md should be deleted before any of this merges to main. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> docs: refine shared-volume options with attach-rule testing, for ddev#7372 [skip ci] Testing showed the volume restriction is narrower than first documented. A volume is either attached read-write by exactly one container, or read-only by any number of them (verified with three simultaneous `:ro` attachers). Consequences, all verified rather than reasoned: - A long-lived writer container with `:ro` readers alongside it does NOT work; the exclusivity is on the block device, so a writer blocks every other attach, `:ro` included. Recorded so the pattern is not retried. - A *transient* writer does work: seed the volume read-write, exit, then let the project containers mount it `:ro`. Re-seeding requires every reader to be down, which is what `ddev start` / `ddev restart` already does. - Content written continuously by a running container (npm/Composer caches, n_prefix, corepack, shell history) cannot live in the read-only volume, and ddev-webserver's start.sh would need to stop running mkdir/chown under /mnt/ddev-global-cache/. - The owning-container idea still works if it serves the cache over HTTP instead of the filesystem, which covers downloads but not install prefixes. Adds design options 7 and 8 and marks 7 as the most promising direction, since unlike the bind-mount approach implemented behind DDEV_BIND_GLOBAL_CACHE it does not trade away volume performance. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> docs: add privileged-port blocker and cold-start recipe, for ddev#7372 [skip ci] Two failures found while reproducing a start that broke early. Ports below 1024 cannot be published at all: Apple Container's port forwarder runs unprivileged and rejects them with "Binding to ports below 1024 requires root privileges". This is DDEV's default configuration, and it had been masked until now by another router holding 80/443, which made DDEV fall back to ephemeral high ports. Workaround is router_http_port/router_https_port above 1024; a real Apple Container mode needs non-privileged defaults or no port publishing at all. The buildkit node must be recreated, never restarted. Once it exits, buildx restarts it and every build fails with `rbind ... operation not permitted`; `docker rm -f` plus an identical `docker run` fixes it immediately. Capabilities are not the explanation, since they survive a restart, so the cause is unidentified. Since the node exits whenever `container system` restarts, this is the most likely thing to bite when picking the work back up. Adds a cold-start recipe with the required ordering, because the environment does not survive idling: the default network's host bridge is torn down once nothing runs on it, which kills DNS and prevents dnsmasq from rebinding. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> feat(apple-container): auto-detect socktainer, add port and buildkit findings, for ddev#7372 [skip ci] Bind mode was gated behind DDEV_BIND_GLOBAL_CACHE, which is easy to forget: a `ddev start` in a terminal without it uses the volume path and fails in confusing ways. It now turns on automatically when the provider is socktainer. - `pkg/dockerutil/providers.go`: add `IsSocktainer()`, matching `Server.Platform.Name` in the same shape as the existing `IsPodman()`. Move `UseBindGlobalCache()`, `GlobalCacheSource()` and `GlobalCacheMount()` here from `globalconfig`, since detection needs a Docker call and `dockerutil` already imports `globalconfig` rather than the reverse. - `DDEV_BIND_GLOBAL_CACHE=true`/`=false` still forces the behavior either way for testing on other providers. When unset and the provider is not socktainer — including when the provider cannot be reached — detection returns false and rendering is byte-identical to before. Verified by rendering `ddev debug compose-config` both ways. Two failures found while reproducing a start that broke early: - Ports below 1024 cannot be published: Apple Container's forwarder runs unprivileged and rejects them. This is not a new class of problem for DDEV — rootless Podman is already a supported provider with the same restriction and the docs already tell users to configure unprivileged ports. The macOS wrinkle is that there is no `net.ipv4.ip_unprivileged_port_start` escape hatch, so it is mandatory rather than recommended. It had been masked until now by another router holding 80/443, which made DDEV fall back to ephemeral high ports. - The buildkit node must be recreated, never restarted. Once it exits, buildx restarts it and every build fails with `rbind ... operation not permitted`; `docker rm -f` plus an identical `docker run` fixes it. Capabilities are not the explanation, since they survive a restart, so the cause is unidentified. Also adds a cold-start recipe with the required ordering, because the environment does not survive idling: the default network's host bridge is torn down once nothing runs on it, which kills DNS and prevents dnsmasq rebinding. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> docs: say "global-cache bind mount", not "bind mode", for ddev#7372 [skip ci] "Bind mount" on its own is ambiguous in DDEV, where no_bind_mounts already refers to something else entirely: whether the project directory is mounted into the containers. This work bind-mounts only the global cache, so the prose and comments now say so explicitly rather than talking about "bind mode". No behavior change. Also corrects the header, which still described the changes as gated behind an environment variable after they were switched to socktainer auto-detection. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> docs: track upstream socktainer issue/PR status in HANDOFF.md, for ddev#7372 [skip ci] Cross-reference each blocker with its fix's current status (filed, PR open, fix ready but not yet submitted, or investigated-but-not-reproducible), and point to the rfay/socktainer fork's UPSTREAM_ROLLOUT.md for the full ranked plan, so status lives in the branch instead of only in PR comments. feat(apple-container): force Mutagen off on socktainer, for ddev#7372 [skip ci] Mutagen mounts project_mutagen at both /var/www and /tmp/project_mutagen in the web container. On Apple Container that is two attachments of one block-backed volume within a single container, which no configuration can satisfy, so the container never boots: VZErrorDomain Code=2 "The storage device attachment is invalid." Rather than leave every project to discover this, GetPerformanceMode() returns "none" when the provider is socktainer, with a WarningOnce naming the reason. Projects that already resolve to "none" are unaffected and silent. no_bind_mounts normally forces Mutagen on as the only way to get code into the container. It cannot work here either, so it is not honored and gets its own warning instead of failing the same way. Behavior on every other provider is unchanged: IsSocktainer() returns false and both paths keep their previous values. Verified against a project whose only relevant setting was the global performance_mode: mutagen default. The warning appears once per command, the web container gets "bind <project> -> /var/www/html", and no project_mutagen volume is mounted. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> feat(apple-container): stop re-mounting the db volume while its container runs, for ddev#7372 [skip ci] Two DDEV code paths mount the database volume into a throwaway container while the project's own db container already has it. On apple container a volume takes either one writer or any number of readers, never a mix, so the second attachment aborts the helper's boot: VZErrorDomain Code=2 "The storage device attachment is invalid." - getDBVersionFromVolume() ran a GetExistingDBType-* container for this, and util.Failed() made the error fatal, so `ddev start` and `ddev config` both died for any project whose db was running. It now reads the version file with dockerutil.Exec into that running container, which starts no container at all and is cheaper on every provider. - the start-chown-* container mounted the volume to fix ownership. Skipped when the db container is up, since ownership was set on an earlier start. Behavior elsewhere is unchanged: with no running db container both paths do exactly what they did before. Verified with two projects running at once on apple container, which was previously impossible, both serving 200 with no per-project workaround files. `ddev restart` works repeatably (~27s). `ddev start` over an already-running project still fails on apple container's global hostname uniqueness, which is upstream of socktainer and unrelated to these paths. HANDOFF.md records the four socktainer-side findings from the same session (start_period slept rather than probed, HostConfig.PortBindings nil, health probes forced to root, hostname uniqueness) and retires blocker 5 plus the healthcheck and chown workarounds, which are now harmful rather than helpful. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> feat(apple-container): add IsAppleContainer() and report it as its own environment, for ddev#7372 [skip ci] DDEV had no vocabulary for "the runtime is apple container" distinct from "the API in front of it is socktainer" — every check went through IsSocktainer(), and `ddev version` reported ddev-environment=darwin and docker-platform=linux-docker, indistinguishable from any other Docker provider on macOS even though apple container's constraints (single-writer volumes, virtiofs bind mounts, global hostname uniqueness) are unlike any of them. Adds dockerutil.IsAppleContainer(), currently detected through IsSocktainer() since socktainer is the only Docker-compatible API in front of apple container today; the two questions are kept separate since that may not stay true. All apple-container-specific call sites (UseBindGlobalCache, the two Mutagen warnings, GetDockerPlatform, activeDockerProvider, the addon virtiofs-propagation sleep) now go through it instead of IsSocktainer() directly. `ddev version` and `ddev debug port` now report: ddev-environment apple-container (was: darwin) docker-platform apple-container (was: linux-docker) Every other provider (OrbStack, Colima, Podman, ...) and Docker being unreachable were retested and are unaffected. Also folds in an audit of every RunSimpleContainer call site for other double-mounts of the database volume: none exist beyond the two already fixed in the prior commit, and RestoreSnapshot always removes the db container before touching its volume, so it was never at risk. Corrected HANDOFF.md, which had speculatively listed it as untested. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> docs: record restart/db-recreate finding and full rebuild recipe, for ddev#7372 [skip ci] Two things from today's session. First, investigated why `ddev restart` recreates the db/web containers every time on apple container: it isn't a bug. `Restart()` is `Stop()`+`Start()`, and `Stop()` always removes the containers first, so compose has nothing to compare a config hash against on the way back up — the same thing happens on every provider, apple container is just slower at it (likely the volume block-attach cost from blocker 1). Second, tore down and rebuilt the entire apple-container/socktainer stack from nothing (system, socktainer binary, docker context) to confirm it's reproducible, and documented the exact recipe. That rebuild also surfaced and fixed a real socktainer bug: ApiVersion/MinAPIVersion carried a stray "v" prefix that silently failed DDEV's own minimum- Docker-version check regardless of the actual version number. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> docs: reorganize HANDOFF.md by DDEV priority and fix stale branch/PR status, for ddev#7372 [skip ci] Split the numbered "Blockers" list into open vs. fixed, ordered by actual impact on DDEV instead of numeric IDs. Added a fix-branches table near the top, linked to every referenced branch/issue/PR. Corrected stale status (PR ddev#347 and issue ddev#346 are closed, not open) and split out the still-open DNS wrong-network-address bug from the already-fixed AAAA/EDNS0 bug it had been bundled with. Re-ranked the table by DDEV impact rather than the fork's diff-risk-based submission order, and surfaced the still-unbranched exec-upgrade/attachStdin fix, which is the actual cause of the `ddev start` hang. docs: correct HANDOFF.md, the exec-upgrade/attachStdin fix already exists, for ddev#7372 [skip ci] The previous commit added a table row proposing a new branch/issue for "socktainer only upgrades exec connection when stdin is attached." Checking the socktainer fork before filing anything found the fix already exists: fix/exec-hijack-close was rewritten on 2026-08-05 (commit 53cc0f3, local only, not pushed) to fix the attachStdin gating and the EOF-close bug together, superseding the closed PR ddev#347 for both. Move that branch back into the top DDEV-start-blocking tier and correct the prose sections that still described it as a real-but-non-blocking bug.
rfay
added a commit
to rfay/ddev
that referenced
this pull request
Oct 27, 2026
…t, for ddev#7372 [skip ci] - For ddev#7372 Apple Container (via socktainer) cannot run DDEV as-is. The dominant blocker is that Apple Container backs each named volume with an ext4 block image that can only be attached to one running VM at a time, so `ddev-global-cache` — mounted simultaneously by web, db, router and every helper container — fails with `VZErrorDomain Code=2 "The storage device attachment is invalid."`. It does not solve it; it establishes how far DDEV can get and what is left. With these changes plus the host-side workarounds documented in HANDOFF.md, `ddev start` brings web, db and ddev-router to healthy (10.5s each) and traefik routes correctly from the host. Remaining blockers are upstream, and the two that still stop a page from being served are catalogued in HANDOFF.md. All code changes are gated behind `DDEV_BIND_GLOBAL_CACHE=true`. With the variable unset, rendering and behavior are unchanged; the compose templates emit exactly what they did before. - `pkg/globalconfig/global_config.go`: `UseBindGlobalCache()`, `GlobalCacheSource()`, `GlobalCacheMount()`. In bind mode the global cache is a host directory (`~/.ddev/global-cache-bind`) rather than a Docker volume, because virtiofs bind mounts can be shared between running containers. - `pkg/ddevapp/ddevapp.go`: use the helper for every `/mnt/ddev-global-cache` mount; skip volume creation and create the host directory instead; add `copyIntoGlobalCache()`, which copies on the host in bind mode. Copying a directory into a container is unsupported by socktainer and hangs when driven through the API. - `pkg/ddevapp/commands.go`, `pkg/ddevapp/traefik.go`: route their copies through `copyIntoGlobalCache()`. - `pkg/ddevapp/app_compose_template.yaml`, `pkg/ddevapp/router_compose_template.yaml`, `config.go`, `router.go`: add `GlobalCacheMount` / `BindGlobalCache` template vars, omit the `volumes:` block when it would render empty, and place project services on `ddev_default` only, since Apple Container gives a container one NIC and `docker network connect` is a no-op. HANDOFF.md records the full analysis: eleven upstream blockers with reproductions, the host-side workarounds needed (gateway DNS, buildkit node), and six design options for replacing the shared-volume pattern. Three of those options are provider-independent improvements worth doing on their own. Requires macOS with Apple `container` 1.2.0 and `socktainer` 1.2.1, plus the host-side setup in HANDOFF.md (gateway dnsmasq and a hand-created buildkit node — buildx cannot bootstrap one under socktainer). ```bash docker context use socktainer mkdir ~/tmp/appletest && cd ~/tmp/appletest && echo '<?php phpinfo();' > index.php ddev config --project-type=php --docroot=. --project-name=appletest DDEV_BIND_GLOBAL_CACHE=true ddev start ``` To confirm nothing changed for normal providers, run `ddev debug compose-config` with the variable unset and verify the `ddev-global-cache` volume and both networks are still present. No new tests. This is exploratory work behind an environment variable that is off by default, and the paths it touches need an Apple Container host to exercise. `make staticrequired` is clean and `go test -short ./pkg/globalconfig/...` passes. Not for release. `DDEV_BIND_GLOBAL_CACHE` is undocumented and unsupported, and HANDOFF.md should be deleted before any of this merges to main. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> docs: refine shared-volume options with attach-rule testing, for ddev#7372 [skip ci] Testing showed the volume restriction is narrower than first documented. A volume is either attached read-write by exactly one container, or read-only by any number of them (verified with three simultaneous `:ro` attachers). Consequences, all verified rather than reasoned: - A long-lived writer container with `:ro` readers alongside it does NOT work; the exclusivity is on the block device, so a writer blocks every other attach, `:ro` included. Recorded so the pattern is not retried. - A *transient* writer does work: seed the volume read-write, exit, then let the project containers mount it `:ro`. Re-seeding requires every reader to be down, which is what `ddev start` / `ddev restart` already does. - Content written continuously by a running container (npm/Composer caches, n_prefix, corepack, shell history) cannot live in the read-only volume, and ddev-webserver's start.sh would need to stop running mkdir/chown under /mnt/ddev-global-cache/. - The owning-container idea still works if it serves the cache over HTTP instead of the filesystem, which covers downloads but not install prefixes. Adds design options 7 and 8 and marks 7 as the most promising direction, since unlike the bind-mount approach implemented behind DDEV_BIND_GLOBAL_CACHE it does not trade away volume performance. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> docs: add privileged-port blocker and cold-start recipe, for ddev#7372 [skip ci] Two failures found while reproducing a start that broke early. Ports below 1024 cannot be published at all: Apple Container's port forwarder runs unprivileged and rejects them with "Binding to ports below 1024 requires root privileges". This is DDEV's default configuration, and it had been masked until now by another router holding 80/443, which made DDEV fall back to ephemeral high ports. Workaround is router_http_port/router_https_port above 1024; a real Apple Container mode needs non-privileged defaults or no port publishing at all. The buildkit node must be recreated, never restarted. Once it exits, buildx restarts it and every build fails with `rbind ... operation not permitted`; `docker rm -f` plus an identical `docker run` fixes it immediately. Capabilities are not the explanation, since they survive a restart, so the cause is unidentified. Since the node exits whenever `container system` restarts, this is the most likely thing to bite when picking the work back up. Adds a cold-start recipe with the required ordering, because the environment does not survive idling: the default network's host bridge is torn down once nothing runs on it, which kills DNS and prevents dnsmasq from rebinding. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> feat(apple-container): auto-detect socktainer, add port and buildkit findings, for ddev#7372 [skip ci] Bind mode was gated behind DDEV_BIND_GLOBAL_CACHE, which is easy to forget: a `ddev start` in a terminal without it uses the volume path and fails in confusing ways. It now turns on automatically when the provider is socktainer. - `pkg/dockerutil/providers.go`: add `IsSocktainer()`, matching `Server.Platform.Name` in the same shape as the existing `IsPodman()`. Move `UseBindGlobalCache()`, `GlobalCacheSource()` and `GlobalCacheMount()` here from `globalconfig`, since detection needs a Docker call and `dockerutil` already imports `globalconfig` rather than the reverse. - `DDEV_BIND_GLOBAL_CACHE=true`/`=false` still forces the behavior either way for testing on other providers. When unset and the provider is not socktainer — including when the provider cannot be reached — detection returns false and rendering is byte-identical to before. Verified by rendering `ddev debug compose-config` both ways. Two failures found while reproducing a start that broke early: - Ports below 1024 cannot be published: Apple Container's forwarder runs unprivileged and rejects them. This is not a new class of problem for DDEV — rootless Podman is already a supported provider with the same restriction and the docs already tell users to configure unprivileged ports. The macOS wrinkle is that there is no `net.ipv4.ip_unprivileged_port_start` escape hatch, so it is mandatory rather than recommended. It had been masked until now by another router holding 80/443, which made DDEV fall back to ephemeral high ports. - The buildkit node must be recreated, never restarted. Once it exits, buildx restarts it and every build fails with `rbind ... operation not permitted`; `docker rm -f` plus an identical `docker run` fixes it. Capabilities are not the explanation, since they survive a restart, so the cause is unidentified. Also adds a cold-start recipe with the required ordering, because the environment does not survive idling: the default network's host bridge is torn down once nothing runs on it, which kills DNS and prevents dnsmasq rebinding. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> docs: say "global-cache bind mount", not "bind mode", for ddev#7372 [skip ci] "Bind mount" on its own is ambiguous in DDEV, where no_bind_mounts already refers to something else entirely: whether the project directory is mounted into the containers. This work bind-mounts only the global cache, so the prose and comments now say so explicitly rather than talking about "bind mode". No behavior change. Also corrects the header, which still described the changes as gated behind an environment variable after they were switched to socktainer auto-detection. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> docs: track upstream socktainer issue/PR status in HANDOFF.md, for ddev#7372 [skip ci] Cross-reference each blocker with its fix's current status (filed, PR open, fix ready but not yet submitted, or investigated-but-not-reproducible), and point to the rfay/socktainer fork's UPSTREAM_ROLLOUT.md for the full ranked plan, so status lives in the branch instead of only in PR comments. feat(apple-container): force Mutagen off on socktainer, for ddev#7372 [skip ci] Mutagen mounts project_mutagen at both /var/www and /tmp/project_mutagen in the web container. On Apple Container that is two attachments of one block-backed volume within a single container, which no configuration can satisfy, so the container never boots: VZErrorDomain Code=2 "The storage device attachment is invalid." Rather than leave every project to discover this, GetPerformanceMode() returns "none" when the provider is socktainer, with a WarningOnce naming the reason. Projects that already resolve to "none" are unaffected and silent. no_bind_mounts normally forces Mutagen on as the only way to get code into the container. It cannot work here either, so it is not honored and gets its own warning instead of failing the same way. Behavior on every other provider is unchanged: IsSocktainer() returns false and both paths keep their previous values. Verified against a project whose only relevant setting was the global performance_mode: mutagen default. The warning appears once per command, the web container gets "bind <project> -> /var/www/html", and no project_mutagen volume is mounted. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> feat(apple-container): stop re-mounting the db volume while its container runs, for ddev#7372 [skip ci] Two DDEV code paths mount the database volume into a throwaway container while the project's own db container already has it. On apple container a volume takes either one writer or any number of readers, never a mix, so the second attachment aborts the helper's boot: VZErrorDomain Code=2 "The storage device attachment is invalid." - getDBVersionFromVolume() ran a GetExistingDBType-* container for this, and util.Failed() made the error fatal, so `ddev start` and `ddev config` both died for any project whose db was running. It now reads the version file with dockerutil.Exec into that running container, which starts no container at all and is cheaper on every provider. - the start-chown-* container mounted the volume to fix ownership. Skipped when the db container is up, since ownership was set on an earlier start. Behavior elsewhere is unchanged: with no running db container both paths do exactly what they did before. Verified with two projects running at once on apple container, which was previously impossible, both serving 200 with no per-project workaround files. `ddev restart` works repeatably (~27s). `ddev start` over an already-running project still fails on apple container's global hostname uniqueness, which is upstream of socktainer and unrelated to these paths. HANDOFF.md records the four socktainer-side findings from the same session (start_period slept rather than probed, HostConfig.PortBindings nil, health probes forced to root, hostname uniqueness) and retires blocker 5 plus the healthcheck and chown workarounds, which are now harmful rather than helpful. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> feat(apple-container): add IsAppleContainer() and report it as its own environment, for ddev#7372 [skip ci] DDEV had no vocabulary for "the runtime is apple container" distinct from "the API in front of it is socktainer" — every check went through IsSocktainer(), and `ddev version` reported ddev-environment=darwin and docker-platform=linux-docker, indistinguishable from any other Docker provider on macOS even though apple container's constraints (single-writer volumes, virtiofs bind mounts, global hostname uniqueness) are unlike any of them. Adds dockerutil.IsAppleContainer(), currently detected through IsSocktainer() since socktainer is the only Docker-compatible API in front of apple container today; the two questions are kept separate since that may not stay true. All apple-container-specific call sites (UseBindGlobalCache, the two Mutagen warnings, GetDockerPlatform, activeDockerProvider, the addon virtiofs-propagation sleep) now go through it instead of IsSocktainer() directly. `ddev version` and `ddev debug port` now report: ddev-environment apple-container (was: darwin) docker-platform apple-container (was: linux-docker) Every other provider (OrbStack, Colima, Podman, ...) and Docker being unreachable were retested and are unaffected. Also folds in an audit of every RunSimpleContainer call site for other double-mounts of the database volume: none exist beyond the two already fixed in the prior commit, and RestoreSnapshot always removes the db container before touching its volume, so it was never at risk. Corrected HANDOFF.md, which had speculatively listed it as untested. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> docs: record restart/db-recreate finding and full rebuild recipe, for ddev#7372 [skip ci] Two things from today's session. First, investigated why `ddev restart` recreates the db/web containers every time on apple container: it isn't a bug. `Restart()` is `Stop()`+`Start()`, and `Stop()` always removes the containers first, so compose has nothing to compare a config hash against on the way back up — the same thing happens on every provider, apple container is just slower at it (likely the volume block-attach cost from blocker 1). Second, tore down and rebuilt the entire apple-container/socktainer stack from nothing (system, socktainer binary, docker context) to confirm it's reproducible, and documented the exact recipe. That rebuild also surfaced and fixed a real socktainer bug: ApiVersion/MinAPIVersion carried a stray "v" prefix that silently failed DDEV's own minimum- Docker-version check regardless of the actual version number. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> docs: reorganize HANDOFF.md by DDEV priority and fix stale branch/PR status, for ddev#7372 [skip ci] Split the numbered "Blockers" list into open vs. fixed, ordered by actual impact on DDEV instead of numeric IDs. Added a fix-branches table near the top, linked to every referenced branch/issue/PR. Corrected stale status (PR ddev#347 and issue ddev#346 are closed, not open) and split out the still-open DNS wrong-network-address bug from the already-fixed AAAA/EDNS0 bug it had been bundled with. Re-ranked the table by DDEV impact rather than the fork's diff-risk-based submission order, and surfaced the still-unbranched exec-upgrade/attachStdin fix, which is the actual cause of the `ddev start` hang. docs: correct HANDOFF.md, the exec-upgrade/attachStdin fix already exists, for ddev#7372 [skip ci] The previous commit added a table row proposing a new branch/issue for "socktainer only upgrades exec connection when stdin is attached." Checking the socktainer fork before filing anything found the fix already exists: fix/exec-hijack-close was rewritten on 2026-08-05 (commit 53cc0f3, local only, not pushed) to fix the attachStdin gating and the EOF-close bug together, superseding the closed PR ddev#347 for both. Move that branch back into the top DDEV-start-blocking tier and correct the prose sections that still described it as a real-but-non-blocking bug.
rfay
added a commit
to rfay/ddev
that referenced
this pull request
Oct 31, 2026
…t, for ddev#7372 [skip ci] - For ddev#7372 Apple Container (via socktainer) cannot run DDEV as-is. The dominant blocker is that Apple Container backs each named volume with an ext4 block image that can only be attached to one running VM at a time, so `ddev-global-cache` — mounted simultaneously by web, db, router and every helper container — fails with `VZErrorDomain Code=2 "The storage device attachment is invalid."`. It does not solve it; it establishes how far DDEV can get and what is left. With these changes plus the host-side workarounds documented in HANDOFF.md, `ddev start` brings web, db and ddev-router to healthy (10.5s each) and traefik routes correctly from the host. Remaining blockers are upstream, and the two that still stop a page from being served are catalogued in HANDOFF.md. All code changes are gated behind `DDEV_BIND_GLOBAL_CACHE=true`. With the variable unset, rendering and behavior are unchanged; the compose templates emit exactly what they did before. - `pkg/globalconfig/global_config.go`: `UseBindGlobalCache()`, `GlobalCacheSource()`, `GlobalCacheMount()`. In bind mode the global cache is a host directory (`~/.ddev/global-cache-bind`) rather than a Docker volume, because virtiofs bind mounts can be shared between running containers. - `pkg/ddevapp/ddevapp.go`: use the helper for every `/mnt/ddev-global-cache` mount; skip volume creation and create the host directory instead; add `copyIntoGlobalCache()`, which copies on the host in bind mode. Copying a directory into a container is unsupported by socktainer and hangs when driven through the API. - `pkg/ddevapp/commands.go`, `pkg/ddevapp/traefik.go`: route their copies through `copyIntoGlobalCache()`. - `pkg/ddevapp/app_compose_template.yaml`, `pkg/ddevapp/router_compose_template.yaml`, `config.go`, `router.go`: add `GlobalCacheMount` / `BindGlobalCache` template vars, omit the `volumes:` block when it would render empty, and place project services on `ddev_default` only, since Apple Container gives a container one NIC and `docker network connect` is a no-op. HANDOFF.md records the full analysis: eleven upstream blockers with reproductions, the host-side workarounds needed (gateway DNS, buildkit node), and six design options for replacing the shared-volume pattern. Three of those options are provider-independent improvements worth doing on their own. Requires macOS with Apple `container` 1.2.0 and `socktainer` 1.2.1, plus the host-side setup in HANDOFF.md (gateway dnsmasq and a hand-created buildkit node — buildx cannot bootstrap one under socktainer). ```bash docker context use socktainer mkdir ~/tmp/appletest && cd ~/tmp/appletest && echo '<?php phpinfo();' > index.php ddev config --project-type=php --docroot=. --project-name=appletest DDEV_BIND_GLOBAL_CACHE=true ddev start ``` To confirm nothing changed for normal providers, run `ddev debug compose-config` with the variable unset and verify the `ddev-global-cache` volume and both networks are still present. No new tests. This is exploratory work behind an environment variable that is off by default, and the paths it touches need an Apple Container host to exercise. `make staticrequired` is clean and `go test -short ./pkg/globalconfig/...` passes. Not for release. `DDEV_BIND_GLOBAL_CACHE` is undocumented and unsupported, and HANDOFF.md should be deleted before any of this merges to main. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> docs: refine shared-volume options with attach-rule testing, for ddev#7372 [skip ci] Testing showed the volume restriction is narrower than first documented. A volume is either attached read-write by exactly one container, or read-only by any number of them (verified with three simultaneous `:ro` attachers). Consequences, all verified rather than reasoned: - A long-lived writer container with `:ro` readers alongside it does NOT work; the exclusivity is on the block device, so a writer blocks every other attach, `:ro` included. Recorded so the pattern is not retried. - A *transient* writer does work: seed the volume read-write, exit, then let the project containers mount it `:ro`. Re-seeding requires every reader to be down, which is what `ddev start` / `ddev restart` already does. - Content written continuously by a running container (npm/Composer caches, n_prefix, corepack, shell history) cannot live in the read-only volume, and ddev-webserver's start.sh would need to stop running mkdir/chown under /mnt/ddev-global-cache/. - The owning-container idea still works if it serves the cache over HTTP instead of the filesystem, which covers downloads but not install prefixes. Adds design options 7 and 8 and marks 7 as the most promising direction, since unlike the bind-mount approach implemented behind DDEV_BIND_GLOBAL_CACHE it does not trade away volume performance. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> docs: add privileged-port blocker and cold-start recipe, for ddev#7372 [skip ci] Two failures found while reproducing a start that broke early. Ports below 1024 cannot be published at all: Apple Container's port forwarder runs unprivileged and rejects them with "Binding to ports below 1024 requires root privileges". This is DDEV's default configuration, and it had been masked until now by another router holding 80/443, which made DDEV fall back to ephemeral high ports. Workaround is router_http_port/router_https_port above 1024; a real Apple Container mode needs non-privileged defaults or no port publishing at all. The buildkit node must be recreated, never restarted. Once it exits, buildx restarts it and every build fails with `rbind ... operation not permitted`; `docker rm -f` plus an identical `docker run` fixes it immediately. Capabilities are not the explanation, since they survive a restart, so the cause is unidentified. Since the node exits whenever `container system` restarts, this is the most likely thing to bite when picking the work back up. Adds a cold-start recipe with the required ordering, because the environment does not survive idling: the default network's host bridge is torn down once nothing runs on it, which kills DNS and prevents dnsmasq from rebinding. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> feat(apple-container): auto-detect socktainer, add port and buildkit findings, for ddev#7372 [skip ci] Bind mode was gated behind DDEV_BIND_GLOBAL_CACHE, which is easy to forget: a `ddev start` in a terminal without it uses the volume path and fails in confusing ways. It now turns on automatically when the provider is socktainer. - `pkg/dockerutil/providers.go`: add `IsSocktainer()`, matching `Server.Platform.Name` in the same shape as the existing `IsPodman()`. Move `UseBindGlobalCache()`, `GlobalCacheSource()` and `GlobalCacheMount()` here from `globalconfig`, since detection needs a Docker call and `dockerutil` already imports `globalconfig` rather than the reverse. - `DDEV_BIND_GLOBAL_CACHE=true`/`=false` still forces the behavior either way for testing on other providers. When unset and the provider is not socktainer — including when the provider cannot be reached — detection returns false and rendering is byte-identical to before. Verified by rendering `ddev debug compose-config` both ways. Two failures found while reproducing a start that broke early: - Ports below 1024 cannot be published: Apple Container's forwarder runs unprivileged and rejects them. This is not a new class of problem for DDEV — rootless Podman is already a supported provider with the same restriction and the docs already tell users to configure unprivileged ports. The macOS wrinkle is that there is no `net.ipv4.ip_unprivileged_port_start` escape hatch, so it is mandatory rather than recommended. It had been masked until now by another router holding 80/443, which made DDEV fall back to ephemeral high ports. - The buildkit node must be recreated, never restarted. Once it exits, buildx restarts it and every build fails with `rbind ... operation not permitted`; `docker rm -f` plus an identical `docker run` fixes it. Capabilities are not the explanation, since they survive a restart, so the cause is unidentified. Also adds a cold-start recipe with the required ordering, because the environment does not survive idling: the default network's host bridge is torn down once nothing runs on it, which kills DNS and prevents dnsmasq rebinding. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> docs: say "global-cache bind mount", not "bind mode", for ddev#7372 [skip ci] "Bind mount" on its own is ambiguous in DDEV, where no_bind_mounts already refers to something else entirely: whether the project directory is mounted into the containers. This work bind-mounts only the global cache, so the prose and comments now say so explicitly rather than talking about "bind mode". No behavior change. Also corrects the header, which still described the changes as gated behind an environment variable after they were switched to socktainer auto-detection. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> docs: track upstream socktainer issue/PR status in HANDOFF.md, for ddev#7372 [skip ci] Cross-reference each blocker with its fix's current status (filed, PR open, fix ready but not yet submitted, or investigated-but-not-reproducible), and point to the rfay/socktainer fork's UPSTREAM_ROLLOUT.md for the full ranked plan, so status lives in the branch instead of only in PR comments. feat(apple-container): force Mutagen off on socktainer, for ddev#7372 [skip ci] Mutagen mounts project_mutagen at both /var/www and /tmp/project_mutagen in the web container. On Apple Container that is two attachments of one block-backed volume within a single container, which no configuration can satisfy, so the container never boots: VZErrorDomain Code=2 "The storage device attachment is invalid." Rather than leave every project to discover this, GetPerformanceMode() returns "none" when the provider is socktainer, with a WarningOnce naming the reason. Projects that already resolve to "none" are unaffected and silent. no_bind_mounts normally forces Mutagen on as the only way to get code into the container. It cannot work here either, so it is not honored and gets its own warning instead of failing the same way. Behavior on every other provider is unchanged: IsSocktainer() returns false and both paths keep their previous values. Verified against a project whose only relevant setting was the global performance_mode: mutagen default. The warning appears once per command, the web container gets "bind <project> -> /var/www/html", and no project_mutagen volume is mounted. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> feat(apple-container): stop re-mounting the db volume while its container runs, for ddev#7372 [skip ci] Two DDEV code paths mount the database volume into a throwaway container while the project's own db container already has it. On apple container a volume takes either one writer or any number of readers, never a mix, so the second attachment aborts the helper's boot: VZErrorDomain Code=2 "The storage device attachment is invalid." - getDBVersionFromVolume() ran a GetExistingDBType-* container for this, and util.Failed() made the error fatal, so `ddev start` and `ddev config` both died for any project whose db was running. It now reads the version file with dockerutil.Exec into that running container, which starts no container at all and is cheaper on every provider. - the start-chown-* container mounted the volume to fix ownership. Skipped when the db container is up, since ownership was set on an earlier start. Behavior elsewhere is unchanged: with no running db container both paths do exactly what they did before. Verified with two projects running at once on apple container, which was previously impossible, both serving 200 with no per-project workaround files. `ddev restart` works repeatably (~27s). `ddev start` over an already-running project still fails on apple container's global hostname uniqueness, which is upstream of socktainer and unrelated to these paths. HANDOFF.md records the four socktainer-side findings from the same session (start_period slept rather than probed, HostConfig.PortBindings nil, health probes forced to root, hostname uniqueness) and retires blocker 5 plus the healthcheck and chown workarounds, which are now harmful rather than helpful. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> feat(apple-container): add IsAppleContainer() and report it as its own environment, for ddev#7372 [skip ci] DDEV had no vocabulary for "the runtime is apple container" distinct from "the API in front of it is socktainer" — every check went through IsSocktainer(), and `ddev version` reported ddev-environment=darwin and docker-platform=linux-docker, indistinguishable from any other Docker provider on macOS even though apple container's constraints (single-writer volumes, virtiofs bind mounts, global hostname uniqueness) are unlike any of them. Adds dockerutil.IsAppleContainer(), currently detected through IsSocktainer() since socktainer is the only Docker-compatible API in front of apple container today; the two questions are kept separate since that may not stay true. All apple-container-specific call sites (UseBindGlobalCache, the two Mutagen warnings, GetDockerPlatform, activeDockerProvider, the addon virtiofs-propagation sleep) now go through it instead of IsSocktainer() directly. `ddev version` and `ddev debug port` now report: ddev-environment apple-container (was: darwin) docker-platform apple-container (was: linux-docker) Every other provider (OrbStack, Colima, Podman, ...) and Docker being unreachable were retested and are unaffected. Also folds in an audit of every RunSimpleContainer call site for other double-mounts of the database volume: none exist beyond the two already fixed in the prior commit, and RestoreSnapshot always removes the db container before touching its volume, so it was never at risk. Corrected HANDOFF.md, which had speculatively listed it as untested. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> docs: record restart/db-recreate finding and full rebuild recipe, for ddev#7372 [skip ci] Two things from today's session. First, investigated why `ddev restart` recreates the db/web containers every time on apple container: it isn't a bug. `Restart()` is `Stop()`+`Start()`, and `Stop()` always removes the containers first, so compose has nothing to compare a config hash against on the way back up — the same thing happens on every provider, apple container is just slower at it (likely the volume block-attach cost from blocker 1). Second, tore down and rebuilt the entire apple-container/socktainer stack from nothing (system, socktainer binary, docker context) to confirm it's reproducible, and documented the exact recipe. That rebuild also surfaced and fixed a real socktainer bug: ApiVersion/MinAPIVersion carried a stray "v" prefix that silently failed DDEV's own minimum- Docker-version check regardless of the actual version number. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> docs: reorganize HANDOFF.md by DDEV priority and fix stale branch/PR status, for ddev#7372 [skip ci] Split the numbered "Blockers" list into open vs. fixed, ordered by actual impact on DDEV instead of numeric IDs. Added a fix-branches table near the top, linked to every referenced branch/issue/PR. Corrected stale status (PR ddev#347 and issue ddev#346 are closed, not open) and split out the still-open DNS wrong-network-address bug from the already-fixed AAAA/EDNS0 bug it had been bundled with. Re-ranked the table by DDEV impact rather than the fork's diff-risk-based submission order, and surfaced the still-unbranched exec-upgrade/attachStdin fix, which is the actual cause of the `ddev start` hang. docs: correct HANDOFF.md, the exec-upgrade/attachStdin fix already exists, for ddev#7372 [skip ci] The previous commit added a table row proposing a new branch/issue for "socktainer only upgrades exec connection when stdin is attached." Checking the socktainer fork before filing anything found the fix already exists: fix/exec-hijack-close was rewritten on 2026-08-05 (commit 53cc0f3, local only, not pushed) to fix the attachStdin gating and the EOF-close bug together, superseding the closed PR ddev#347 for both. Move that branch back into the top DDEV-start-blocking tier and correct the prose sections that still described it as a real-but-non-blocking bug.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reverts #340
This broke our nightly build (https://circleci.com/gh/drud/ddev/1165) and we're not sure why at this point. This reverts the change until we can fix the issue.