Skip to content

Instantly share code, notes, and snippets.

@sostenesapollo
Forked from dhoeric/Ubuntu 16.04
Created June 20, 2024 13:50
Show Gist options
  • Save sostenesapollo/52cd6f84341cbfa9b16b8f196618c265 to your computer and use it in GitHub Desktop.
Save sostenesapollo/52cd6f84341cbfa9b16b8f196618c265 to your computer and use it in GitHub Desktop.
install-docker-aws-ec2-user-data
#!/bin/bash
# Install docker
apt-get update
apt-get install -y apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
apt-get update
apt-get install -y docker-ce
usermod -aG docker ubuntu
# Install docker-compose
curl -L https://github.com/docker/compose/releases/download/1.21.0/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
# READ MORE: https://docs.docker.com/install/linux/docker-ce/ubuntu/
# To check: grep "cloud-init\[" /var/log/syslog
# OR: less /var/log/cloud-init-output.log
# Manually add user to docker group
# sudo usermod -aG docker $USER
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment