DevOps, Containers & Cloud
20 lessons from merged PRs in Docker Compose, Helm, Prometheus and Caddy, summarized in our own words. Deployment and container runtime pitfalls.
brain_seed_starter(instance_id="<your-brain-id>", stack="devops")20 fixes from merged PRs
Every lesson below is a short summary in our own words and links to its upstream GitHub pull request in a permissive-licensed repository. Seed them into your Brain so your coding agent can find them when a similar problem comes up.
- Symptom
With docker compose up --watch and a sync+restart rule, log output stops after the container restarts.
Cause and fixCause: On restart the attached single container briefly has no running containers so compose ended its run, and the Restarting state flag from inspect was reported as false. Fix: The watch code now checks whether the restarted container is actually running instead of relying on that flag, and the previously disabled watch e2e tests were re-enabled.
- Symptom
docker compose up fails with 'network not found' for a named network that used to be created automatically.
Cause and fixCause: The network list API with a name filter matches partial names and may return several results, so the lookup in compose misjudged whether the network existed. Fix: create.go and down.go now compare the exact network name before deciding to create or remove it.
- Symptom
Running docker compose from a subdirectory no longer merges a parent .env file the way it did before Compose 2.24.
Cause and fixCause: A change in how .env files are loaded dropped the undocumented behavior that a local .env beside the compose file could set COMPOSE_* variables and override the other .env. Fix: The loading code in cmd/compose restores that behavior, allowing the local .env to set COMPOSE_* variables and override the other .env file.
- Symptom
docker compose build with profiles does not mount build secret files into /run/secrets.
Cause and fixCause: Build resolves the enabled services after the project is loaded, but unused resources such as secrets were already stripped out earlier. Fix: cmd/compose/build.go no longer drops unused resources when loading the project for a build, and an e2e fixture with a profile and secret covers it.
- Symptom
After compose recreates a network whose config changed, the terminal UI keeps showing containers as stopped although the engine restarted them.
Cause and fixCause: Compose emitted no event for containers that came back running through a restart policy after being reconnected. Fix: Compose now inspects containers after reconnecting them and emits their real state (running, created or stopped).
- Symptom
docker compose build with a remote ssh:// build context cannot find the Dockerfile.
Cause and fixCause: filepath.Join collapsed the double slash of ssh:// into a single slash, breaking the URL. Fix: build_bake.go now returns the Dockerfile name unchanged when the context contains a URL scheme (://), as already done for git and https contexts.
- Symptom
A compose service using network_mode: service:<other> loses connectivity after the referenced service is restarted.
Cause and fixCause: The dependent container shares the network namespace of the restarted one and keeps pointing to the old namespace. Fix: docker compose restart now restarts dependent services too, with a new --no-deps flag in restart.go to get the old behavior.
- Symptom
docker --context default compose version fails with 'unknown docker command: compose compose' in Compose 2.0.1.
Cause and fixCause: Calling the plugin with docker root flags caused the word compose to be passed twice. Fix: The command setup in cmd/compose/compose.go and cmd/main.go was changed so the plugin handles those root flags without duplicating the subcommand name; vendoring of the repo was also removed.
- Symptom
A chart packaged with helm 3 on Windows unpacks into a flat structure with backslashes in file names on Linux and breaks artifactory.
Cause and fixCause: Windows archives stored paths with a backslash separator. Fix: pkg/chartutil/save.go now applies filepath.ToSlash to the entry names so archives always use forward slashes.
- Symptom
helm panics with a nil pointer dereference when saving a chart and the stat call fails with an error other than not-exist.
Cause and fixCause: The code checked only for the not-exist error and then called IsDir on a nil FileInfo. Fix: save.go now handles every other stat error and returns it instead of continuing.
- Symptom
The helm get script installs a release candidate instead of the latest stable version.
Cause and fixCause: A recent change made the scripts pick up pre-releases along with stable releases when determining the latest tag. Fix: scripts/get and scripts/get-helm-3 were changed so they select only stable releases.
- Symptom
A helm repository index built without --url holds relative chart URLs, and adding the repo works but fetching or installing charts fails.
Cause and fixCause: Relative chart URLs were not resolved against the repository base URL, a regression from around Helm 2.2.0. Fix: The chart downloader now derives the URL prefix from the repository's base URL when the index lists relative paths.
- Symptom
helm dependency update leaves the charts folder empty when downloading new versions fails.
Cause and fixCause: Old subcharts were deleted before the replacements had been downloaded. Fix: Manager.downloadAll now moves old charts to a temp directory first, restoring them if any dependency update fails and deleting the temp directory otherwise.
- Symptom
Helm with the PostgreSQL storage driver only works for the owner role and fails for users with just read-write rights.
Cause and fixCause: It always ran the create-table-if-not-exists migrations, which less privileged roles cannot execute. Fix: The SQL driver now checks whether migrations were already applied and runs them only when they are missing.
- Symptom
helm template --debug --show-only reports 'could not find template' when the selected template has a rendering error.
Cause and fixCause: With --debug the original rendering error was suppressed and the later lookup then produced a misleading error. Fix: The original rendering error is now captured and takes priority in the reported message.
- Symptom
helm upgrade fails with 'grpc: received message larger than max' for charts that embed many large files.
Cause and fixCause: The client's gRPC message size limit stayed at the default 4MB while the server side allowed more. Fix: pkg/helm/client.go now sets the gRPC max message size to match the server's limit.
- Symptom
PromQL queries mixing range functions, subqueries and the @ modifier at a timestamp lacking data panic in Prometheus 3.8 and 3.9 with an index-out-of-range error.
Cause and fixCause: After function signatures switched to concrete types, several functions indexed matrixVal[0] or vectorVals[0][0] without first checking whether those slices were empty. Fix: The affected range functions now check for empty input before indexing, so these queries return no data instead of panicking.
- Symptom
Prometheus TestFsType fails when the tests run on a file system such as a btrfs subvolume that is absent from the FsType table.
Cause and fixCause: The table of known file system magic numbers in the runtime utilities was missing newer popular file systems. Fix: The table in statfs_default.go was extended with file system types taken from the Linux magic.h header, including btrfs.
- Symptom
Caddy still tries to create a local CA and write under /data/caddy/pki at startup, failing on permissions, though auto_https is off and skip_install_trust is set.
Cause and fixCause: automaticHTTPSPhase1() kept building TLS automation after handling disabled servers, and the skip_install_trust handling created a default CA regardless of the auto_https setting. Fix: automaticHTTPSPhase1() now returns early when all servers have auto_https disabled and no domains need certificates, and buildPKIApp() in pkiapp.go respects auto_https when handling skip_install_trust.
- Symptom
Caddy try_files with a rewrite to the matched file breaks requests for files whose names contain a question mark or a percent sign, while plain file_server serves them fine.
Cause and fixCause: The matched file path was substituted into the rewrite target unescaped, so a literal question mark looked like a query delimiter and percent sequences were decoded a second time. Fix: The file matcher's path placeholders now stay escaped while the rewrite parses its target URI, and a test covers try_files rewriting to the relative matched path.