Skip to content

Instantly share code, notes, and snippets.

@Azer5C74
Created March 9, 2023 17:49
Show Gist options
  • Save Azer5C74/d2f36289ce0dbbe5d38e711421c4814a to your computer and use it in GitHub Desktop.
Save Azer5C74/d2f36289ce0dbbe5d38e711421c4814a to your computer and use it in GitHub Desktop.
Run Docker commands without sudo

Run Docker commands without sudo

  1. Add the docker group if it doesn't already exist

$ sudo groupadd docker

  1. Add the connected user $USER to the docker group

Optionally change the username to match your preferred user.

$ sudo gpasswd -a $USER docker

IMPORTANT: Log out and log back in so that your group membership is re-evaluated. 3. Restart the docker daemon

$ sudo service docker restart

If you are on Ubuntu 14.04-15.10, use docker.io instead:

$ sudo service docker.io restart

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment