Install Docker and docker-compose on Amazon Linux

Responsive image

I often have to deploy an AWS instance running on Amazon Linux and using it to deploy Docker containers.

As Amazon Linux don’t come with Docker preinstalled, you have to do it manually. Or even better, through a script in the user-data section of your launch template.

Here’s the script you’ll need to install the latest version of Docker and docker-compose.

# Install docker
sudo yum install docker
sudo usermod -aG docker ec2-user

# Install docker-compose
sudo curl -L https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose && sudo chmod +x /usr/local/bin/docker-compose

# Verify install
docker --version
docker-compose version
Written on March 20th, 2020 by Samy Gejzenblozen

Tags:


Social networks

You may also enjoy:

Configure SSL Certificates on AWS EBS

Configure SSL Certificates on AWS EBS

#AWS #devops

Elastic Beanstalk is a fantastic way to deploy and manage web applications. Today, for most web apps, you’ll need SSL certificates to encrypt data between users and your server. For this, we’ll use Let’s Encrypt Certificate Authority which provides free SSL certificates and is supported by a wide array of browsers. To generate the certificate, ... Read more

20 Nov 2017 - 2 minute read