Home / Topics / Docker & Containers / Troubleshooting
Docker & Containers

Troubleshooting

Realistic Docker symptoms with exact error text, diagnosis commands and fixes


Daemon, install and permissions

๐ŸŽฅ Learn this hands-on with DevOps Shack โ†’ YouTube @devopsshack ยท Hindi @shackverse ยท Courses at devopsshack.com

Q1

Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

Beginner

Likely causes โ†’ dockerd is stopped, crashed, not installed, or DOCKER_HOST/context points elsewhere.

Diagnose โ†’

bash
systemctl status docker
journalctl -u docker --no-pager -n 50
echo $DOCKER_HOST; docker context ls

Fix โ†’ sudo systemctl enable --now docker. Unset a stale DOCKER_HOST or docker context use default. On Docker Desktop start the app.

Prevent โ†’ Enable the service at boot and monitor it.

Copy link
Q2

permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock

Beginner

Likely causes โ†’ User isn't in the docker group (socket is root:docker 0660) or group membership not refreshed.

Diagnose โ†’

bash
ls -l /var/run/docker.sock
id -nG

Fix โ†’ sudo usermod -aG docker $USER then newgrp docker or re-login. Do not chmod 666 the socket.

Prevent โ†’ Remember the group is root-equivalent; prefer rootless for developers.

Copy link
Q3

dockerd fails to start after editing daemon.json: unable to configure the Docker daemon with file /etc/docker/daemon.json

Intermediate

Likely causes โ†’ Invalid JSON, unknown key, or a conflict with a flag in the systemd unit (the following directives are specified both as a flag and in the configuration file: hosts).

Diagnose โ†’

bash
dockerd --validate --config-file /etc/docker/daemon.json
jq . /etc/docker/daemon.json
journalctl -xeu docker

Fix โ†’ Correct JSON; for the hosts conflict create a systemd drop-in that clears ExecStart flags: ExecStart= then ExecStart=/usr/bin/dockerd.

Prevent โ†’ Validate config in CI before rollout.

Copy link
Q4

docker: command not found right after installing Docker Desktop on macOS.

Beginner

Likely causes โ†’ Desktop not started, CLI symlinks not created, or PATH missing /usr/local/bin.

Diagnose โ†’ ls -l /usr/local/bin/docker, which docker, check Desktop settings for "Install CLI tools".

Fix โ†’ Start Docker Desktop, accept system privileges to create symlinks, or add ~/.docker/bin to PATH.

Prevent โ†’ Standardise installs via MDM.

Copy link
Q5

docker info shows WARNING: bridge-nf-call-iptables is disabled

Intermediate

Likely causes โ†’ br_netfilter module not loaded or sysctl off.

Diagnose โ†’ lsmod | grep br_netfilter; sysctl net.bridge.bridge-nf-call-iptables

Fix โ†’

bash
sudo modprobe br_netfilter
echo br_netfilter | sudo tee /etc/modules-load.d/br_netfilter.conf
echo 'net.bridge.bridge-nf-call-iptables=1' | sudo tee /etc/sysctl.d/99-docker.conf
sudo sysctl --system

Prevent โ†’ Bake into the host image.

Copy link
Q6

Docker service flaps with failed to start daemon: Error initializing network controller: ... iptables failed

Intermediate

Likely causes โ†’ iptables binary/alternatives mismatch (nft vs legacy), a firewall tool flushing chains, or missing kernel modules.

Diagnose โ†’

bash
iptables --version
update-alternatives --display iptables
journalctl -u docker | grep -i iptables

Fix โ†’ Align iptables backend (update-alternatives --set iptables /usr/sbin/iptables-legacy on older Docker, or use nft consistently on newer), reload modules, restart docker after firewalld.

Prevent โ†’ Restart Docker after firewall reloads; use DOCKER-USER for rules.

Copy link
Q7

docker: Error response from daemon: Get "https://registry-1.docker.io/v2/": dial tcp: lookup registry-1.docker.io: no such host

Intermediate

Likely causes โ†’ DNS failure on the host, proxy needed, or offline.

Diagnose โ†’

bash
getent hosts registry-1.docker.io
resolvectl status
curl -I https://registry-1.docker.io/v2/

Fix โ†’ Repair host DNS, or configure the daemon proxy via systemd drop-in (HTTPS_PROXY), then systemctl daemon-reload && systemctl restart docker.

Prevent โ†’ Use an internal mirror.

Copy link
Q8

After upgrade: Error response from daemon: client version 1.43 is too new. Maximum supported API version is 1.41

Intermediate

Likely causes โ†’ CLI newer than a remote daemon.

Diagnose โ†’ docker version

Fix โ†’ Upgrade the daemon, or temporarily export DOCKER_API_VERSION=1.41.

Prevent โ†’ Keep CLI and engine versions aligned across hosts.

Copy link
Q9

Failed to start docker.service: Unit docker.service is masked.

Beginner

Likely causes โ†’ Service was masked (manually or by a package/Snap change).

Diagnose โ†’ systemctl status docker; systemctl is-enabled docker docker.socket

Fix โ†’ sudo systemctl unmask docker docker.socket && sudo systemctl enable --now docker.

Prevent โ†’ Avoid mixing Snap and apt Docker installs.

Copy link
Q10

docker works with sudo but not in a systemd service running as a different user.

Intermediate

Likely causes โ†’ Service user not in the docker group; supplementary groups not applied, or ProtectHome/sandboxing blocks the socket.

Diagnose โ†’ systemctl show svc -p User -p SupplementaryGroups; sudo -u svcuser docker ps.

Fix โ†’ Add SupplementaryGroups=docker to the unit, restart it.

Prevent โ†’ Use rootless Docker for service users where practical.

Copy link
Q11

Docker Desktop on Windows: Docker Desktop - WSL kernel version too low or WSL 2 not starting.

Intermediate

Likely causes โ†’ Outdated WSL kernel, virtualization disabled in BIOS, or Hyper-V/VirtualMachinePlatform features off.

Diagnose โ†’ wsl --status, wsl --version, Task Manager shows virtualization state.

Fix โ†’ wsl --update, enable "Virtual Machine Platform" and "Windows Subsystem for Linux", enable virtualization in BIOS, reboot.

Prevent โ†’ Keep WSL updated with Windows updates.

Copy link
Q12

docker: Got permission denied when running docker compose in CI under a non-root runner.

Beginner

Likely causes โ†’ Runner user lacks socket access.

Diagnose โ†’ id, ls -l /var/run/docker.sock.

Fix โ†’ Add the runner user to docker group and restart the runner service (groups load at login/start).

Prevent โ†’ Use ephemeral runners with a configured image.

Copy link
Q13

Docker daemon takes 5+ minutes to start with many containers.

Advanced

Likely causes โ†’ Huge number of containers/images/log files, slow disk, live-restore off with many containers to restore, corrupted metadata.

Diagnose โ†’

bash
journalctl -u docker | grep -E 'Loading containers|Restoring'
docker system df
ls /var/lib/docker/containers | wc -l

Fix โ†’ Remove dead containers, prune, move to faster disk, enable live-restore.

Prevent โ†’ Garbage-collect regularly and cap container churn.

Copy link
Q14

docker ps hangs forever.

Advanced

Likely causes โ†’ dockerd or containerd deadlocked, a stuck container/shim, or exhausted resources (PIDs, FDs, disk).

Diagnose โ†’

bash
timeout 10 docker version
systemctl status containerd docker
kill -SIGUSR1 $(pidof dockerd); journalctl -u docker | tail   # goroutine dump
df -h; ps aux | grep -c defunct

Fix โ†’ Restart containerd then docker; kill the stuck shim; reboot if kernel is wedged (D-state processes).

Prevent โ†’ Alert on daemon latency and node pressure.

Copy link
Q15

Error response from daemon: driver failed programming external connectivity on endpoint ... iptables: No chain/target/match by that name

Intermediate

Likely causes โ†’ The DOCKER iptables chain was flushed (firewalld/ufw reload, iptables -F).

Diagnose โ†’ iptables -t nat -L DOCKER -n (chain missing).

Fix โ†’ sudo systemctl restart docker to recreate chains.

Prevent โ†’ Do not flush iptables on Docker hosts; reload firewalld then restart Docker, or put custom rules in DOCKER-USER.

Copy link
Q16

docker-compose: command not found but docker compose is expected.

Beginner

Likely causes โ†’ Compose v1 (docker-compose) is removed; v2 is a CLI plugin invoked as docker compose.

Diagnose โ†’ docker compose version; ls /usr/libexec/docker/cli-plugins.

Fix โ†’ Install docker-compose-plugin package. For legacy scripts add a shim docker-compose that execs docker compose.

Prevent โ†’ Update scripts to the v2 syntax.

Copy link
Q17

docker compose up fails: unknown shorthand flag: 'd' in -d or docker: 'compose' is not a docker command.

Beginner

Likely causes โ†’ Compose plugin missing from this installation (e.g., distro docker.io package).

Diagnose โ†’ docker --help | grep compose; dpkg -l | grep compose.

Fix โ†’ Install docker-compose-plugin from Docker's repo, or the docker-compose-v2 package on Ubuntu.

Prevent โ†’ Install from the official Docker apt/yum repo.

Copy link
Q18

Error response from daemon: OCI runtime create failed: runc create failed: unable to start container process: ... permission denied

Advanced

Likely causes โ†’ Entrypoint file not executable, AppArmor/SELinux denial, noexec mount on the path, or a wrong USER lacking access.

Diagnose โ†’

bash
docker run --rm --entrypoint ls image -l /entrypoint.sh
dmesg | grep -i -E 'apparmor|denied'
mount | grep noexec

Fix โ†’ chmod +x (or COPY --chmod=0755), use a path not on a noexec mount, fix the MAC policy/labels.

Prevent โ†’ Test images in an environment matching production security settings.

Copy link
Q19

docker version shows server Docker Desktop but a script expects Linux engine features such as host networking.

Advanced

Likely causes โ†’ Docker Desktop runs the engine in a VM; host networking and bind mount paths refer to the VM, not the laptop.

Diagnose โ†’ docker info | grep -E 'Operating System|Context'; docker context ls.

Fix โ†’ Enable "host networking" in Desktop settings (supported on recent versions) or publish ports; use host.docker.internal.

Prevent โ†’ Document Desktop vs Linux differences and test in CI on Linux.

Copy link
Q20

Error: failed to solve: failed to read dockerfile: open Dockerfile: no such file or directory

Beginner

Likely causes โ†’ Wrong context path or -f path, filename case, or .dockerignore excluding the Dockerfile.

Diagnose โ†’ ls -la; docker build -f path/Dockerfile path/.

Fix โ†’ Pass correct context and -f; the last arg is the context, not the Dockerfile.

Prevent โ†’ Use docker buildx bake or Compose build.context/dockerfile fields.

Copy link
Q21

After reboot, containers don't come back though --restart always was set.

Intermediate

Likely causes โ†’ docker service not enabled at boot, containers were created before the policy was set, or they were stopped manually with unless-stopped.

Diagnose โ†’

bash
systemctl is-enabled docker
docker inspect -f '{{.HostConfig.RestartPolicy}}' c
journalctl -u docker -b | grep -i restart

Fix โ†’ systemctl enable docker; docker update --restart unless-stopped c.

Prevent โ†’ Define policies in Compose files and test a reboot.

Copy link
Q22

Error response from daemon: Conflict. The container name "/web" is already in use by container ...

Beginner

Likely causes โ†’ An old (possibly stopped) container has that name.

Diagnose โ†’ docker ps -a --filter name=web

Fix โ†’ docker rm -f web or choose another name; use --rm for ephemeral containers.

Prevent โ†’ Let Compose name containers or use --rm.

Copy link
Q23

docker login prints Error saving credentials: error storing credentials - err: exit status 1, out: ... The name org.freedesktop.secrets was not provided

Intermediate

Likely causes โ†’ credsStore set to secretservice or desktop in ~/.docker/config.json but no keyring/secret service is running (headless server).

Diagnose โ†’ cat ~/.docker/config.json

Fix โ†’ Install and use pass with docker-credential-pass, or remove credsStore to store base64 creds (less secure), or use a credential helper for your cloud (ecr-login).

Prevent โ†’ Use short-lived tokens/OIDC in CI.

Copy link
Q24

docker: Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: ... cgroup

Advanced

Likely causes โ†’ cgroup driver mismatch (cgroupfs vs systemd), cgroup v2 not delegated, or rootless without delegation.

Diagnose โ†’

bash
docker info | grep -i 'cgroup'
cat /sys/fs/cgroup/cgroup.controllers
journalctl -u containerd | tail

Fix โ†’ Align on systemd cgroup driver ("exec-opts": ["native.cgroupdriver=systemd"]), enable delegation for rootless (/etc/systemd/system/[email protected]/delegate.conf).

Prevent โ†’ Use consistent runtime configuration across Kubernetes/Docker nodes.

Copy link
Q25

docker context use remote then Cannot connect to the Docker daemon at ssh://...

Intermediate

Likely causes โ†’ SSH key/host-key problems, remote user lacks docker access, or docker binary absent on the remote PATH for non-interactive shells.

Diagnose โ†’

bash
ssh user@host docker ps
docker --context remote info
ssh -v user@host true

Fix โ†’ Add the key to ssh-agent, add the user to docker group, ensure PATH includes docker in ~/.bashrc (non-interactive part).

Prevent โ†’ Use ControlMaster in ssh config for speed and reliability.

Copy link

Build failures and cache problems

๐ŸŽฅ Learn this hands-on with DevOps Shack โ†’ YouTube @devopsshack ยท Hindi @shackverse ยท Courses at devopsshack.com

Q26

failed to solve: process "/bin/sh -c apt-get install -y curl" did not complete successfully: exit code: 100 with E: Unable to locate package curl

Beginner

Likely causes โ†’ Package index missing because apt-get update is in a separate cached layer or was never run (images ship without lists).

Diagnose โ†’ Re-run with docker build --progress=plain --no-cache ..

Fix โ†’ RUN apt-get update && apt-get install -y --no-install-recommends curl && rm -rf /var/lib/apt/lists/*.

Prevent โ†’ Always chain update and install.

Copy link
Q27

E: Failed to fetch http://deb.debian.org/... 404 Not Found during build of an old image.

Intermediate

Likely causes โ†’ Base release is EOL and moved to archive (e.g., Debian buster, Ubuntu EOL), or a stale cached layer.

Diagnose โ†’ cat /etc/os-release in the image; check the release EOL date.

Fix โ†’ Upgrade base (bookworm), or point sources to archive.debian.org as a stopgap.

Prevent โ†’ Track base EOL dates; use Renovate.

Copy link
Q28

COPY failed: file not found in build context or excluded by .dockerignore: stat app.jar: file does not exist

Beginner

Likely causes โ†’ File not built yet, path relative to wrong context, or .dockerignore excludes it (*.jar, target).

Diagnose โ†’

bash
cat .dockerignore
docker build --progress=plain .
ls target/

Fix โ†’ Build artifact first or use multi-stage, fix path, add !target/app.jar exception.

Prevent โ†’ Use multi-stage builds so artifacts come from a prior stage.

Copy link
Q29

ERROR: failed to solve: failed to compute cache key: "/requirements.txt" not found: not found

Beginner

Likely causes โ†’ The file isn't in the context root, a .dockerignore pattern, or building from the wrong directory.

Diagnose โ†’ docker build -f services/api/Dockerfile services/api vs .

Fix โ†’ Align the context with the COPY paths.

Prevent โ†’ Document the build context in the Makefile or Compose file.

Copy link
Q30

Build hangs at RUN pip install ... or npm install and eventually times out.

Intermediate

Likely causes โ†’ No network from build (proxy, DNS), MTU mismatch on VPN or cloud overlay, or registry outage.

Diagnose โ†’

bash
docker run --rm busybox wget -qO- https://pypi.org/simple/ | head
docker run --rm busybox ping -c1 8.8.8.8
ip link show docker0 | grep mtu

Fix โ†’ Set proxies; lower MTU in daemon.json ("mtu": 1400); set DNS servers.

Prevent โ†’ Use an internal package mirror.

Copy link
Q31

failed to solve: rpc error: code = Unknown desc = failed to solve with frontend dockerfile.v0: failed to create LLB definition: dockerfile parse error on line 12: unknown instruction: RUNN

Beginner

Likely causes โ†’ Typo, or a missing line continuation backslash making the next line an instruction.

Diagnose โ†’ Check the stated line; hadolint Dockerfile.

Fix โ†’ Correct the instruction; ensure \ at end of continued lines with no trailing spaces after it.

Prevent โ†’ Lint in CI and use an editor with Dockerfile support.

Copy link
Q32

Build works locally but fails in CI with exec format error in a RUN step.

Intermediate

Likely causes โ†’ Architecture mismatch (arm64 base layers on amd64 runner or vice versa), or QEMU binfmt not registered for cross-platform builds.

Diagnose โ†’

bash
docker image inspect base --format '{{.Architecture}}'
uname -m
docker buildx ls

Fix โ†’ Specify --platform, install QEMU: docker run --privileged --rm tonistiigi/binfmt --install all.

Prevent โ†’ Build multi-arch explicitly and test on both arches.

Copy link
Q33

Layer cache is never used though nothing changed (every step rebuilds).

Advanced

Likely causes โ†’ Fresh CI runner, --no-cache, ARG with changing value (e.g. BUILD_DATE) declared early, COPY . . including changing files, or builder pruned.

Diagnose โ†’ docker buildx build --progress=plain .; diff docker history of two builds.

Fix โ†’ Move volatile ARGs to the end, ignore generated files, add registry cache.

Prevent โ†’ Treat cache hit rate as a metric.

Copy link
Q34

ERROR: failed to solve: failed to fetch anonymous token: ... 429 Too Many Requests

Intermediate

Likely causes โ†’ Docker Hub rate limit on anonymous pulls of base images.

Diagnose โ†’ curl -s -I -H "Authorization: Bearer $TOKEN" https://registry-1.docker.io/v2/ratelimitpreview/test/manifests/latest and read ratelimit-remaining.

Fix โ†’ docker login, use mirror/pull-through cache, switch to registry mirror images.

Prevent โ†’ Mirror base images internally.

Copy link
Q35

failed to solve: failed to read expected number of bytes: unexpected EOF or no space left on device during build.

Advanced

Likely causes โ†’ Disk full on the builder, huge build context, or a flaky network.

Diagnose โ†’

bash
df -h /var/lib/docker
docker buildx du
docker system df

Fix โ†’ docker builder prune -af --keep-storage 20GB, docker image prune -a, enlarge disk.

Prevent โ†’ Set BuildKit GC limits and monitor disk.

Copy link
Q36

ARG value is empty during RUN: echo $VERSION prints nothing.

Intermediate

Likely causes โ†’ ARG declared before FROM (out of stage scope), declared in a previous stage, or not passed with --build-arg.

Diagnose โ†’ Read the Dockerfile; run with --progress=plain.

Fix โ†’ Redeclare ARG VERSION after FROM in the stage that needs it; pass --build-arg VERSION=1.2.

Prevent โ†’ Keep ARG declarations next to usage.

Copy link
Q37

unable to prepare context: path "." not found or build context transfer is 3 GB and takes forever.

Beginner

Likely causes โ†’ Context includes node_modules, .git, datasets, or you ran the build in the home directory.

Diagnose โ†’ du -sh * | sort -h | tail; BuildKit prints transferring context: 3.1GB.

Fix โ†’ Build from the project directory, add .dockerignore.

Prevent โ†’ Allow-list style ignore: * then !src.

Copy link
Q38

Multi-stage build error: COPY --from=builder /app/dist ...: not found

Intermediate

Likely causes โ†’ Wrong path in builder, build step silently output elsewhere, stage name typo, or different WORKDIR.

Diagnose โ†’

bash
docker build --target builder -t dbg .
docker run --rm dbg find / -name dist -maxdepth 4

Fix โ†’ Correct the path or WORKDIR; fail the build if artifacts are missing (RUN test -f /app/dist/index.js).

Prevent โ†’ Add artifact checks after build steps.

Copy link
Q39

The command '/bin/sh -c ./gradlew build' returned a non-zero code: 126

Intermediate

Likely causes โ†’ Script lacks execute bit (common when copied from Windows), or CRLF line endings (/bin/sh^M: bad interpreter).

Diagnose โ†’ ls -l gradlew; file gradlew; head -1 gradlew | od -c.

Fix โ†’ chmod +x gradlew (or COPY --chmod=755), dos2unix, set .gitattributes * text=auto eol=lf for shell scripts.

Prevent โ†’ .gitattributes for *.sh text eol=lf.

Copy link
Q40

standard_init_linux.go: exec user process caused: no such file or directory for an existing binary.

Advanced

Likely causes โ†’ Missing dynamic loader or interpreter: glibc binary on Alpine/scratch, or shebang #!/bin/bash where bash does not exist, or CRLF in shebang.

Diagnose โ†’

bash
file app; ldd app
docker run --rm --entrypoint sh image -c 'head -1 /entrypoint.sh'

Fix โ†’ Build statically (CGO_ENABLED=0), use a matching base (distroless base/cc), install bash or use #!/bin/sh.

Prevent โ†’ Test the final image, not just the build stage.

Copy link
Q41

Build secret mount fails: failed to solve: secret "npmrc" not found

Intermediate

Likely causes โ†’ --secret id=npmrc,src=... not passed, ID mismatch, or running with legacy builder.

Diagnose โ†’ Compare id= in the Dockerfile and CLI; check DOCKER_BUILDKIT.

Fix โ†’ docker build --secret id=npmrc,src=$HOME/.npmrc .; in Compose define build.secrets.

Prevent โ†’ Add a header # syntax=docker/dockerfile:1 and use BuildKit everywhere.

Copy link
Q42

docker build succeeds, but the image runs old code.

Intermediate

Likely causes โ†’ The container was not recreated, a different tag is running, cache reused a stale COPY layer (rare), or Compose image: pulls an older tag.

Diagnose โ†’

bash
docker images --digests app
docker inspect -f '{{.Image}}' running_container

Fix โ†’ docker compose up -d --build --force-recreate; tag explicitly.

Prevent โ†’ Deploy by digest/immutable tags.

Copy link
Q43

ERROR: failed to solve: dockerfile.v0: failed to resolve source metadata for docker.io/library/node:22-alpine: ... x509: certificate signed by unknown authority

Intermediate

Likely causes โ†’ Corporate TLS inspection proxy; the CA isn't trusted by the daemon/BuildKit.

Diagnose โ†’ openssl s_client -connect registry-1.docker.io:443 -showcerts

Fix โ†’ Install the corporate CA into the host trust store (update-ca-certificates) and restart docker; for docker-container buildx driver pass --config buildkitd.toml with CA; inside images add CA for RUN downloads.

Prevent โ†’ Distribute CA through config management.

Copy link
Q44

buildx error: ERROR: multiple platforms feature is currently not supported for docker driver

Intermediate

Likely causes โ†’ Default docker driver without containerd image store cannot build multi-platform images.

Diagnose โ†’ docker buildx ls

Fix โ†’ docker buildx create --use --driver docker-container, or enable the containerd image store in Docker Desktop/Engine settings.

Prevent โ†’ CI uses a dedicated builder.

Copy link
Q45

--load with multiple platforms fails: docker exporter does not currently support exporting manifest lists

Intermediate

Likely causes โ†’ Local classic image store can hold only one platform.

Diagnose โ†’ docker buildx build --platform linux/amd64,linux/arm64 --load . triggers the error.

Fix โ†’ Use --push, or --output type=oci,dest=app.tar, or build one platform with --load; or enable containerd image store.

Prevent โ†’ Test per-platform locally, push multi-arch in CI.

Copy link
Q46

npm ERR! code ELIFECYCLE building native modules on Alpine (gyp ERR! find Python).

Intermediate

Likely causes โ†’ Alpine lacks python3, make, g++ needed by node-gyp.

Diagnose โ†’ Read the full npm log with --progress=plain.

Fix โ†’ apk add --no-cache python3 make g++ in the build stage only, or switch to node:22-slim.

Prevent โ†’ Do native compiles in a builder stage, copy artifacts.

Copy link
Q47

HEALTHCHECK is missing from an image built with Podman/Buildah.

Intermediate

Likely causes โ†’ Buildah defaults to OCI format which does not support HEALTHCHECK.

Diagnose โ†’ podman inspect image | jq '.[0].Config.Healthcheck'

Fix โ†’ podman build --format docker . or define the check at runtime.

Prevent โ†’ Standardise on --format docker where health checks matter.

Copy link
Q48

Dockerfile RUN --mount=type=cache is ignored/errors: the --mount option requires BuildKit

Beginner

Likely causes โ†’ Legacy builder in use (old Docker, DOCKER_BUILDKIT=0).

Diagnose โ†’ docker version; echo $DOCKER_BUILDKIT.

Fix โ†’ Upgrade to Docker 23+ (BuildKit default) or DOCKER_BUILDKIT=1; add the # syntax= line.

Prevent โ†’ Pin builder tooling in CI.

Copy link
Q49

Error: buildx failed with: ERROR: failed to solve: failed to push registry/app:tag: unexpected status: 401 Unauthorized

Beginner

Likely causes โ†’ Not logged in as the user running the build (credentials come from the client's ~/.docker/config.json), token lacks push scope, or the repository does not exist.

Diagnose โ†’ docker login reg; cat ~/.docker/config.json; check token scopes.

Fix โ†’ Log in before building, grant write permission, create the repository (ECR).

Prevent โ†’ Use OIDC with least-privilege push roles.

Copy link
Q50

--cache-from type=gha shows no cache hits in GitHub Actions.

Advanced

Likely causes โ†’ Cache scope differs per workflow/branch, cache evicted (10 GB repo limit), mode=max not set, or the Dockerfile changes early layers, or the cache backend isn't configured because the Actions runtime token isn't exposed to the step.

Diagnose โ†’ Look for importing cache manifest from gha in logs; check the Actions cache UI.

Fix โ†’ Use scope=, mode=max, use docker/build-push-action with docker/setup-buildx-action, or switch to registry cache.

Prevent โ†’ Keep a stable early-layer structure.

Copy link

Containers that exit, crash or misbehave

๐ŸŽฅ Learn this hands-on with DevOps Shack โ†’ YouTube @devopsshack ยท Hindi @shackverse ยท Courses at devopsshack.com

Q51

Container exits immediately with code 0 right after docker run -d.

Beginner

Likely causes โ†’ The main process finished (a shell with no TTY, a script that ends, a daemon that forks into the background).

Diagnose โ†’

bash
docker ps -a
docker logs c
docker inspect -f '{{.Config.Cmd}} {{.Config.Entrypoint}}' c

Fix โ†’ Run the service in the foreground (nginx -g 'daemon off;'), or use -it for shells. A container lives as long as PID 1.

Prevent โ†’ Use images whose CMD is a foreground process.

Copy link
Q52

Exited (137) with no OOM flag.

Intermediate

Likely causes โ†’ SIGKILL: docker kill, a stop timeout expiry, host OOM killer (outside cgroup limit), or an orchestrator eviction.

Diagnose โ†’

bash
docker inspect -f '{{.State.OOMKilled}} {{.State.ExitCode}}' c
dmesg -T | grep -i -E 'killed process|oom'
docker events --since 1h --filter container=c

Fix โ†’ If host OOM, add memory or limits; if timeout, handle SIGTERM and raise --stop-timeout.

Prevent โ†’ Set memory limits so the kernel kills inside the cgroup, not randomly on the host.

Copy link
Q53

Exited (139) segmentation fault.

Advanced

Likely causes โ†’ Binary built for different libc (glibc vs musl) or CPU features, native module crash, emulated amd64 on arm64 running a JIT, or a genuine app bug.

Diagnose โ†’

bash
docker run --rm --entrypoint sh image -c 'uname -m; ldd /app/bin'
docker run --platform linux/amd64 ...
dmesg | grep segfault

Fix โ†’ Match base and architecture, rebuild native modules, enable core dumps (--ulimit core=-1) and analyze with gdb.

Prevent โ†’ Test images on the real target architecture.

Copy link
Q54

Exited (126) / Exited (127).

Beginner

Likely causes โ†’ 126: command found but not executable; 127: command not found (or missing shebang interpreter).

Diagnose โ†’ docker run --rm --entrypoint sh image -c 'ls -l /app; which myapp'

Fix โ†’ chmod +x, correct the PATH/absolute path, install the missing binary, fix CRLF.

Prevent โ†’ Use exec form with absolute paths and add a smoke test.

Copy link
Q55

exec /entrypoint.sh: exec format error

Intermediate

Likely causes โ†’ Script lacks a shebang, or image architecture differs from host (arm64 image on amd64).

Diagnose โ†’

bash
docker image inspect image -f '{{.Os}}/{{.Architecture}}'
docker run --rm --entrypoint head image -1 /entrypoint.sh

Fix โ†’ Add #!/bin/sh, pull the right --platform, build multi-arch.

Prevent โ†’ Publish multi-arch manifests.

Copy link
Q56

docker run says WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and the app is very slow.

Beginner

Likely causes โ†’ Running amd64 image under emulation on Apple Silicon.

Diagnose โ†’ docker image inspect img -f '{{.Architecture}}'; docker info | grep Architecture.

Fix โ†’ Pull a native arm64 variant (--platform linux/arm64), rebuild multi-arch, or enable Rosetta in Docker Desktop.

Prevent โ†’ Ship multi-arch images.

Copy link
Q57

App crashes with Error: listen EADDRINUSE: address already in use :::3000 inside the container.

Beginner

Likely causes โ†’ Two processes in the container on the same port (e.g. nodemon plus a second start), or a restarted process before the old one released the port.

Diagnose โ†’ docker exec c ss -tlnp (or netstat), docker top c.

Fix โ†’ Run a single process, fix the dev script, use --init to reap.

Prevent โ†’ One process per container.

Copy link
Q58

Container works with docker run -it but fails when started detached with -d.

Intermediate

Likely causes โ†’ The app expects a TTY or stdin (interactive prompts), or reads from stdin and gets EOF.

Diagnose โ†’ docker logs c; compare with docker run -d -t.

Fix โ†’ Provide config non-interactively, use -t/-i only if truly needed, or tail -f /dev/null for dev placeholder (not prod).

Prevent โ†’ Make apps non-interactive.

Copy link
Q59

docker exec returns OCI runtime exec failed: exec failed: unable to start container process: exec: "bash": executable file not found in $PATH

Beginner

Likely causes โ†’ Alpine/distroless/slim image without bash.

Diagnose โ†’ docker exec c sh -c 'cat /etc/os-release'

Fix โ†’ Use sh, or docker debug c, or attach a debug container sharing namespaces.

Prevent โ†’ Do not depend on bash in minimal images.

Copy link
Q60

docker exec fails with cannot exec in a stopped container or container is not running.

Beginner

Likely causes โ†’ Container crashed or exited.

Diagnose โ†’ docker ps -a, docker logs c, docker inspect -f '{{.State.Error}}' c.

Fix โ†’ Find out why it exited; to inspect its filesystem use docker cp c:/path . or docker run --rm -it --entrypoint sh image.

Prevent โ†’ Alert on restart count.

Copy link
Q61

Environment variable set with -e but the app doesn't see it.

Intermediate

Likely causes โ†’ Flag placed after the image name (treated as command args), typo, entrypoint script sanitises env, app reads a config file instead.

Diagnose โ†’

bash
docker exec c env | sort
docker inspect -f '{{.Config.Env}}' c

Fix โ†’ docker run -e FOO=bar image (options before image). Check how the app reads variables.

Prevent โ†’ Print effective config on startup (without secrets).

Copy link
Q62

docker run argument is ignored: docker run image --port 9000 fails with unknown flag.

Intermediate

Likely causes โ†’ Args after the image replace CMD entirely (and are appended to ENTRYPOINT).

Diagnose โ†’ docker inspect -f '{{.Config.Entrypoint}} {{.Config.Cmd}}' image

Fix โ†’ Pass the full command (image app --port 9000) when only CMD is defined; with ENTRYPOINT pass only the extra args; override with --entrypoint.

Prevent โ†’ Document the entrypoint contract.

Copy link
Q63

PID 1 app doesn't reload on SIGHUP or ignores Ctrl+C in docker run -it.

Advanced

Likely causes โ†’ PID 1 has no default signal handlers; a signal without a handler is ignored.

Diagnose โ†’ docker exec c cat /proc/1/status | grep -E 'SigCgt|SigIgn'

Fix โ†’ Run --init, or have the app install handlers (Node: process.on('SIGTERM')).

Prevent โ†’ Test docker stop time in CI.

Copy link
Q64

Container shows Up but the app returns 502 / connection refused from the host on published port.

Intermediate

Likely causes โ†’ App listens on 127.0.0.1 inside the container instead of 0.0.0.0, wrong container port, or the app hasn't finished booting.

Diagnose โ†’

bash
docker exec c ss -tlnp
docker port c
curl -v localhost:8080

Fix โ†’ Bind the app to 0.0.0.0 (e.g. flask run --host 0.0.0.0) and publish the right port.

Prevent โ†’ Add a health check hitting the published path.

Copy link
Q65

standard_init_linux.go:228: exec user process caused: exec format error on a Raspberry Pi.

Intermediate

Likely causes โ†’ Image is amd64 only.

Diagnose โ†’ uname -m; docker manifest inspect image | jq '.manifests[].platform'.

Fix โ†’ Use an image with linux/arm64 or linux/arm/v7, or rebuild with buildx.

Prevent โ†’ Publish multi-arch images.

Copy link
Q66

Container time/zone is wrong in logs.

Beginner

Likely causes โ†’ Containers default to UTC and slim images lack tzdata.

Diagnose โ†’ docker exec c date; docker exec c ls /usr/share/zoneinfo | head.

Fix โ†’ Install tzdata and set TZ, or mount /etc/localtime:ro.

Prevent โ†’ Log in UTC and convert at display time.

Copy link
Q67

Error: Cannot find module in container but works on the host.

Intermediate

Likely causes โ†’ node_modules excluded by .dockerignore but npm install not run, a bind mount shadowing /app/node_modules, or platform-specific native modules built on the host.

Diagnose โ†’

bash
docker run --rm image ls /app/node_modules | head
docker inspect -f '{{json .Mounts}}' c

Fix โ†’ Install dependencies in the image, mask node_modules with a named volume when bind mounting, never copy host node_modules.

Prevent โ†’ .dockerignore with node_modules and npm ci in the Dockerfile.

Copy link
Q68

Python app prints nothing to docker logs until the container stops.

Intermediate

Likely causes โ†’ stdout buffering when not attached to a TTY.

Diagnose โ†’ Compare docker run -t vs -d.

Fix โ†’ ENV PYTHONUNBUFFERED=1 or python -u; configure logging handlers to stream.

Prevent โ†’ Set the variable in the base image.

Copy link
Q69

OCI runtime create failed: ... mount: /proc: permission denied or similar from nested containers.

Advanced

Likely causes โ†’ Running containers inside a restricted container/LXC/CI sandbox without needed capabilities or with masked /proc.

Diagnose โ†’ cat /proc/self/status | grep Cap; check the outer environment's security profile.

Fix โ†’ Use a runtime that supports nesting (Sysbox), enable nesting in LXC, or use rootless with proper setup.

Prevent โ†’ Prefer daemonless/remote builds over nested runtimes.

Copy link
Q70

Container cannot write to a mounted directory: Permission denied / EACCES.

Intermediate

Likely causes โ†’ UID mismatch between container user and host directory owner, read-only mount (:ro), SELinux label missing, or read-only root filesystem.

Diagnose โ†’

bash
docker exec c id
ls -ln /host/dir
docker inspect -f '{{json .Mounts}}' c
ls -Z /host/dir   # SELinux

Fix โ†’ chown to the container UID, run with --user, add :z/:Z, drop :ro.

Prevent โ†’ Define fixed numeric UIDs.

Copy link
Q71

Application can't resolve its own hostname or sudo: unable to resolve host.

Intermediate

Likely causes โ†’ Custom --hostname or --network host produce mismatched /etc/hosts; or /etc/hosts overwritten.

Diagnose โ†’ docker exec c cat /etc/hosts; hostname

Fix โ†’ Use --add-host name:ip, don't edit /etc/hosts manually (it's regenerated on start).

Prevent โ†’ Rely on DNS names, not hosts files.

Copy link
Q72

After docker stop a container takes exactly 10 seconds every time.

Beginner

Likely causes โ†’ Process ignores SIGTERM (shell form entrypoint, PID 1 without handler).

Diagnose โ†’ docker inspect -f '{{.Config.Entrypoint}} {{.Config.Cmd}}' c; docker exec c ps.

Fix โ†’ Exec form, exec "$@" in scripts, --init, or docker stop -t.

Prevent โ†’ Measure stop time in smoke tests.

Copy link
Q73

Debug a container that crashes before you can exec into it.

Intermediate

Likely causes โ†’ Startup error.

Diagnose โ†’

bash
docker logs --tail 200 c
docker run --rm -it --entrypoint sh image
docker commit c debug-img && docker run --rm -it --entrypoint sh debug-img
docker run --rm -it --volumes-from c --entrypoint sh image

Fix โ†’ Reproduce with the same env and mounts, run the entrypoint manually (sh -x /entrypoint.sh).

Prevent โ†’ Make entrypoints verbose on error and log configuration validation.

Copy link
Q74

docker cp fails: Error: No such container:path or copies nothing from a volume path.

Intermediate

Likely causes โ†’ Wrong path, the path is a tmpfs mount (not supported by docker cp), or the container doesn't exist.

Diagnose โ†’ docker exec c ls -l /path; docker inspect -f '{{json .Mounts}}' c.

Fix โ†’ Copy from a regular path, or use a helper container with --volumes-from; use docker exec c tar c ... | tar x.

Prevent โ†’ Know which paths are tmpfs.

Copy link
Q75

unable to find image 'myapp:latest' locally followed by pull access denied for myapp, repository does not exist or may require 'docker login'

Beginner

Likely causes โ†’ Image was never built locally (or built with another tag/context), or the name lacks a registry prefix and Docker tries Docker Hub.

Diagnose โ†’ docker images | grep myapp; docker context ls (maybe building on a different daemon).

Fix โ†’ Build with -t myapp:latest against the same daemon, or use the full name reg.example.com/team/myapp:latest.

Prevent โ†’ Consistent naming and DOCKER_HOST awareness.

Copy link

Networking, DNS and Compose

๐ŸŽฅ Learn this hands-on with DevOps Shack โ†’ YouTube @devopsshack ยท Hindi @shackverse ยท Courses at devopsshack.com

Q76

curl: (7) Failed to connect to localhost port 8080: Connection refused after docker run -p 8080:80 nginx.

Beginner

Likely causes โ†’ Container not running, mapping reversed (-p 80:8080), app listening on another port or only on loopback, or the request is from another host while docker is remote.

Diagnose โ†’

bash
docker ps
docker port web
docker exec web ss -tlnp
ss -tlnp | grep 8080

Fix โ†’ Use -p hostPort:containerPort correctly, bind 0.0.0.0 in the app.

Prevent โ†’ Verify with docker port after starting.

Copy link
Q77

Bind for 0.0.0.0:5432 failed: port is already allocated

Beginner

Likely causes โ†’ Another container or host process uses that port.

Diagnose โ†’

bash
sudo ss -tlnp | grep 5432
docker ps --format '{{.Names}} {{.Ports}}' | grep 5432

Fix โ†’ Stop the other process, or map another host port (-p 5433:5432), or drop the publish.

Prevent โ†’ Don't publish DB ports; use internal networks.

Copy link
Q78

Containers cannot reach the internet: Temporary failure in name resolution

Advanced

Likely causes โ†’ DNS config (host uses 127.0.0.53 stub), IP forwarding off, firewall blocking forward, or VPN conflict.

Diagnose โ†’

bash
docker run --rm busybox nslookup google.com
docker run --rm busybox ping -c1 1.1.1.1
sysctl net.ipv4.ip_forward
iptables -t nat -L POSTROUTING -n | grep MASQ

Fix โ†’ Set "dns": ["1.1.1.1"] or corp DNS in daemon.json; enable net.ipv4.ip_forward=1; restart docker.

Prevent โ†’ Standardize host DNS and forwarding sysctls.

Copy link
Q79

ping works to IPs but DNS names fail on the default bridge: ping: bad address 'db'

Beginner

Likely causes โ†’ Default bridge has no name-based discovery.

Diagnose โ†’ docker network inspect bridge.

Fix โ†’ Use a user-defined network or Compose.

Prevent โ†’ Never rely on the default bridge.

Copy link
Q80

getaddrinfo ENOTFOUND db in a Compose app.

Beginner

Likely causes โ†’ Service name typo, services on different networks, or the DB container exited.

Diagnose โ†’

bash
docker compose ps
docker compose exec api getent hosts db
docker network inspect <project>_default

Fix โ†’ Use the exact service name, put services on a shared network, fix the DB crash.

Prevent โ†’ Define networks explicitly and add health-gated depends_on.

Copy link
Q81

Compose: service "api" depends on undefined service "db"

Beginner

Likely causes โ†’ Service missing, defined under a profile that isn't active, or in an un-merged override file.

Diagnose โ†’ docker compose config --services; docker compose --profile x config.

Fix โ†’ Define the service or activate the profile; pass all -f files.

Prevent โ†’ Run docker compose config in CI.

Copy link
Q82

Compose: yaml: line 14: mapping values are not allowed in this context

Beginner

Likely causes โ†’ Indentation/tab error, missing space after colon, or unquoted special characters (: in values, @, *).

Diagnose โ†’ docker compose config; yamllint compose.yaml.

Fix โ†’ Use spaces only, quote strings like "8080:80", "${VAR:-x}".

Prevent โ†’ Editor YAML linting.

Copy link
Q83

Compose: The "DB_PASSWORD" variable is not set. Defaulting to a blank string.

Beginner

Likely causes โ†’ .env missing/not in the project dir, variable only exported in a different shell, or typo.

Diagnose โ†’ docker compose config | grep -i password; ls -la .env.

Fix โ†’ Create .env next to compose file or use --env-file; require it with ${DB_PASSWORD:?missing}.

Prevent โ†’ Fail fast using :? syntax.

Copy link
Q84

Error response from daemon: network xxx not found on docker compose up.

Intermediate

Likely causes โ†’ A network was removed outside Compose while containers still reference it.

Diagnose โ†’ docker network ls; docker compose ps -a.

Fix โ†’ docker compose down then up -d (or up --force-recreate).

Prevent โ†’ Don't delete networks manually; use docker compose down.

Copy link
Q85

Error response from daemon: Pool overlaps with other one on this address space

Advanced

Likely causes โ†’ A custom subnet collides with an existing network or host route.

Diagnose โ†’

bash
docker network ls -q | xargs docker network inspect -f '{{.Name}} {{range .IPAM.Config}}{{.Subnet}}{{end}}'
ip route

Fix โ†’ Choose a free subnet, remove unused networks, set default-address-pools.

Prevent โ†’ Central IP plan for Docker ranges.

Copy link
Q86

could not find an available, non-overlapping IPv4 address pool among the defaults to assign to the network

Intermediate

Likely causes โ†’ Too many networks (each Compose project takes a /16 by default) have exhausted the default pools.

Diagnose โ†’ docker network ls | wc -l

Fix โ†’ docker network prune; configure smaller pools: "default-address-pools":[{"base":"10.10.0.0/16","size":24}].

Prevent โ†’ Use /24 pools and clean up CI networks.

Copy link
Q87

Container-to-container requests fail intermittently by name after a container restarts.

Advanced

Likely causes โ†’ Client (nginx, JVM) cached the old IP; DNS TTL and resolver caches ignore the new address.

Diagnose โ†’ docker exec web getent hosts api vs the IP in nginx upstream; docker network inspect.

Fix โ†’ In nginx use resolver 127.0.0.11 valid=10s; with variable in proxy_pass; JVM networkaddress.cache.ttl=10; or reload nginx.

Prevent โ†’ Configure resolver behaviour when using dynamic backends.

Copy link
Q88

Published port is reachable from the internet though ufw denies it.

Advanced

Likely causes โ†’ Docker's DNAT rules bypass ufw's INPUT rules.

Diagnose โ†’ iptables -t nat -S DOCKER; scan with nmap -p 8080 host.

Fix โ†’ Bind 127.0.0.1:8080:80, or add rules to DOCKER-USER, or use ufw-docker tooling, or set "iptables": false (with caution).

Prevent โ†’ Publish only what needs to be public.

Copy link
Q89

Access from container to host service fails: connection refused host.docker.internal on Linux.

Intermediate

Likely causes โ†’ Name not defined on Linux by default, or the host service binds only to 127.0.0.1, or a firewall blocks the bridge interface.

Diagnose โ†’

bash
docker run --rm --add-host host.docker.internal:host-gateway busybox getent hosts host.docker.internal
ss -tlnp | grep <port>

Fix โ†’ Add extra_hosts, bind the service to 0.0.0.0 or the bridge IP, allow docker0 in the firewall.

Prevent โ†’ Prefer running dependencies as containers.

Copy link
Q90

Slow DNS: every outbound call in the container takes 5 seconds.

Advanced

Likely causes โ†’ AAAA lookups failing or timing out (no IPv6), conntrack race on UDP DNS, unreachable first resolver, ndots:5 search-list expansion.

Diagnose โ†’

bash
docker exec c cat /etc/resolv.conf
docker exec c sh -c 'time getent hosts example.com'
tcpdump -ni any port 53

Fix โ†’ Remove dead resolvers, use options single-request-reopen, set --dns-opt ndots:1, use fully qualified names with trailing dot, disable IPv6 where unused.

Prevent โ†’ Run a local caching resolver.

Copy link
Q91

Error response from daemon: user specified IP address is supported only when connecting to networks with user configured subnets

Intermediate

Likely causes โ†’ --ip used on the default bridge.

Diagnose โ†’ docker network inspect <net> | jq '.[0].IPAM'

Fix โ†’ Create a network with --subnet and attach to it.

Prevent โ†’ Avoid static IPs.

Copy link
Q92

Inter-host overlay network: containers on different nodes cannot ping.

Advanced

Likely causes โ†’ Firewall blocks 4789/udp (VXLAN), 7946, 2377; MTU too high; clock skew; cloud security groups.

Diagnose โ†’

bash
docker node ls
nc -zvu node2 4789
ss -ulnp | grep 4789
docker network inspect <overlay>

Fix โ†’ Open ports between nodes, lower overlay MTU (--opt com.docker.network.driver.mtu=1450), sync time.

Prevent โ†’ Provision security groups via IaC.

Copy link
Q93

docker compose up creates new network every time and docker network ls is full of them.

Beginner

Likely causes โ†’ Changing project name (-p, directory names, COMPOSE_PROJECT_NAME) between runs, or CI jobs leaving networks behind.

Diagnose โ†’ docker network ls --filter label=com.docker.compose.project.

Fix โ†’ Use docker compose down in cleanup; docker network prune; fix the project name.

Prevent โ†’ Set name: at the top of compose.yaml.

Copy link
Q94

Port mapping works on host but not from another machine on the LAN.

Intermediate

Likely causes โ†’ Bound to 127.0.0.1, cloud security group/firewall blocking, wrong IP.

Diagnose โ†’ docker port c; ss -tlnp; curl from another host; nc -zv ip port.

Fix โ†’ Publish on 0.0.0.0 (or remove the 127.0.0.1 prefix) and open the firewall.

Prevent โ†’ Document intended exposure.

Copy link
Q95

Websocket / long-lived connections drop through the Docker proxy after a while.

Advanced

Likely causes โ†’ conntrack/NAT timeouts, idle timeouts at upstream load balancer, missing keepalives.

Diagnose โ†’ conntrack -L | grep <port>; sysctl net.netfilter.nf_conntrack_tcp_timeout_established; check LB idle settings.

Fix โ†’ Enable TCP/app-level keepalives shorter than the timeout, tune idle timeouts, raise conntrack limits.

Prevent โ†’ Application heartbeat.

Copy link
Q96

nginx: [emerg] host not found in upstream "api" in /etc/nginx/conf.d/default.conf:3

Beginner

Likely causes โ†’ nginx started before api was resolvable (not up or different network); nginx resolves upstreams at startup.

Diagnose โ†’ docker compose ps; docker compose exec nginx getent hosts api.

Fix โ†’ Start order with depends_on, same network, or use a resolver 127.0.0.11 plus variable-based proxy_pass.

Prevent โ†’ Health-gated startup.

Copy link
Q97

Connection from container to DB connection reset by peer only under load.

Advanced

Likely causes โ†’ Conntrack table full (nf_conntrack: table full, dropping packet), DB max connections, ephemeral port exhaustion, idle connection killed by NAT.

Diagnose โ†’

bash
dmesg | grep conntrack
sysctl net.netfilter.nf_conntrack_count net.netfilter.nf_conntrack_max
ss -s

Fix โ†’ Raise nf_conntrack_max, use connection pooling, increase port range, tune keepalive.

Prevent โ†’ Monitor conntrack usage.

Copy link
Q98

docker compose up error: Bind for 0.0.0.0:80 failed: port is already allocated while nothing seems to listen.

Intermediate

Likely causes โ†’ A stale docker-proxy or a stopped container still holding the mapping, or another Compose project.

Diagnose โ†’

bash
docker ps -a --filter publish=80
sudo ss -tlnp | grep ':80 '
ps aux | grep docker-proxy

Fix โ†’ Remove the old container (docker rm -f), docker compose down --remove-orphans, restart Docker if the proxy is orphaned.

Prevent โ†’ Use --remove-orphans.

Copy link
Q99

network <name> declared as external, but could not be found

Beginner

Likely causes โ†’ The external network was never created.

Diagnose โ†’ docker network ls | grep <name>.

Fix โ†’ docker network create <name> first; or remove external: true so Compose creates it.

Prevent โ†’ Create shared networks in a bootstrap script.

Copy link
Q100

Container sees the wrong source IP (always the gateway 172.x) behind published ports.

Advanced

Likely causes โ†’ Userland proxy or masquerade replaces client IP, especially on Docker Desktop or with IPv6 to IPv4 translation.

Diagnose โ†’ docker logs web shows 172.18.0.1; check "userland-proxy" setting.

Fix โ†’ Use --network host for the edge proxy, run the reverse proxy on the host, use PROXY protocol or X-Forwarded-For, disable userland-proxy where acceptable.

Prevent โ†’ Terminate TLS at a proxy that adds X-Forwarded-For.

Copy link

Storage, volumes and disk space

๐ŸŽฅ Learn this hands-on with DevOps Shack โ†’ YouTube @devopsshack ยท Hindi @shackverse ยท Courses at devopsshack.com

Q101

no space left on device while pulling an image or starting a container.

Beginner

Likely causes โ†’ /var/lib/docker partition full (images, build cache, logs, volumes) or inodes exhausted.

Diagnose โ†’

bash
df -h /var/lib/docker; df -i /var/lib/docker
docker system df -v

Fix โ†’ docker system prune -a (review first), docker builder prune, truncate huge logs, expand the disk, or move data-root.

Prevent โ†’ Separate disk, log rotation, scheduled pruning and alerts at 80%.

Copy link
Q102

df shows free space but Docker says no space: inodes at 100%.

Advanced

Likely causes โ†’ Millions of small files (node_modules layers, many tiny containers) exhaust inodes.

Diagnose โ†’ df -i; find /var/lib/docker -xdev -printf '%h\n' | sort | uniq -c | sort -rn | head.

Fix โ†’ Prune images/containers, rebuild fs with more inodes (ext4 -N) or use XFS.

Prevent โ†’ Prefer XFS for Docker data and slim images.

Copy link
Q103

/var/lib/docker/containers/<id>/<id>-json.log is 50 GB.

Beginner

Likely causes โ†’ json-file driver without rotation and a chatty app.

Diagnose โ†’ ls -lhS /var/lib/docker/containers/*/*-json.log | head

Fix โ†’ Immediately truncate -s 0 <file>; set max-size/max-file or local driver in daemon.json; recreate containers.

Prevent โ†’ Global log rotation and less verbose logging.

Copy link
Q104

docker system prune did not free much although docker system df shows large "Reclaimable".

Intermediate

Likely causes โ†’ Images still referenced by stopped containers or tags, build cache not included, or volumes need --volumes.

Diagnose โ†’ docker system df -v; docker ps -a.

Fix โ†’ docker container prune, docker image prune -a, docker builder prune -a, docker volume prune (carefully).

Prevent โ†’ Targeted cleanup jobs per resource type.

Copy link
Q105

Volume data disappeared after docker compose down -v or docker volume prune.

Intermediate

Likely causes โ†’ -v deletes named volumes; prune removes unused volumes.

Diagnose โ†’ docker volume ls; check shell history; look for backups.

Fix โ†’ Restore from backup; if none, data is gone (try filesystem snapshot or undelete tools on /var/lib/docker/volumes).

Prevent โ†’ Backups; guard destructive commands; label volumes and use docker volume prune --filter label!=keep.

Copy link
Q106

Data is not persisted: after container recreate the database is empty.

Intermediate

Likely causes โ†’ Wrong mount path, anonymous volume created (image's VOLUME) so a new one appears each time, or Compose project name changed so the volume name differs.

Diagnose โ†’

bash
docker inspect -f '{{json .Mounts}}' db
docker volume ls

Fix โ†’ Mount a named volume at the exact data directory, reuse the same project/volume name (name: in compose volume).

Prevent โ†’ Explicit named volumes with fixed name:.

Copy link
Q107

docker: Error response from daemon: invalid mount config for type "bind": bind source path does not exist

Beginner

Likely causes โ†’ Host path missing (--mount does not create it) or typo; on Docker Desktop, path not shared.

Diagnose โ†’ ls -ld /host/path; Docker Desktop file-sharing settings.

Fix โ†’ Create the directory, fix path, add it to shared paths.

Prevent โ†’ Use $PWD absolute paths and named volumes.

Copy link
Q108

Bind mount of a single file shows stale content after editing it on host.

Intermediate

Likely causes โ†’ Editor replaced the file (new inode) so the container still sees the old inode.

Diagnose โ†’ stat -c %i file before/after save; docker exec c cat file.

Fix โ†’ Mount the parent directory, or restart the container, or edit in place (cat > file).

Prevent โ†’ Mount directories rather than single files.

Copy link
Q109

MySQL/Postgres refuses to start: initdb: error: directory "/var/lib/postgresql/data" exists but is not empty

Advanced

Likely causes โ†’ Volume root contains lost+found (ext4 mount point) or leftover files.

Diagnose โ†’ docker run --rm -v pgdata:/d alpine ls -la /d.

Fix โ†’ Mount a subdirectory: -v pgdata:/var/lib/postgresql/data with PGDATA=/var/lib/postgresql/data/pgdata, or clean the directory if it is truly disposable.

Prevent โ†’ Set PGDATA to a subfolder for block-device mounts.

Copy link
Q110

Postgres: FATAL: data directory "/var/lib/postgresql/data" has wrong ownership

Intermediate

Likely causes โ†’ Host bind mount owned by another UID; permissions not 0700.

Diagnose โ†’ ls -ldn /host/pgdata; docker exec db id postgres.

Fix โ†’ chown -R 999:999 /host/pgdata; chmod 700, or use a named volume.

Prevent โ†’ Prefer named volumes for databases.

Copy link
Q111

docker volume rm says volume is in use.

Beginner

Likely causes โ†’ A running or stopped container still references it.

Diagnose โ†’ docker ps -a --filter volume=<name>

Fix โ†’ docker rm -f those containers, then remove the volume.

Prevent โ†’ Use docker compose down to clean up consistently.

Copy link
Q112

Files created in a bind mount are owned by root on the host.

Intermediate

Likely causes โ†’ Container process runs as root.

Diagnose โ†’ ls -ln; docker exec c id.

Fix โ†’ docker run --user $(id -u):$(id -g); set user: in Compose; use rootless Docker (maps root to your UID).

Prevent โ†’ Run non-root.

Copy link
Q113

SELinux: Permission denied accessing a bind-mounted directory on RHEL/Fedora.

Intermediate

Likely causes โ†’ Host directory has no container_file_t label.

Diagnose โ†’ ls -Z /host/dir; ausearch -m avc -ts recent.

Fix โ†’ Add :z (shared) or :Z (private) to the mount, or chcon -Rt container_file_t /host/dir. Never mount /home or / with :Z.

Prevent โ†’ Keep SELinux enforcing and label volumes.

Copy link
Q114

Slow file I/O on bind mounts with Docker Desktop (npm install, composer).

Intermediate

Likely causes โ†’ File sharing between host and VM adds per-file overhead.

Diagnose โ†’ Compare timing inside container on a named volume vs bind mount.

Fix โ†’ Use VirtioFS, keep dependencies in named volumes, use Compose develop.watch sync.

Prevent โ†’ Store heavy-write paths in volumes.

Copy link
Q115

docker save / docker load fails with unexpected EOF or invalid tar header.

Intermediate

Likely causes โ†’ Truncated transfer, disk full during save, gzip mismatch.

Diagnose โ†’ tar tf image.tar | head; sha256sum on both ends; df -h.

Fix โ†’ Re-save and verify checksums; docker save img | gzip > img.tgz and gunzip -c | docker load.

Prevent โ†’ Verify digests after transfer, or use skopeo copy with oci-archive.

Copy link
Q116

Error response from daemon: failed to mount overlay: ... invalid argument

Advanced

Likely causes โ†’ Backing filesystem lacks d_type support (XFS with ftype=0), unsupported fs (e.g. some NFS, ecryptfs), or overlay kernel module missing.

Diagnose โ†’

bash
docker info | grep -E 'Storage Driver|Backing Filesystem|Supports d_type'
xfs_info /var/lib/docker | grep ftype
lsmod | grep overlay

Fix โ†’ Recreate the filesystem with ftype=1, or move data-root to ext4/XFS local disk, modprobe overlay.

Prevent โ†’ Provision /var/lib/docker with a supported fs.

Copy link
Q117

docker pull fails: failed to register layer: ... no space left on device though df shows space.

Advanced

Likely causes โ†’ Inodes, a quota (pquota/--storage-opt), or the layer extraction temp directory (/var/lib/docker/tmp) on a different small mount.

Diagnose โ†’ df -h /var/lib/docker /var/lib/docker/tmp /tmp; df -i; docker info.

Fix โ†’ Free or expand; set DOCKER_TMPDIR on a larger disk.

Prevent โ†’ Monitor all relevant mounts.

Copy link
Q118

Container writable layer huge: docker ps -s shows SIZE 20GB (virtual 21GB).

Intermediate

Likely causes โ†’ App writes data/logs/temp files into the container FS.

Diagnose โ†’ docker ps -s; docker diff c | head; docker exec c du -xh / | sort -h | tail.

Fix โ†’ Move data to volumes, clean temp files, add log rotation.

Prevent โ†’ Read-only root FS reveals such writes early.

Copy link
Q119

Docker Desktop VM disk is full and docker system prune doesn't shrink the disk image.

Advanced

Likely causes โ†’ The virtual disk (Docker.raw/VHDX) grows but doesn't automatically shrink.

Diagnose โ†’ Desktop Settings > Resources shows usage; docker system df.

Fix โ†’ Prune, then use Desktop's "Clean / Purge data", reduce the disk limit, or compact the VHDX (Optimize-VHD) on Windows.

Prevent โ†’ Set a disk image size limit and prune regularly.

Copy link
Q120

Moving /var/lib/docker to a new disk broke everything: Error starting daemon: ... mkdir ... permission denied.

Advanced

Likely causes โ†’ Copy without preserving ownership/xattrs/SELinux labels, or wrong data-root path.

Diagnose โ†’ journalctl -u docker; ls -ld /newpath; getfattr.

Fix โ†’ systemctl stop docker; rsync -aHAXS /var/lib/docker/ /data/docker/; set "data-root": "/data/docker"; restart.

Prevent โ†’ Use rsync -aHAXS and test on a staging host.

Copy link
Q121

Volume shared via NFS: mount.nfs: access denied by server while mounting.

Intermediate

Likely causes โ†’ Export doesn't allow the client IP, root_squash, wrong NFS version/path.

Diagnose โ†’

bash
showmount -e nfs-server
sudo mount -t nfs4 nfs-server:/exports/app /mnt/test
exportfs -v   # on server

Fix โ†’ Fix /etc/exports, exportfs -ra, correct device and addr in volume options.

Prevent โ†’ Test mounts on every node before deploying.

Copy link
Q122

Database corrupted after the host lost power: PANIC: could not locate a valid checkpoint record.

Advanced

Likely causes โ†’ Unclean shutdown plus storage ignoring fsync (write cache without battery), or copied files from a running DB.

Diagnose โ†’ Check WAL files, disk write-cache settings, filesystem errors in dmesg.

Fix โ†’ Restore from backup/PITR; as a last resort pg_resetwal (data loss risk).

Prevent โ†’ Reliable storage, replication, tested backups, and don't snapshot running DB files without proper tooling.

Copy link
Q123

Image layers listed under /var/lib/docker/overlay2 but not in docker images (orphaned).

Advanced

Likely causes โ†’ Interrupted pulls/builds or daemon crash leaving layer dirs.

Diagnose โ†’ du -sh /var/lib/docker/overlay2; compare with docker system df.

Fix โ†’ docker system prune -a; if still large, stop Docker, back up, and clear /var/lib/docker for a rebuild (images re-pulled, volumes backed up first).

Prevent โ†’ Avoid killing dockerd with SIGKILL; keep disks healthy.

Copy link
Q124

docker run --tmpfs /tmp:size=64m app dies with No space left on device writing temp files.

Beginner

Likely causes โ†’ tmpfs limit too small.

Diagnose โ†’ docker exec c df -h /tmp.

Fix โ†’ Increase size=, or write large temp files to a volume.

Prevent โ†’ Size tmpfs from observed use and remember it consumes memory.

Copy link
Q125

chown: changing ownership of '/var/lib/mysql/...': Operation not permitted at container start.

Intermediate

Likely causes โ†’ Bind mount on NFS with root_squash, a Windows/macOS file share, or rootless user namespaces where chown to a mapped UID is not allowed.

Diagnose โ†’ mount | grep <path>; docker exec c id.

Fix โ†’ Use a named volume, fix export options (no_root_squash or proper UID), or map user: to the owner.

Prevent โ†’ Avoid databases on network/shared filesystems.

Copy link

Registry, pull and push errors

๐ŸŽฅ Learn this hands-on with DevOps Shack โ†’ YouTube @devopsshack ยท Hindi @shackverse ยท Courses at devopsshack.com

Q126

Error response from daemon: pull access denied for X, repository does not exist or may require 'docker login'

Intermediate

Likely causes โ†’ Typo in the name, private repo without login, or a repo that doesn't exist for that tag/namespace.

Diagnose โ†’

bash
docker login
docker manifest inspect X:tag

Fix โ†’ Correct the name (include namespace, e.g. library/ implied for official), log in with an account that has pull rights.

Prevent โ†’ Use full registry paths and test pulls in CI.

Copy link
Q127

manifest for myapp:1.2 not found: manifest unknown: manifest unknown

Beginner

Likely causes โ†’ Tag does not exist (not pushed, deleted by retention policy, typo), or it exists but not for your platform.

Diagnose โ†’ crane ls reg/myapp | grep 1.2; docker buildx imagetools inspect reg/myapp:1.2.

Fix โ†’ Push the tag, rebuild, or use an existing one.

Prevent โ†’ Retention rules protect release tags.

Copy link
Q128

no matching manifest for linux/arm64/v8 in the manifest list entries

Intermediate

Likely causes โ†’ Image published only for amd64.

Diagnose โ†’ docker buildx imagetools inspect image | grep Platform.

Fix โ†’ docker pull --platform linux/amd64 image (emulated), find an arm64 build, or build your own multi-arch.

Prevent โ†’ Publish multi-platform manifests.

Copy link
Q129

x509: certificate signed by unknown authority on docker pull from a private registry.

Intermediate

Likely causes โ†’ Self-signed or internal CA not trusted by the daemon.

Diagnose โ†’ openssl s_client -connect reg.example.com:443 -showcerts </dev/null.

Fix โ†’ Put the CA at /etc/docker/certs.d/reg.example.com/ca.crt (no restart needed) or into the system trust store, then retry.

Prevent โ†’ Use certificates from a trusted CA (ACME, internal PKI distributed to hosts).

Copy link
Q130

http: server gave HTTP response to HTTPS client

Beginner

Likely causes โ†’ Registry serves plain HTTP (e.g. local registry:2) but the client tries HTTPS.

Diagnose โ†’ curl -v http://host:5000/v2/.

Fix โ†’ Enable TLS on the registry (preferred), or add to insecure-registries in daemon.json and restart (non-prod only).

Prevent โ†’ Always terminate TLS at the registry.

Copy link
Q131

unauthorized: authentication required on push to GitHub Container Registry.

Intermediate

Likely causes โ†’ Token lacks write:packages, not logged in to ghcr.io, or repo/package permissions not granting the workflow.

Diagnose โ†’ docker login ghcr.io -u USER; check package settings > Manage Actions access.

Fix โ†’ Use a PAT with write:packages or GITHUB_TOKEN with packages: write permission in the workflow; lowercase the image name.

Prevent โ†’ Grant least privilege explicitly in the workflow permissions:.

Copy link
Q132

ECR: denied: Your authorization token has expired. Reauthenticate and try again.

Beginner

Likely causes โ†’ ECR tokens last 12 hours.

Diagnose โ†’ Check when you logged in.

Fix โ†’

bash
aws ecr get-login-password --region ap-south-1 | \
  docker login --username AWS --password-stdin 123456789012.dkr.ecr.ap-south-1.amazonaws.com

Prevent โ†’ Use amazon-ecr-credential-helper or log in at the start of each job.

Copy link
Q133

ECR push: name unknown: The repository with name 'app' does not exist in the registry

Beginner

Likely causes โ†’ ECR requires the repository to be created first.

Diagnose โ†’ aws ecr describe-repositories.

Fix โ†’ aws ecr create-repository --repository-name app --image-scanning-configuration scanOnPush=true.

Prevent โ†’ Create repos with Terraform.

Copy link
Q134

toomanyrequests: You have reached your pull rate limit

Intermediate

Likely causes โ†’ Anonymous/free-tier Docker Hub limits per IP or account.

Diagnose โ†’ Query the ratelimit-remaining header from the preview endpoint.

Fix โ†’ Authenticate, use a paid org account/PAT, set up a pull-through cache and mirror base images.

Prevent โ†’ Do not pull from Hub in production paths.

Copy link
Q135

Push is very slow or fails with received unexpected HTTP status: 502 Bad Gateway or 413 Request Entity Too Large.

Intermediate

Likely causes โ†’ Reverse proxy in front of the registry limits body size or times out on big layers.

Diagnose โ†’ Proxy logs; curl -v upload test.

Fix โ†’ Nginx: client_max_body_size 0; proxy_request_buffering off; proxy_read_timeout 900; and required headers for registry.

Prevent โ†’ Use registry-specific proxy config templates.

Copy link
Q136

docker pull stuck on Waiting/Pulling fs layer then unexpected EOF.

Advanced

Likely causes โ†’ Network instability, MTU issues, proxy resets, registry throttling.

Diagnose โ†’

bash
docker pull -q img; echo $?
ping -M do -s 1472 registry-1.docker.io
journalctl -u docker | tail

Fix โ†’ Lower MTU, reduce max-concurrent-downloads, use a mirror, retry.

Prevent โ†’ Local pull-through cache.

Copy link
Q137

Error response from daemon: Head "https://registry/v2/...": denied with correct credentials after switching credential helpers.

Intermediate

Likely causes โ†’ Stale entry in the keychain/config.json, or credHelpers pointing to the wrong helper per registry.

Diagnose โ†’ cat ~/.docker/config.json; docker-credential-<helper> list.

Fix โ†’ docker logout reg && docker login reg; correct credHelpers.

Prevent โ†’ One credential strategy per environment.

Copy link
Q138

failed to authorize: failed to fetch oauth token: ... 401 from BuildKit while docker pull works.

Intermediate

Likely causes โ†’ Builder uses different credentials (running as another user/sudo, remote builder), or the base image is private and no login in the build context.

Diagnose โ†’ sudo -E docker buildx build; echo $HOME; which config.json is read.

Fix โ†’ Log in as the same user running the build, set DOCKER_CONFIG, avoid sudo without -E.

Prevent โ†’ Standardise runner user/credentials.

Copy link
Q139

Pushed image appears on registry but nodes pull the old content with the same tag.

Advanced

Likely causes โ†’ Node already has the tag cached and imagePullPolicy: IfNotPresent (or Compose didn't pull), or a CDN/mirror cache serves stale manifests.

Diagnose โ†’ Compare docker images --digests on the node with the registry digest.

Fix โ†’ Deploy by digest or unique tags; docker compose pull; set imagePullPolicy: Always only if you must keep mutable tags.

Prevent โ†’ Immutable tags.

Copy link
Q140

Harbor/Registry push: blob upload unknown or unknown blob mid-push.

Advanced

Likely causes โ†’ Multiple registry replicas without shared storage/sticky sessions, storage backend (S3) eventual consistency, garbage collection running during push.

Diagnose โ†’ Registry logs; check LB affinity and storage config.

Fix โ†’ Use shared backend storage, sticky upload sessions or Redis for upload state, don't run GC while writes are active (or use read-only mode).

Prevent โ†’ Schedule GC in maintenance windows.

Copy link
Q141

docker manifest create error: ... is a manifest list / no such manifest.

Intermediate

Likely causes โ†’ Source images not pushed to the registry yet, or a source is itself a manifest list.

Diagnose โ†’ docker manifest inspect reg/app:amd64.

Fix โ†’ Push per-arch images first, then create; or use docker buildx imagetools create -t reg/app:1 reg/app:amd64 reg/app:arm64.

Prevent โ†’ Prefer buildx --platform multi-arch builds.

Copy link
Q142

Error response from daemon: error parsing HTTP 404 response body when pulling from a mirror.

Advanced

Likely causes โ†’ Mirror/proxy doesn't implement the registry v2 API at that path, or returns an HTML error page.

Diagnose โ†’ curl -i https://mirror/v2/; look at response headers Docker-Distribution-Api-Version.

Fix โ†’ Correct the mirror URL/path, fix proxy rewriting, use the proper pull-through endpoint.

Prevent โ†’ Health-check the mirror with /v2/.

Copy link
Q143

docker push fails: denied: requested access to the resource is denied

Beginner

Likely causes โ†’ Image name lacks your namespace (myapp instead of user/myapp), not logged in, or no push rights.

Diagnose โ†’ docker images; docker info | grep Username.

Fix โ†’ docker tag myapp user/myapp:1.0 && docker push user/myapp:1.0 after login.

Prevent โ†’ Tag with full registry paths in CI.

Copy link
Q144

Image push works, but docker pull on another machine shows image operating system "windows" cannot be used on this platform.

Beginner

Likely causes โ†’ Windows container image on a Linux host.

Diagnose โ†’ docker manifest inspect img | grep os.

Fix โ†’ Use a Linux image or run on Windows with Windows containers mode.

Prevent โ†’ Label image OS/arch in docs.

Copy link
Q145

Registry disk usage doesn't drop after deleting tags.

Intermediate

Likely causes โ†’ Deleting tags/manifests doesn't delete blobs until garbage collection runs; deletes disabled (REGISTRY_STORAGE_DELETE_ENABLED).

Diagnose โ†’ Check registry config for delete.enabled.

Fix โ†’

bash
registry garbage-collect --delete-untagged /etc/docker/registry/config.yml

In Harbor trigger GC from the UI/API.

Prevent โ†’ Scheduled GC and retention rules.

Copy link
Q146

Error: image not known when using podman pull alpine: short-name resolution enforced but cannot prompt without a TTY.

Intermediate

Likely causes โ†’ Podman's short-name mode is enforcing and an unqualified name has several candidate registries in a non-interactive context.

Diagnose โ†’ cat /etc/containers/registries.conf; podman info | grep -i search.

Fix โ†’ Use fully qualified names (docker.io/library/alpine), or define [aliases] in registries.conf.d.

Prevent โ†’ Always qualify image names in scripts.

Copy link
Q147

docker login succeeds but pulls from the private registry still fail on Kubernetes with ImagePullBackOff.

Advanced

Likely causes โ†’ No imagePullSecrets, wrong namespace for the secret, expired cloud token, or node can't reach the registry.

Diagnose โ†’

bash
kubectl describe pod p | tail -20
kubectl get secret regcred -o jsonpath='{.data.\.dockerconfigjson}' | base64 -d
crictl pull reg/app:tag    # on the node

Fix โ†’ Create the secret in the pod's namespace, link to ServiceAccount, fix network/credentials.

Prevent โ†’ Use cloud credential providers.

Copy link
Q148

failed to verify certificate: x509: certificate is valid for X, not registry.local

Intermediate

Likely causes โ†’ Hostname used differs from the certificate SAN (IP address or alias).

Diagnose โ†’ openssl s_client -connect host:443 | openssl x509 -noout -text | grep -A1 'Alternative'.

Fix โ†’ Use the DNS name in the SAN, or re-issue the certificate with the correct SANs.

Prevent โ†’ Issue certs with all hostnames and IPs.

Copy link
Q149

Error: pull access denied after Docker Hub changed org/repo visibility or deleted a tag.

Beginner

Likely causes โ†’ Publisher made the repo private or removed it.

Diagnose โ†’ Browse the Hub page; try docker pull with login.

Fix โ†’ Switch to an alternative or your mirrored copy.

Prevent โ†’ Mirror third-party images you depend on.

Copy link
Q150

Pull succeeds but docker run says Unable to find image ... locally when using DOCKER_HOST=ssh://.

Advanced

Likely causes โ†’ Pulled on the local daemon but running on the remote one (or the reverse); context mismatch.

Diagnose โ†’ docker context show; docker info | grep Name.

Fix โ†’ Use the same context for both commands (docker --context remote pull).

Prevent โ†’ Show the current context in your shell prompt.

Copy link

Resources, health checks, logging and restarts

๐ŸŽฅ Learn this hands-on with DevOps Shack โ†’ YouTube @devopsshack ยท Hindi @shackverse ยท Courses at devopsshack.com

Q151

Container restarts repeatedly: docker ps shows Restarting (1) 5 seconds ago.

Beginner

Likely causes โ†’ App crashes on start (bad config, missing dependency, port conflict) with a restart policy re-launching it.

Diagnose โ†’

bash
docker logs --tail 100 c
docker inspect -f '{{.State.ExitCode}} {{.State.Error}} {{.RestartCount}}' c

Fix โ†’ Fix the startup error; temporarily docker update --restart no c to stop the loop while debugging.

Prevent โ†’ Use on-failure:N for jobs and alert on restart counts.

Copy link
Q152

OOMKilled: true and exit code 137.

Beginner

Likely causes โ†’ Process exceeded --memory, a leak, or a limit too small for the workload (JVM, page cache for tmpfs).

Diagnose โ†’

bash
docker inspect -f '{{.State.OOMKilled}} {{.HostConfig.Memory}}' c
docker stats --no-stream c
dmesg -T | grep -i 'memory cgroup out of memory'

Fix โ†’ Raise the limit, tune the runtime (heap -Xmx or MaxRAMPercentage), fix leaks.

Prevent โ†’ Load-test to size limits; alert at 90% of the limit.

Copy link
Q153

Container is unhealthy but the app works when tested manually.

Intermediate

Likely causes โ†’ Healthcheck command missing in the image (curl: not found), wrong port/path, too-short timeout, runs as a different user, or checks a dependency that's down.

Diagnose โ†’

bash
docker inspect -f '{{json .State.Health}}' c | jq
docker exec c sh -c 'curl -fsS http://localhost:8080/healthz; echo $?'

Fix โ†’ Install the needed tool or use the app binary, fix URL, raise timeout/start_period.

Prevent โ†’ Test the health command in CI.

Copy link
Q154

docker stats shows 100%+ CPU and the container is slow.

Intermediate

Likely causes โ†’ Multi-core usage above 100% is normal (200% = two cores); with --cpus limit the app is throttled.

Diagnose โ†’

bash
docker exec c cat /sys/fs/cgroup/cpu.stat
docker exec c top -b -n1 | head -15

Fix โ†’ Increase --cpus, profile the hot path, scale out.

Prevent โ†’ Track nr_throttled metrics.

Copy link
Q155

docker logs is slow or docker logs -f hangs on a container with huge logs.

Intermediate

Likely causes โ†’ Large json-file log being read from the start.

Diagnose โ†’ ls -lh /var/lib/docker/containers/<id>/<id>-json.log.

Fix โ†’ docker logs --tail 200 -f c, --since 10m; rotate logs.

Prevent โ†’ Rotation and shipping logs to a backend.

Copy link
Q156

Error response from daemon: configured logging driver does not support reading when running docker logs.

Intermediate

Likely causes โ†’ Driver such as syslog, gelf, fluentd or awslogs without dual logging support in that engine/plugin setup.

Diagnose โ†’ docker inspect -f '{{.HostConfig.LogConfig.Type}}' c.

Fix โ†’ Read logs in the backend, or use local/json-file driver; Docker 20.10+ dual logging usually caches for most drivers.

Prevent โ†’ Choose a driver with local cache (or run a collector sidecar).

Copy link
Q157

Application hangs and logs stop: log driver blocking (fluentd: connection refused).

Advanced

Likely causes โ†’ Default blocking log mode: when the remote log endpoint is unavailable, writes to stdout block the app.

Diagnose โ†’ docker inspect -f '{{.HostConfig.LogConfig}}' c; strace -p <pid> shows write(1, ...) blocked; check collector.

Fix โ†’ --log-opt mode=non-blocking --log-opt max-buffer-size=4m; restore the collector.

Prevent โ†’ Use a local collector tailing files rather than direct network drivers.

Copy link
Q158

Container killed by the OOM killer but docker stats never showed high memory.

Advanced

Likely causes โ†’ Short spikes between sampling intervals, kernel memory/tmpfs counted in the cgroup, or sub-process memory.

Diagnose โ†’

bash
cat /sys/fs/cgroup/system.slice/docker-<id>.scope/memory.events
cat .../memory.peak
dmesg -T | grep -B2 -A10 'Memory cgroup out of memory'

Fix โ†’ Raise the limit by the observed memory.peak, reduce spikes (batch size, parallelism).

Prevent โ†’ Alert on memory.events oom_kill counters.

Copy link
Q159

docker update --memory fails: Cannot update container ... Memory limit should be smaller than already set memoryswap limit.

Intermediate

Likely causes โ†’ Existing memory-swap is lower than the new memory limit.

Diagnose โ†’ docker inspect -f '{{.HostConfig.MemorySwap}}' c.

Fix โ†’ docker update --memory 1g --memory-swap 1g c (set both).

Prevent โ†’ Set both values together.

Copy link
Q160

Limits seem ignored: WARNING: Your kernel does not support swap limit capabilities or the cgroup is not mounted. Memory limited without swap.

Advanced

Likely causes โ†’ Swap accounting disabled in the kernel (common on Debian/Ubuntu defaults).

Diagnose โ†’ docker info | grep -i swap; cat /proc/cmdline.

Fix โ†’ Add cgroup_enable=memory swapaccount=1 to GRUB (cgroup v1), or use cgroup v2 where it works; update-grub and reboot.

Prevent โ†’ Standardise kernel parameters in the host image.

Copy link
Q161

Restart policy unless-stopped container comes back after docker stop + daemon restart.

Intermediate

Likely causes โ†’ It was stopped by something other than an explicit docker stop (e.g. Compose down, kill), or always was used (restarts regardless on daemon start).

Diagnose โ†’ docker inspect -f '{{.HostConfig.RestartPolicy.Name}}' c.

Fix โ†’ Use unless-stopped or no and stop via docker stop.

Prevent โ†’ Know the semantic difference between always and unless-stopped.

Copy link
Q162

docker events shows health_status: unhealthy flapping every minute.

Intermediate

Likely causes โ†’ Health command timing out under load (timeout 1s default 30s interval depending on setting), GC pauses, dependency checks too strict.

Diagnose โ†’ docker inspect -f '{{range .State.Health.Log}}{{.Start}} {{.ExitCode}} {{.Output}}{{end}}' c.

Fix โ†’ Lighter health endpoint, larger timeout/retries, separate liveness from dependency checks.

Prevent โ†’ Make health endpoints cheap and cached.

Copy link
Q163

Java container ignores memory limit and uses host memory (old JDK): OutOfMemoryError or killed.

Advanced

Likely causes โ†’ Older JDK (<8u191) doesn't read cgroup limits, so default heap is 25% of host RAM.

Diagnose โ†’ docker exec c java -XX:+PrintFlagsFinal -version | grep -E 'MaxHeapSize|UseContainerSupport'.

Fix โ†’ Upgrade JDK (11+/17/21), set -XX:MaxRAMPercentage=70, or explicit -Xmx.

Prevent โ†’ Use current LTS base images.

Copy link
Q164

Node.js container OOM despite --memory 512m: V8 heap default is larger.

Intermediate

Likely causes โ†’ V8 sizes heap from available memory/limits and Buffers live outside heap; default old-space can exceed the limit.

Diagnose โ†’ docker exec c node -e "console.log(v8.getHeapStatistics().heap_size_limit/1048576)".

Fix โ†’ NODE_OPTIONS=--max-old-space-size=384 (about 75% of limit), watch RSS.

Prevent โ†’ Set heap flags together with limits.

Copy link
Q165

Container can't create threads/processes: fork: retry: Resource temporarily unavailable.

Advanced

Likely causes โ†’ --pids-limit reached, or host/user nproc ulimit, or threads leak.

Diagnose โ†’

bash
docker inspect -f '{{.HostConfig.PidsLimit}}' c
docker exec c sh -c 'ls /proc | grep -c "^[0-9]"'
cat /sys/fs/cgroup/.../pids.current

Fix โ†’ Raise limit, fix leaking process/thread creation, reap zombies (--init).

Prevent โ†’ Alert on pids.current.

Copy link
Q166

too many open files inside a container.

Beginner

Likely causes โ†’ Low nofile ulimit, FD leak, or host fs.file-max/inotify limits.

Diagnose โ†’

bash
docker exec c sh -c 'ulimit -n'
docker exec c ls /proc/1/fd | wc -l
sysctl fs.inotify.max_user_instances

Fix โ†’ --ulimit nofile=65536:65536; raise inotify sysctls on host for watchers (ENOSPC on inotify); fix leaks.

Prevent โ†’ Standard ulimits in daemon.json default-ulimits.

Copy link
Q167

Elasticsearch container exits: max virtual memory areas vm.max_map_count [65530] is too low.

Beginner

Likely causes โ†’ Host kernel setting too low (containers share it).

Diagnose โ†’ sysctl vm.max_map_count.

Fix โ†’ sudo sysctl -w vm.max_map_count=262144; persist in /etc/sysctl.d/99-es.conf.

Prevent โ†’ Provision sysctls in host config.

Copy link
Q168

Container clock skew breaks JWT/TLS validation (token used before issued).

Intermediate

Likely causes โ†’ Host or Docker Desktop VM clock drift (after sleep).

Diagnose โ†’ docker run --rm busybox date -u; date -u.

Fix โ†’ Fix NTP/chrony on the host; restart Docker Desktop to resync VM time.

Prevent โ†’ Time sync monitoring.

Copy link
Q169

docker stop hangs then kills; app data corrupted because shutdown never completed.

Advanced

Likely causes โ†’ Shutdown takes longer than 10 s default stop timeout.

Diagnose โ†’ Time docker stop c; look at app shutdown logs.

Fix โ†’ docker stop -t 60, stop_grace_period: 60s, handle SIGTERM, correct STOPSIGNAL (for example SIGINT/SIGQUIT for some servers).

Prevent โ†’ Test graceful shutdown.

Copy link
Q170

Container's DNS or hostname weirdness after docker update/network change: docker update doesn't change network.

Beginner

Likely causes โ†’ docker update only changes resources and restart policy, not networks, ports or env.

Diagnose โ†’ docker update --help.

Fix โ†’ docker network connect/disconnect for networks; recreate the container for ports/env.

Prevent โ†’ Treat containers as immutable; change config in Compose and recreate.

Copy link
Q171

Disk I/O wait high on the host and all containers slow.

Advanced

Likely causes โ†’ One noisy container (logging, DB, backup), overlay copy-up on huge files, or small volume IOPS.

Diagnose โ†’

bash
iostat -x 1
sudo iotop -oPa
docker stats --no-stream
cat /sys/fs/cgroup/system.slice/docker-<id>.scope/io.stat

Fix โ†’ Throttle (--device-write-bps), move hot paths to dedicated volumes, increase IOPS.

Prevent โ†’ Per-container IO metrics and limits.

Copy link
Q172

Memory not released after load; docker stats stays high.

Advanced

Likely causes โ†’ Allocators (glibc arenas, JVM) hold memory, page cache is included, or a real leak.

Diagnose โ†’ docker exec c cat /sys/fs/cgroup/memory.stat | head -20 (anon vs file); heap dumps.

Fix โ†’ Tune allocator (MALLOC_ARENA_MAX=2, jemalloc), cap heap; fix the leak if anon grows steadily.

Prevent โ†’ Soak tests with memory graphs.

Copy link
Q173

docker compose up says services are unhealthy and dependent services never start: dependency failed to start: container db is unhealthy.

Intermediate

Likely causes โ†’ Health check fails (wrong credentials, wrong command, slow initialization such as a DB restore).

Diagnose โ†’

bash
docker compose ps
docker compose logs db
docker inspect --format '{{json .State.Health}}' $(docker compose ps -q db) | jq

Fix โ†’ Correct the check (pg_isready -U $POSTGRES_USER), add start_period, fix env.

Prevent โ†’ Test health commands manually first.

Copy link
Q174

Live logs are missing lines or delayed with local driver: docker logs --since shows fewer lines than expected after rotation.

Advanced

Likely causes โ†’ Rotation (max-size, max-file) discarded older entries; small buffers with non-blocking mode drop messages (max-buffer-size exceeded).

Diagnose โ†’ Check log-opts; look for dropped messages in journalctl -u docker.

Fix โ†’ Raise sizes, ship logs externally before rotation, use blocking mode where loss is unacceptable.

Prevent โ†’ Size rotation for peak throughput, centralize logs.

Copy link
Q175

Container's CPU usage inside top differs from docker stats.

Advanced

Likely causes โ†’ top inside shows host-level /proc/stat data (no lxcfs), while docker stats reads cgroup accounting.

Diagnose โ†’ Compare docker stats with cat /sys/fs/cgroup/cpu.stat deltas.

Fix โ†’ Trust cgroup metrics (cAdvisor); use nproc/cgroup files for in-app sizing.

Prevent โ†’ Monitoring based on cgroup metrics, not in-container top.

Copy link

Security, rootless, Podman and containerd

๐ŸŽฅ Learn this hands-on with DevOps Shack โ†’ YouTube @devopsshack ยท Hindi @shackverse ยท Courses at devopsshack.com

Q176

Rootless Docker: dockerd-rootless.sh fails with newuidmap: write to uid_map failed: Operation not permitted

Intermediate

Likely causes โ†’ Missing uidmap package/setuid bit or no subuid/subgid ranges for the user.

Diagnose โ†’

bash
grep $USER /etc/subuid /etc/subgid
ls -l $(which newuidmap)
sysctl kernel.unprivileged_userns_clone user.max_user_namespaces

Fix โ†’ Install uidmap, add ranges (usermod --add-subuids 100000-165535 --add-subgids 100000-165535 $USER), enable user namespaces.

Prevent โ†’ Include these in the base image.

Copy link
Q177

Rootless: rootlesskit: failed to ... listen tcp 0.0.0.0:80: bind: permission denied

Beginner

Likely causes โ†’ Unprivileged users can't bind ports <1024.

Diagnose โ†’ sysctl net.ipv4.ip_unprivileged_port_start.

Fix โ†’ sudo sysctl -w net.ipv4.ip_unprivileged_port_start=80, or publish a high port and redirect with firewall/proxy.

Prevent โ†’ Use 8080/8443 internally.

Copy link
Q178

Rootless Docker stops when you log out of SSH.

Beginner

Likely causes โ†’ The user systemd instance ends at logout.

Diagnose โ†’ loginctl show-user $USER | grep Linger.

Fix โ†’ sudo loginctl enable-linger $USER.

Prevent โ†’ Make it part of provisioning.

Copy link
Q179

Rootless containers: Error: ... cannot set up namespace using "/usr/bin/newuidmap": should have setuid or have filecaps setuid (Podman).

Intermediate

Likely causes โ†’ newuidmap/newgidmap lack setuid or file capabilities (e.g. minimal image or container-in-container).

Diagnose โ†’ ls -l /usr/bin/newuidmap; getcap /usr/bin/newuidmap.

Fix โ†’ chmod u+s or setcap cap_setuid+ep, reinstall shadow-utils/uidmap.

Prevent โ†’ Install proper packages, not manual copies.

Copy link
Q180

Podman: Error: short-name "nginx" did not resolve to an alias and no unqualified-search registries are defined in "/etc/containers/registries.conf"

Beginner

Likely causes โ†’ No unqualified-search-registries configured.

Diagnose โ†’ grep -v '^#' /etc/containers/registries.conf.

Fix โ†’ Use docker.io/library/nginx, or add unqualified-search-registries = ["docker.io"].

Prevent โ†’ Fully qualified names in scripts.

Copy link
Q181

Podman rootless: Error: cannot find newuidmap / ping fails inside container: ping: permission denied (are you root?).

Intermediate

Likely causes โ†’ Ping needs raw sockets; unprivileged ICMP range excludes the user's GID.

Diagnose โ†’ sysctl net.ipv4.ping_group_range.

Fix โ†’ sudo sysctl -w net.ipv4.ping_group_range="0 2147483647".

Prevent โ†’ Persist in sysctl.d.

Copy link
Q182

Rootless Podman volumes show wrong owner: files appear owned by a huge UID (e.g. 100999) on the host.

Advanced

Likely causes โ†’ User namespace mapping: container UID N maps to subuid base + N โˆ’ 1 on host.

Diagnose โ†’ podman unshare ls -ln dir; cat /proc/self/uid_map.

Fix โ†’ Use podman unshare chown, --userns=keep-id, or :U volume option.

Prevent โ†’ Plan UID mapping for shared directories.

Copy link
Q183

docker run --privileged container breaks host networking after it runs iptables -F.

Advanced

Likely causes โ†’ Privileged container (or NET_ADMIN with host network) altered host firewall rules.

Diagnose โ†’ docker inspect -f '{{.HostConfig.Privileged}} {{.HostConfig.NetworkMode}}' c; iptables -S.

Fix โ†’ Restart Docker to recreate chains; remove privileges and host networking.

Prevent โ†’ Policy blocking privileged containers, --cap-drop ALL.

Copy link
Q184

Trivy/Scout reports a CVE in a package your app does not use.

Intermediate

Likely causes โ†’ Package present in the base image; may be unreachable or unfixed.

Diagnose โ†’

bash
trivy image --severity HIGH,CRITICAL --format json app | jq '.Results[].Vulnerabilities[]? | {PkgName,InstalledVersion,FixedVersion}'
docker run --rm --entrypoint sh app -c 'apt list --installed 2>/dev/null | head'

Fix โ†’ Remove the package, switch to slimmer base, update base, or document VEX/ignore with expiry.

Prevent โ†’ Minimal bases; scan on a schedule.

Copy link
Q185

docker scan/docker scout fails: unauthorized or failed to resolve image.

Beginner

Likely causes โ†’ Not logged in to Docker Hub, docker scan removed (replaced by Scout), or the image is only in a registry the tool can't reach.

Diagnose โ†’ docker scout version; docker login.

Fix โ†’ Use docker scout cves image after login, or trivy image.

Prevent โ†’ Standardize on one scanner in CI.

Copy link
Q186

permission denied when container tries to write with --read-only: Read-only file system.

Intermediate

Likely causes โ†’ App writes to a path not mounted writable (/tmp, /var/run, cache dirs).

Diagnose โ†’ docker run --read-only ... then strace -f -e trace=openat,mkdir or app logs naming the path.

Fix โ†’ Add --tmpfs /tmp --tmpfs /run or volumes for the specific paths.

Prevent โ†’ Test with read-only root in CI.

Copy link
Q187

operation not permitted running ip link add or sysctl -w inside a container.

Intermediate

Likely causes โ†’ Missing capability (NET_ADMIN/SYS_ADMIN), or sysctl not namespaced.

Diagnose โ†’ docker exec c capsh --print (if available) or grep Cap /proc/1/status.

Fix โ†’ --cap-add NET_ADMIN for networking tools; set namespaced sysctls with --sysctl net.ipv4.ip_forward=1; host-wide sysctls must be set on the host.

Prevent โ†’ Add only needed capabilities.

Copy link
Q188

ptrace: Operation not permitted when using strace/gdb in a container.

Intermediate

Likely causes โ†’ Default seccomp/capabilities block ptrace.

Diagnose โ†’ docker inspect -f '{{.HostConfig.SecurityOpt}} {{.HostConfig.CapAdd}}' c.

Fix โ†’ Debug-only: --cap-add SYS_PTRACE (and --security-opt seccomp=unconfined on older kernels).

Prevent โ†’ Use ephemeral debug containers instead of loosening prod.

Copy link
Q189

AppArmor denial: apparmor="DENIED" operation="mount" in dmesg when starting a container.

Intermediate

Likely causes โ†’ The default docker-default profile blocks the operation (mount, ptrace, etc.).

Diagnose โ†’ dmesg | grep apparmor; aa-status.

Fix โ†’ Write a custom profile with the needed rule (--security-opt apparmor=custom), or avoid the operation. Not unconfined unless sandboxed.

Prevent โ†’ Develop apps to work under default profiles.

Copy link
Q190

SELinux: avc: denied { read } for ... scontext=system_u:system_r:container_t:s0:c1,c2 tcontext=...:user_home_t

Advanced

Likely causes โ†’ Mounted a host directory without a container label.

Diagnose โ†’ sudo ausearch -m avc -ts recent | audit2why.

Fix โ†’ :z/:Z on the volume, or label container_file_t; avoid --security-opt label=disable outside tests.

Prevent โ†’ Keep data under labeled dirs such as /srv.

Copy link
Q191

containerd: failed to pull and unpack image: failed to resolve reference ... x509 / http: server gave HTTP response to HTTPS client

Intermediate

Likely causes โ†’ containerd isn't using Docker's certs.d; the registry TLS/CA isn't configured for containerd.

Diagnose โ†’ crictl pull reg/app:tag; grep -A5 registry /etc/containerd/config.toml.

Fix โ†’ Configure config_path = "/etc/containerd/certs.d" and hosts.toml with CA or skip_verify (test only); systemctl restart containerd.

Prevent โ†’ Provision registry config for containerd with config management.

Copy link
Q192

crictl says unable to determine runtime API version: ... connection refused

Beginner

Likely causes โ†’ crictl endpoint not set or containerd not running.

Diagnose โ†’ cat /etc/crictl.yaml; systemctl status containerd; ls /run/containerd/containerd.sock.

Fix โ†’ crictl config --set runtime-endpoint=unix:///run/containerd/containerd.sock and start containerd.

Prevent โ†’ Ship /etc/crictl.yaml on nodes.

Copy link
Q193

ctr images ls shows nothing though Kubernetes runs pods.

Beginner

Likely causes โ†’ Wrong containerd namespace; Kubernetes uses k8s.io.

Diagnose โ†’ ctr namespaces ls.

Fix โ†’ ctr -n k8s.io images ls or crictl images.

Prevent โ†’ Prefer crictl on Kubernetes nodes.

Copy link
Q194

containerd: failed to create shim task: OCI runtime create failed: ... expected cgroupsPath to be of format "slice:prefix:name"

Advanced

Likely causes โ†’ Mismatch: kubelet uses systemd cgroup driver while containerd/runc uses cgroupfs (or vice versa).

Diagnose โ†’

bash
grep -n SystemdCgroup /etc/containerd/config.toml
grep cgroupDriver /var/lib/kubelet/config.yaml

Fix โ†’ Set SystemdCgroup = true under [plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options] (or the v3 config equivalent) and cgroupDriver: systemd; restart both.

Prevent โ†’ Align drivers when bootstrapping nodes (kubeadm defaults).

Copy link
Q195

Podman container cannot reach another by name: Temporary failure in name resolution on the default network.

Intermediate

Likely causes โ†’ Default podman network has DNS disabled; name resolution needs a user-created network with aardvark-dns.

Diagnose โ†’ podman network inspect podman | jq '.[0].dns_enabled'.

Fix โ†’ podman network create appnet and use --network appnet.

Prevent โ†’ Always create named networks.

Copy link
Q196

Podman: Error: creating container storage: the container name "web" is already in use

Beginner

Likely causes โ†’ Previous container (possibly stopped) holds the name.

Diagnose โ†’ podman ps -a --filter name=web.

Fix โ†’ podman rm -f web; use --replace.

Prevent โ†’ --replace or --rm in scripts.

Copy link
Q197

podman-compose/docker compose against Podman socket fails: Cannot connect to the Docker daemon at unix:///var/run/docker.sock.

Intermediate

Likely causes โ†’ Podman API socket isn't enabled or DOCKER_HOST isn't set.

Diagnose โ†’ systemctl --user status podman.socket; ls $XDG_RUNTIME_DIR/podman/podman.sock.

Fix โ†’

bash
systemctl --user enable --now podman.socket
export DOCKER_HOST=unix://$XDG_RUNTIME_DIR/podman/podman.sock

Prevent โ†’ Set DOCKER_HOST in the shell profile.

Copy link
Q198

Image runs fine as root but fails as non-root (EACCES creating /app/.cache or /.npm).

Beginner

Likely causes โ†’ Home/cache directories not writable by the non-root UID; no passwd entry for arbitrary UIDs.

Diagnose โ†’ docker run --user 10001 --rm image sh -c 'id; echo $HOME; touch $HOME/x'.

Fix โ†’ chown dirs at build, set HOME=/tmp or a writable path, npm_config_cache=/tmp/.npm.

Prevent โ†’ Test with the production user and read-only FS.

Copy link
Q199

Docker socket proxy breaks Traefik/Portainer: 403 Forbidden from the proxy.

Intermediate

Likely causes โ†’ The socket proxy denies API sections by default (CONTAINERS, NETWORKS, etc.).

Diagnose โ†’ Proxy logs; compare required API calls.

Fix โ†’ Enable only needed env vars (CONTAINERS=1, NETWORKS=1, SERVICES=1), keep POST=0.

Prevent โ†’ Document the minimal permission set per tool.

Copy link
Q200

Suspected container escape: unknown process on the host tied to a container. How do you investigate?

Advanced

Likely causes โ†’ Privileged container, mounted socket, vulnerable runtime (runc/kernel CVE), or compromised credentials; or a miner running inside the container's namespaces.

Diagnose โ†’

bash
ps -eo pid,ppid,user,cmd --forest
docker inspect -f '{{.Id}} {{.State.Pid}}' $(docker ps -q)
ls -l /proc/<pid>/ns /proc/<pid>/exe
nsenter -t <pid> -n ss -tnp
docker diff <c>; ausearch -k docker

Fix โ†’ Isolate the host (network quarantine), preserve evidence (docker export, memory/disk snapshot), then rebuild host and containers from clean images and rotate all secrets that were reachable.

Prevent โ†’ Patch runc/kernel, drop privileges, no socket mounts, runtime detection (Falco), and egress filtering.

Copy link
Feedback