How to fix failed to solve: executor failed running: exit code: 1 in Docker

DockerINTERMEDIATEMEDIUMUpdated Dec 6, 2025ยท 265 views

This error occurs when a command in your Dockerfile fails during the BuildKit build process. Common causes include missing packages, permission issues, or incorrect command syntax.

Quick fix

Fixes failed to solve: executor failed running: exit code: 1

docker build --progress=plain -t myimage .
  1. Check the full build output for the actual error
  2. Add non-interactive flags to package managers
  3. Verify package names for your base image
  4. Run apt-get update before installing packages
docker โ€” error
docker build --progress=plain -t myimage .
failed to solve: executor failed running: exit code: 1

What this error means

The 'failed to solve: executor failed running: exit code: 1' error indicates that Docker's BuildKit build engine encountered a failure while executing a command in your Dockerfile. BuildKit is Docker's modern build backend that provides improved performance and caching. When you see this error, it means one of the RUN, COPY, or other instructions in your Dockerfile failed to complete successfully. The 'executor' is the component that runs shell commands inside the build container, and 'exit code: 1' indicates a general failure (as opposed to more specific exit codes). The actual root cause is usually shown in the build output just before this error message. Common culprits include failed package installations, missing dependencies, syntax errors in shell commands, or permission denied errors when accessing files or directories.

Typical symptoms

  • Docker build fails with "failed to solve: executor failed running" message
  • Build process stops at a specific RUN instruction in the Dockerfile
  • Error mentions "/bin/sh -c" followed by the failing command
  • Exit code 1 appears at the end of the error message
  • Build works locally but fails in CI/CD pipelines
  • Previously working builds suddenly start failing

Common causes

  1. Missing -y flag for apt-get or package manager commands requiring confirmation
  2. Package name typos or incorrect package names for the base image distribution
  3. Network connectivity issues preventing package downloads
  4. Missing dependencies required by the command being executed
  5. Permission denied when accessing files or directories
  6. Clock synchronization issues causing package repository validation failures
  7. Insufficient memory or disk space allocated to Docker
  8. Base image missing required tools (python, pip, curl, etc.)
  9. User namespace remapping conflicts with BuildKit
  10. Incompatible base image architecture (ARM vs x86)

How to fix "failed to solve: executor failed running: exit code: 1"

1Check the full build output for the actual error

The 'executor failed running' message is a wrapper error. Scroll up in your build output to find the actual failure:

bash
docker build --progress=plain -t myimage .

The --progress=plain flag shows detailed output including the exact command that failed and its error message.

2Add non-interactive flags to package managers

Package managers like apt-get require confirmation by default. In Dockerfiles, always use non-interactive flags:

dockerfile
# For Debian/Ubuntu
RUN apt-get update && apt-get install -y package-name

# For Alpine
RUN apk add --no-cache package-name

# For yum/dnf
RUN yum install -y package-name

The -y flag automatically answers 'yes' to prompts. For apt-get, you can also set DEBIAN_FRONTEND=noninteractive.

3Verify package names for your base image

Package names differ between distributions. A package might be named differently or not exist:

dockerfile
# Ubuntu/Debian
RUN apt-get install -y python3-pip

# Alpine (note: python3 not python)
RUN apk add --no-cache python3 py3-pip

# RHEL/CentOS
RUN dnf install -y python3-pip

Check your base image's package repository for correct package names.

4Run apt-get update before installing packages

Always update package lists before installing. Cached layers may have stale package information:

dockerfile
# Good practice
RUN apt-get update && apt-get install -y \
    package1 \
    package2 \
    && rm -rf /var/lib/apt/lists/*

# Bad - may fail with 'Unable to locate package'
RUN apt-get install -y package1
5Check for network issues and increase timeouts

If builds fail intermittently with timeout errors, try:

dockerfile
# For pip installations
RUN pip install --default-timeout=100 package-name

# For npm
RUN npm install --fetch-timeout=300000

Also ensure your Docker daemon has proper network access. Check DNS settings and proxy configurations.

6Increase Docker resource limits

If you're using Docker Desktop, increase allocated resources:

1. Open Docker Desktop Settings
2. Go to Resources
3. Increase Memory (try 4GB or more)
4. Increase Disk image size if needed
5. Apply & Restart

For builds that compile code (npm install, pip install with C extensions), more memory is often needed.

7Fix clock synchronization issues

If you see errors about 'Release file is not valid yet', your Docker VM's clock may be out of sync:

bash
# On Docker Desktop for Mac/Windows, restart Docker Desktop

# On Linux with systemd
sudo systemctl restart docker

# Manually sync time in WSL2
sudo hwclock -s

This commonly occurs after the host machine sleeps or hibernates.

8Try building without BuildKit cache

Cached layers can sometimes cause issues. Build without cache:

bash
# Clear build cache and rebuild
docker builder prune -f
docker build --no-cache -t myimage .

# Or disable BuildKit temporarily
DOCKER_BUILDKIT=0 docker build -t myimage .

If the build succeeds without BuildKit, the issue may be BuildKit-specific.

Advanced notes

User Namespace Remapping: If you have user namespace remapping enabled (userns-remap in daemon.json), BuildKit builds may fail with permission errors. This is a known issue where the executor cannot properly mount files. Consider disabling userns-remap for build operations or using a separate builder without remapping.

Multi-platform Builds: When building for different architectures (e.g., ARM64 on x86), some commands may fail due to QEMU emulation issues. Native compilation commands or certain system calls might not work correctly under emulation. Consider using native builders or cross-compilation instead.

Rootless Docker: Running Docker in rootless mode introduces additional permission constraints. Builds may fail when trying to bind-mount certain directories or change ownership of files. Ensure your Dockerfile doesn't rely on root-only operations.

CI/CD Environments: In Kubernetes-based CI systems, builds may fail with 'network bridge not found' errors. This occurs because the standard Docker network bridge isn't available in containerized build environments. Use Kaniko or buildx with a remote builder instead.

Frequently asked questions

What does "failed to solve: executor failed running: exit code: 1" mean?
The 'failed to solve: executor failed running: exit code: 1' error indicates that Docker's BuildKit build engine encountered a failure while executing a command in your Dockerfile. BuildKit is Docker's modern build backend that provides improved performance and caching. When you see this error, it means one of the RUN, COPY, or other instructions in your Dockerfile failed to complete successfully.
How do I fix "failed to solve: executor failed running: exit code: 1"?
This error occurs when a command in your Dockerfile fails during the BuildKit build process. Common causes include missing packages, permission issues, or incorrect command syntax.
What causes "failed to solve: executor failed running: exit code: 1"?
Missing -y flag for apt-get or package manager commands requiring confirmation Package name typos or incorrect package names for the base image distribution Network connectivity issues preventing package downloads
Is the "failed to solve: executor failed running: exit code: 1" error serious?
It is a medium-severity error โ€” more of a blocker than a risk. The steps above resolve it.

Official resources & further reading