Skip to content

Instantly share code, notes, and snippets.

@Lazhari
Created October 16, 2024 23:06
Show Gist options
  • Save Lazhari/b3680b87cd844b340a4a17f864caf905 to your computer and use it in GitHub Desktop.
Save Lazhari/b3680b87cd844b340a4a17f864caf905 to your computer and use it in GitHub Desktop.
Fix Cannot connect to the Docker daemon at unix:///var/run/docker.sock.

To fix the "cannot connect to the Docker daemon at unix:///var/run/docker.sock" error on macOS, try exporting the following:

export DOCKER_HOST=unix://$HOME/.docker/run/docker.sock  

Alternatively, you can use Docker over TCP. Here's how to configure Docker Desktop to expose the Docker daemon via TCP instead of a Unix socket:

  1. Open Docker Desktop.
  2. Navigate to Settings > General.
  3. Enable "Expose daemon on tcp://localhost:2375 without TLS" (Note: This option exposes the Docker daemon without security, so use it cautiously).
  4. Save the settings and restart Docker Desktop.

After completing these steps, you can export DOCKER_HOST as follows:

export DOCKER_HOST=tcp://localhost:2375
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment