Skip to content

Instantly share code, notes, and snippets.

@sw360cab
Last active June 5, 2020 18:05
Show Gist options
  • Save sw360cab/2cea97953944f7bf563fd7abedecff59 to your computer and use it in GitHub Desktop.
Save sw360cab/2cea97953944f7bf563fd7abedecff59 to your computer and use it in GitHub Desktop.
Simply add Docker in a AWS AMI Linux
#!/bin/sh
# installing Docker CE on AWS AMI Linux
# Run remotely with -> source <(curl -s http://<remote-address-of-this-script>.sh)
set -e
# Run as su
if [ `id -u` -ne 0 ]
then
echo "You need to be root to run this script"
exit 1
fi
yum update -y
amazon-linux-extras install -y docker
usermod -aG docker ec2-user
unset DOCKER_HOST
service docker restart > /dev/null 2>&1 || true
# install Docker Compose
read -r -p "Do Yo want to install Docker Compose? [y/N] " response
case $response in
[yY][eE][sS]|[yY])
# install compose
curl -L https://github.com/docker/compose/releases/download/1.24.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
;;
*)
echo ""
;;
esac
echo "Logout/Login from session may be required"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment