Created
May 8, 2025 06:49
-
-
Save vnkdj5/2392fc02289d9c01dd783d7fa463e97e to your computer and use it in GitHub Desktop.
Docker related Gists for local setup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Check if user is already in the docker group | |
if groups $USER | grep &>/dev/null '\bdocker\b'; then | |
echo "β User '$USER' is already in the docker group." | |
else | |
echo "β Adding user '$USER' to the docker group..." | |
sudo usermod -aG docker $USER | |
echo "π Applying group changes to current session..." | |
newgrp docker | |
fi | |
# Test docker access | |
echo "π Testing Docker access without sudo..." | |
if docker ps &>/dev/null; then | |
echo "β Docker is working without sudo!" | |
else | |
echo "β Docker still requires sudo. Try logging out and back in, or reboot." | |
fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment