Curious Minds

Clear answers to science and history questions

Colima Failed to Find Docker Daemon: Why It Happens

· 7 min read · Science

Colima fails to find the Docker daemon because the daemon is not running, not reachable at the expected socket path, or the Docker CLI is pointed at a different context than the one Colima created. Colima is a container runtime for macOS and Linux that launches a lightweight virtual machine, installs a container engine inside it, and exposes that engine through a Unix socket or TCP endpoint on the host. If any link in that chain is broken—VM stopped, daemon crashed inside the VM, socket not forwarded, or environment variables overriding the default—the Docker client reports that it cannot connect to the daemon.

What Colima Is and What It Runs

Colima (Container on Lima) is a command-line tool that uses Lima to create a Linux virtual machine on macOS, and on Linux it can also run containers directly. Inside that VM, Colima installs a container engine. The default engine is Docker (via dockerd), but Colima also supports containerd and Incus. When you run colima start, Colima boots the VM, starts the chosen engine, and sets up socket forwarding so that the host's Docker CLI can talk to the engine inside the VM.

On macOS, the Docker CLI is a separate binary that does not include a daemon. It expects to find a daemon listening on a socket. Colima creates a socket at a path such as ~/.colima/default/docker.sock and typically also symlinks or configures the Docker context to point there. If the CLI looks at the default /var/run/docker.sock instead, it will not find the daemon.

How the Docker Client Finds the Daemon

The Docker CLI determines which daemon to contact using, in order of precedence:

  • The --host or -H flag on the command line.
  • The DOCKER_HOST environment variable.
  • The current Docker context (set with docker context use).
  • The default socket path, usually unix:///var/run/docker.sock.

Colima usually creates a Docker context named colima and may set it as active. If another context is active—such as default or a remote context—the CLI will try to reach that endpoint and fail if no daemon is there. Similarly, if DOCKER_HOST is set to a stale value, it overrides the context.

Common Causes of the “Cannot Connect” Error

The exact error message varies, but typical wording is “Cannot connect to the Docker daemon at unix:///... Is the docker daemon running?” The most frequent causes are:

  • Colima is not running. The VM or the engine inside it was stopped, either manually or after a reboot.
  • The Docker context is wrong. The CLI is using the default context instead of the Colima one.
  • DOCKER_HOST is set incorrectly. An old export in a shell profile points to a socket that no longer exists.
  • The socket path changed. Colima profiles (e.g., default, dev) use different socket paths; switching profiles without updating the context causes a mismatch.
  • The engine inside the VM failed to start. This can happen after a VM update, a disk-full condition, or a corrupted engine configuration.
  • Permissions on the socket. On Linux, the user may lack access to the socket file.
  • Architecture or virtualization issues. On Apple Silicon, older Colima versions or misconfigured QEMU can prevent the VM from booting properly.

Step-by-Step Diagnosis and Fix

Work through these checks in order; each one isolates a different part of the chain.

  1. Check Colima status. Run colima status. If it reports that Colima is not running, start it with colima start. If it is running, note the socket path and engine it reports.
  2. List Docker contexts. Run docker context ls. The active context is marked with an asterisk. If colima exists but is not active, switch with docker context use colima.
  3. Inspect environment variables. Run echo $DOCKER_HOST. If it is set to a path that does not match the Colima socket, unset it in the current shell and remove the export from your shell profile if it is stale.
  4. Verify the socket exists. Check the path reported by colima status, for example ls -l ~/.colima/default/docker.sock. If the file is missing, the engine inside the VM is not running or socket forwarding failed.
  5. Restart Colima. Run colima stop then colima start. This restarts the VM and the engine, and recreates the socket forwarding.
  6. Check the engine inside the VM. Use colima ssh to log into the VM, then run sudo systemctl status docker (or the appropriate service manager command) to see whether the daemon is active. If it is failed, inspect its logs with journalctl -u docker.
  7. Recreate the context if needed. If the context points to an old socket, remove it with docker context rm colima and let Colima recreate it on the next start, or create a new context manually pointing to the correct socket.

Colima Profiles and Socket Paths

Colima supports multiple profiles, each with its own VM and socket path. The default profile uses ~/.colima/default/docker.sock; a profile named dev would use ~/.colima/dev/docker.sock. When you start a non-default profile with colima start --profile dev, the Docker context may not be switched automatically. The CLI then continues to use the default context and fails to find the daemon for the dev profile. The fix is to switch contexts explicitly or set DOCKER_HOST to the profile's socket.

On Linux, Colima can run without a VM in some configurations, but the same context and socket rules apply. The socket path may be under ~/.colima/ or another location depending on the installation.

Docker Desktop, Rancher Desktop, and Other Alternatives

Colima is one of several ways to run Docker on macOS. Docker Desktop installs its own daemon and sets up its own context and socket, typically at ~/.docker/run/docker.sock or /var/run/docker.sock. Rancher Desktop and Podman Desktop similarly manage their own daemons and contexts. A common cause of confusion is having more than one of these tools installed: each may set a different active context, and starting one tool can change the context that another tool relies on. If Colima suddenly cannot find its daemon after installing or updating another tool, check docker context ls first.

Colima is attractive because it is open source, lightweight, and does not require a commercial license for larger organizations. It also supports containerd and Incus as alternative runtimes, which can be useful for Kubernetes-style workflows. The trade-off is that it exposes more of the underlying VM and socket plumbing, so context and environment-variable mistakes are more visible than with a fully integrated GUI application.

Preventing the Problem

  • After starting Colima, confirm the active context with docker context ls before running Docker commands.
  • Avoid hard-coding DOCKER_HOST in shell profiles unless you intentionally manage multiple daemons.
  • Use descriptive profile names and switch contexts when you switch profiles.
  • Keep Colima updated; socket handling and context creation have improved across versions.
  • If you use multiple container tools, decide which one owns the default context and stick to it.

Frequently Asked Questions

Why does docker ps say the daemon is not running when Colima is running?

The Docker CLI is probably using a different context or DOCKER_HOST than the one Colima configured. Check docker context ls and echo $DOCKER_HOST, then switch to the Colima context or unset the variable.

Does Colima need Docker Desktop installed?

No. Colima installs its own container engine inside a Lima VM and does not depend on Docker Desktop. The Docker CLI is still needed on the host to send commands to that engine.

How do I point the Docker CLI at Colima manually?

Use docker context create with the socket path reported by colima status, or set DOCKER_HOST=unix:///path/to/docker.sock for the current shell. The context approach is usually more convenient because it persists.

Why did Colima stop working after a macOS update?

Major macOS updates can change virtualization behavior or invalidate the VM state. Restarting Colima with colima stop and colima start often resolves it; if not, deleting and recreating the Colima VM may be necessary, though that removes containers and images stored inside it.

Can I run Colima and Docker Desktop at the same time?

They can coexist, but only one daemon can own the active Docker context at a time. Running both simultaneously is possible if you switch contexts explicitly, but it is easy to confuse which daemon a command targets.

What does “Cannot connect to the Docker daemon” mean exactly?

It means the Docker CLI could not establish a connection to the socket or TCP endpoint it was configured to use. The daemon may be stopped, the socket path may be wrong, or a firewall or permission issue may be blocking access.

In this article
  1. What Colima Is and What It Runs
  2. How the Docker Client Finds the Daemon
  3. Common Causes of the “Cannot Connect” Error
  4. Step-by-Step Diagnosis and Fix
  5. Colima Profiles and Socket Paths
  6. Docker Desktop, Rancher Desktop, and Other Alternatives
  7. Preventing the Problem
  8. Frequently Asked Questions