Fixing Docker 'permission denied' on docker.sock without sudo

Running docker commands as a normal user can fail because the Docker socket at /var/run/docker.sock is owned by root and the docker group. The usual fix is to add the user to the docker group with usermod, though existing shells keep the old group list until the user logs out and back in or runs newgrp. If the docker group doesn't exist, it can be created and the daemon restarted so the socket picks up the group. Containers that mount the socket need the host's numeric group ID rather than the image's docker group name. The guide warns against chmod 666 on the socket, since docker group membership is effectively root-equivalent.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in