Exit Code 125
DockerERRORNotableStartupHIGH confidence

Docker daemon execution error

What this means

Exit Code 125 is a Docker-specific error indicating that the 'docker' command itself failed. It signifies a problem with the Docker daemon or the command's execution environment, rather than an issue with the application inside the container.

Why it happens
  1. 1The Docker daemon is not running or is unresponsive.
  2. 2The user running the command does not have the necessary permissions to interact with the Docker socket.
  3. 3An invalid argument was passed to the 'docker run' or 'docker start' command.
  4. 4Conflicting container names or network configurations.
How to reproduce

Attempting to run a container when the Docker daemon is stopped.

trigger — this will error
trigger — this will error
# First, ensure the Docker daemon is stopped
# On Linux (systemd): sudo systemctl stop docker
# On macOS/Windows: Quit Docker Desktop
# Now, attempt to run any container
docker run hello-world

expected output

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

Fix 1

Start the Docker Daemon

WHEN When commands fail with 'Cannot connect to the Docker daemon'.

Start the Docker Daemon
# On Linux (systemd)
sudo systemctl start docker
# On macOS/Windows
# Open the Docker Desktop application

Why this works

This ensures the core Docker service is running and ready to accept commands.

Fix 2

Fix User Permissions

WHEN Permission errors occur when a non-root user tries to run docker commands.

Fix User Permissions
# Add the current user to the 'docker' group (requires logout/login)
sudo usermod -aG docker $USER

Why this works

This grants the user the necessary permissions to access the Docker daemon socket without needing 'sudo' for every command.

What not to do

Recursively change ownership of system directories to your user.

This can severely compromise system security and stability by giving a user account control over critical system files.

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All Docker errors