Skip to content

Error codes & fixes: Docker errors

5 Error codes & fixes commands: Docker errors. Click a command to see what each part does.

Index
5 items
Click a command to see what each part does.

Docker errors5

  • sudo usermod -aG docker $USER && newgrp dockerdocker.sock permission denied"permission denied while trying to connect to the Docker daemon socket"Caution

    What it means

    Your user may not talk to /var/run/docker.sock.

    Usual causes & fixes

    • Note: the docker group is root-equivalent on that machine.

    Diagnose: what each part of the command does

    1. usermod -aG docker $USERadd yourself to the docker group
    2. &&then
    3. newgrp dockerstart a shell with the new group (or log out and in)
  • sudo systemctl status dockerCannot connect to daemon"Cannot connect to the Docker daemon … Is the docker daemon running?"

    What it means

    The client cannot reach dockerd.

    Usual causes & fixes

    • Start it: sudo systemctl enable --now docker.
    • Wrong DOCKER_HOST or context: docker context ls.

    Diagnose: what each part of the command does

    1. systemctl status dockeris the Docker service running, and its last log lines
  • docker ps --filter publish=<port>port is already allocatedWhich container holds the host port?

    What it means

    Another container (or process) already uses that host port.

    Usual causes & fixes

    • Stop/remove the other container, or map a different host port (-p 8081:80).
    • Not a container? sudo lsof -i :<port>.

    Diagnose: what each part of the command does

    1. --filter publish=<port>containers publishing that host port
  • docker image inspect <image> --format '{{.Os}}/{{.Architecture}}'exec format errorImage built for another CPU architecture

    What it means

    The binary in the image does not match the machine's CPU (e.g. an arm64 image on amd64), or a script lacks a shebang.

    Usual causes & fixes

    • Build for the target: docker buildx build --platform linux/amd64,linux/arm64 ….
    • Script entrypoint: add #!/bin/sh as the first line.

    Diagnose: what each part of the command does

    1. image inspectimage metadata
    2. --format '{{.Os}}/{{.Architecture}}'e.g. linux/arm64 vs linux/amd64
  • docker logintoomanyrequestsDocker Hub pull rate limit

    What it means

    Anonymous pulls from Docker Hub are rate-limited per IP.

    Usual causes & fixes

    • Log in (also on CI runners / nodes via imagePullSecrets).
    • Use a pull-through cache or mirror the images to your own registry.

    Diagnose: what each part of the command does

    1. docker loginauthenticated pulls get a higher limit

My DevOps Playbook by Angelo John Calleja

New runbook

GitHub not connected

Saving is handled by the site: the GitHub token is stored in Cloudflare, not in your browser. Enter the editor password (the EDITOR_PASSWORD secret) to unlock saving in this browser.

Saving commits to gelogrammer/My_DevOps_Playbook. Create a fine-grained token with access to only this repo andContents: Read and write, then paste it here. It is stored only in this browser.

src/content/docs/…