Skip to content

Instantly share code, notes, and snippets.

@thorvn
Last active February 4, 2025 06:36
Show Gist options
  • Save thorvn/d03a74c626a147b2779e7356392ffd32 to your computer and use it in GitHub Desktop.
Save thorvn/d03a74c626a147b2779e7356392ffd32 to your computer and use it in GitHub Desktop.
install docker aws ec2 user data for amazon linux
#!/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