DEV Community

moogoo
moogoo

Posted on

Install Docker and docker-compose on AWS EC2 (AMI)

Amazon Linux 2

Install Docker

# Update AMI yum packages
$ sudo yum update
# Install Docker by yum
$ sudo yum install docker
# add docker group to ec2-user
$ sudo usermod -a -G docker ec2-user
$ id ec2-user
Enter fullscreen mode Exit fullscreen mode

Install docker-compose

$ wget https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m) 
$ sudo mv docker-compose-$(uname -s)-$(uname -m) /usr/local/bin/docker-compose
$ sudo chmod -v +x /usr/local/bin/docker-compose
Enter fullscreen mode Exit fullscreen mode

Configure docker service

# start service at boot
$ sudo systemctl enable docker.service
# start service now
$ sudo systemctl start docker.service
Enter fullscreen mode Exit fullscreen mode

check service

$ sudo systemctl status docker.service
Enter fullscreen mode Exit fullscreen mode

Top comments (0)