docker:allow_docker_to_be_run_without_using_sudo
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
docker:allow_docker_to_be_run_without_using_sudo [2025/05/20 15:33] – created peter | docker:allow_docker_to_be_run_without_using_sudo [2025/05/20 15:39] (current) – peter | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Docker - Allow docker to be run without using sudo ====== | ====== Docker - Allow docker to be run without using sudo ====== | ||
+ | |||
+ | ===== Add current user to the docker group ===== | ||
+ | |||
+ | <code bash> | ||
+ | sudo usermod -aG docker $USER | ||
+ | </ | ||
+ | |||
+ | <WRAP info> | ||
+ | **NOTE: | ||
+ | |||
+ | To enable this functionality, | ||
+ | newgrp docker | ||
+ | </ | ||
+ | |||
+ | </ | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ===== Add a specific user to the docker group ===== | ||
+ | |||
+ | ==== Determine the username ==== | ||
+ | |||
+ | <code bash> | ||
+ | whoami | ||
+ | </ | ||
+ | |||
+ | returns: | ||
+ | |||
+ | < | ||
+ | peter | ||
+ | </ | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ==== Add this user to the docker group ==== | ||
+ | |||
+ | <code bash> | ||
+ | sudo usermod -aG docker peter | ||
+ | </ | ||
+ | |||
+ | <WRAP info> | ||
+ | **NOTE: | ||
+ | </ | ||
+ | |||
+ | |||
+ | ---- | ||
+ | |||
+ | ==== Enable this functionality ==== | ||
+ | |||
+ | Either log out and log back in; or run: <code bash> | ||
+ | newgrp docker | ||
+ | </ | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ===== Verify that docker commands can be run without sudo ===== | ||
+ | |||
+ | <code bash> | ||
+ | docker run hello-world | ||
+ | </ | ||
+ | |||
+ | <WRAP info> | ||
+ | **NOTE: | ||
+ | |||
+ | <code bash> | ||
+ | sudo chmod 666 / | ||
+ | </ | ||
+ | |||
+ | </ | ||
+ | |||
+ | ---- | ||
+ | |||
docker/allow_docker_to_be_run_without_using_sudo.1747755212.txt.gz · Last modified: 2025/05/20 15:33 by peter