Last active
February 4, 2025 06:36
-
-
Save thorvn/d03a74c626a147b2779e7356392ffd32 to your computer and use it in GitHub Desktop.
install docker aws ec2 user data for amazon linux
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 | |
# Update the system | |
dnf update -y | |
# Install docker package | |
dnf install docker -y | |
# Start Docker service | |
systemctl start docker | |
# Enable Docker to start on boot | |
systemctl enable docker | |
# Add ec2-user to docker group | |
usermod -a -G docker ec2-user | |
# Optional: Install additional useful tools | |
dnf install -y \ | |
git \ | |
jq \ | |
yum-utils \ | |
htop | |
# Print Docker version for verification | |
docker --version |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment