To start our series of posts, with the main objective of knowledge sharing, I'll explain the simpler way to install Docker CE and Docker Compose within an EC2 instance.
Since the second version of Amazon Linux AMI, AWS has changed the way of installing some OS packages, for that, we won't use the default package manager yum. For more details, take a look at the release notes.
Installing Docker CE
sudo amazon-linux-extras install docker sudo service docker start sudo usermod -a -G docker ec2-user
Enabling Docker service to automatic start at boot.
sudo chkconfig docker on
Installing some extra packages, git and netcat (nc).
sudo yum install -y git nc
Installing Docker Compose
Download the latest version, directly from GitHub.
sudo curl -L https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose
Change the file permissions, to make it executable.
sudo chmod +x /usr/local/bin/docker-compose
Check the Docker Compose version.