How to fix docker: Error response from daemon (exit status 125) in Docker

DockerINTERMEDIATEMEDIUMUpdated Sep 16, 2026· 328 views

Docker exit code 125 occurs when the docker run command itself fails before the container can start. This typically indicates a problem with the Docker daemon, invalid command syntax, or system resource conflicts.

Quick fix

Fixes 125

# On Linux
sudo systemctl status docker

# Or try
docker info
  1. Check if Docker daemon is running
  2. Run the command manually to see the full error
  3. Remove conflicting containers
  4. Verify image availability
docker — error
# On Linux
sudo systemctl status docker
# Or try
docker info
docker: Error response from daemon (exit status 125)

What this error means

Exit code 125 is Docker's way of signaling that the `docker run` command failed at the daemon level, before the container could even start executing. Unlike exit codes from the container itself (which indicate application failures), exit code 125 means Docker encountered a problem with how the container was being launched. This error originates from the Docker daemon and indicates one of several possible issues: invalid command-line flags, permission problems, resource conflicts, or missing prerequisites. The actual root cause is often revealed in the full error message that accompanies the exit code. Understanding exit code 125 is important because it requires troubleshooting Docker's configuration and environment, rather than the application inside the container.

Typical symptoms

  • Docker run command fails immediately with 'Error response from daemon: exit status 125'
  • Container never starts despite command appearing correct
  • Error message about container name conflicts or 'already in use'
  • Network configuration errors mentioning invalid addresses
  • CPU or resource allocation warnings from Docker daemon
  • File sharing or volume mount permission errors (Windows/Mac)

Common causes

  1. Container name already exists from a previous run
  2. Invalid network configuration or IP address assignment
  3. Docker daemon is not running or not responding
  4. CPU resource limits exceed available system resources
  5. Missing or removed Docker images from local repository
  6. Invalid command-line flags or incorrect syntax in docker run
  7. File sharing permissions not configured (Docker Desktop)
  8. Insufficient user permissions to create containers
  9. Volume mount paths not accessible or shared

How to fix "docker: Error response from daemon (exit status 125)"

1Check if Docker daemon is running

First, verify the Docker daemon is active and responding:

bash
# On Linux
sudo systemctl status docker

# Or try
docker info

If Docker is not running, start it:

bash
# On Linux
sudo systemctl start docker

# On Mac/Windows
# Start Docker Desktop application
2Run the command manually to see the full error

Execute your docker run command directly in the terminal to see the complete error message. Exit code 125 is generic, but the accompanying message reveals the actual problem:

bash
docker run [your-options] [image-name]

Look for specific errors like:
- "Conflict. The container name is already in use"
- "Invalid address X.X.X.X: It does not belong to any of this network's subnets"
- "Range of CPUs is from 0.01 to X.XX, as there are only X CPUs available"
- "user declined directory sharing"

3Remove conflicting containers

If the error mentions a container name conflict, list and remove the existing container:

bash
# List all containers (including stopped ones)
docker ps -a

# Remove the conflicting container
docker rm <container-name>

# Or remove all stopped containers
docker container prune

To prevent this issue, use the --rm flag to automatically remove containers on exit:

bash
docker run --rm [other-options] [image-name]
4Verify image availability

Check if the Docker image exists locally:

bash
docker images

If the image is missing (possibly removed by docker system prune), pull it again:

bash
docker pull [image-name]
5Fix network configuration issues

If the error mentions network problems:

bash
# List networks
docker network ls

# Inspect the network
docker network inspect [network-name]

# Remove and recreate if needed
docker network rm [network-name]
docker network create [network-name]

If manually specifying an IP address, ensure it belongs to the network's subnet range.

6Configure file sharing (Docker Desktop)

On Windows or Mac, if you see "user declined directory sharing":

1. Open Docker Desktop
2. Go to Settings → Resources → File Sharing
3. Add the directory path that contains your volumes or bind mounts
4. Click "Apply & Restart"

On Windows, ensure the drive is shared in Docker Desktop settings.

7Adjust CPU and memory limits

If the error mentions CPU constraints, either:

Option 1: Reduce the CPU limit in your docker run command:

bash
docker run --cpus="1.0" [image-name]

Option 2: Increase Docker Desktop's CPU allocation (Mac/Windows):
1. Open Docker Desktop → Settings → Resources
2. Increase CPUs and Memory sliders
3. Apply & Restart

8Reset Docker if issues persist

If none of the above work, try resetting Docker:

bash
# Restart Docker daemon (Linux)
sudo systemctl restart docker

# Or reset containers and networks
docker container prune
docker network prune
docker volume prune

On Docker Desktop (Mac/Windows), use "Troubleshoot → Reset to factory defaults" as a last resort (this will remove all containers, images, and volumes).

Advanced notes

Understanding Docker Exit Codes: Exit codes 125-127 are reserved for Docker daemon errors, not application errors. Exit code 125 specifically means docker run failed, exit code 126 means the container command can't be invoked (not executable), and exit code 127 means the command wasn't found.

Windows-Specific Issues: Windows containers switching to Linux containers or vice versa can cause exit code 125. You may need to switch container modes in Docker Desktop and restart.

Hyper-V/Virtualization: On Windows, exit code 125 can occur if Hyper-V or WSL 2 backend is not properly configured. Ensure virtualization is enabled in BIOS and the required Windows features are installed.

CI/CD Environments: In automated pipelines, exit code 125 often indicates missing configuration (environment variables, secrets, network access). Check that the CI runner has proper Docker daemon access and sufficient resources.

Repository Name Validation: Docker requires repository names to be lowercase. If your project name or image tag contains uppercase letters, you'll get exit code 125 with "invalid reference format". Always use lowercase in image names.

Frequently asked questions

What does "125" mean?
Exit code 125 is Docker's way of signaling that the docker run command failed at the daemon level, before the container could even start executing. Unlike exit codes from the container itself (which indicate application failures), exit code 125 means Docker encountered a problem with how the container was being launched. This error originates from the Docker daemon and indicates one of several possible issues: invalid command-line flags, permission problems, resource conflicts, or missing prerequisites.
How do I fix "125"?
Docker exit code 125 occurs when the docker run command itself fails before the container can start. This typically indicates a problem with the Docker daemon, invalid command syntax, or system resource conflicts.
What causes "125"?
Container name already exists from a previous run Invalid network configuration or IP address assignment Docker daemon is not running or not responding
Is the "125" error serious?
It is a medium-severity error — more of a blocker than a risk. The steps above resolve it.

Official resources & further reading