Last active
January 19, 2024 01:34
-
-
Save mustafaturan/934c0c3a7ad9e4e319868a8ac6d0b11e to your computer and use it in GitHub Desktop.
Install docker and run without sudo on Raspberry Pi
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 | |
curl -fsSL https://get.docker.com/rootless | sh | |
# Content to be added to .bashrc | |
content='export PATH="$HOME/bin:$PATH"' | |
# Check if content already exists in .bashrc | |
if grep -Fxq "$content" ~/.bashrc; then | |
echo "Content for bin path already exists in .bashrc. Skipping addition." | |
else | |
# Append content to .bashrc | |
echo "$content" >> ~/.bashrc | |
echo "Content for bin path added to .bashrc successfully." | |
fi | |
# Content to be added to .bashrc | |
dockerhost='export DOCKER_HOST=unix://$XDG_RUNTIME_DIR/docker.sock' | |
# Check if content already exists in .bashrc | |
if grep -Fxq "$dockerhost" ~/.bashrc; then | |
echo "Content for dockerhost already exists in .bashrc. Skipping addition." | |
else | |
# Append content to .bashrc | |
echo "$dockerhost" >> ~/.bashrc | |
echo "Content for dockerhost added to .bashrc successfully." | |
fi |
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 | |
# Install docker | |
curl -sSL https://get.docker.com | sh | |
# Create docker user group | |
sudo groupadd docker | |
# Add current user to the docker group | |
sudo gpasswd -a $USER docker | |
# Apply changes | |
newgrp docker | |
# Install docker compose https://docs.docker.com/compose/install/linux/#install-using-the-repository | |
# exit (or reboot) | |
exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment