Skip to content

Instantly share code, notes, and snippets.

@shivamnarkar47
Last active June 13, 2026 11:26
Show Gist options
  • Select an option

  • Save shivamnarkar47/da77c459980a8a5d0f147b9cbf13bf81 to your computer and use it in GitHub Desktop.

Select an option

Save shivamnarkar47/da77c459980a8a5d0f147b9cbf13bf81 to your computer and use it in GitHub Desktop.

Issue

docker-compose up

permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/containers/json?all=1&filters=%7B%22label%22%3A%7B%22com.docker.compose.config-hash%22%3Atrue%2C%22com.docker.compose.project%3Dahara%22%3Atrue%7D%7D": dial unix /var/run/docker.sock: connect: permission denied

Its specially for Linux

Soln :

This error occurs because your user does not have permission to access the Docker Unix socket located at . By default, this socket is owned by , and only members of the group can access it without using . [1]
Here are the step-by-step methods to fix this problem, ordered from the most recommended permanent solution to quick workarounds. Fix 1: Add Your User to the Docker Group (Recommended)

This is the standard and permanent solution. It allows you to run and commands securely as a non-root user.

  1. Create the docker group (if it doesn't already exist): sudo groupadd docker
  2. Add your current user to the group: sudo usermod -aG docker $USER
  3. Activate the group changes immediately in your current terminal session: newgrp docker

(Note: Alternatively, you can log out and log back into your system to apply this system-wide).

  1. Test the solution by rerunning your command: docker-compose up
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment