I followed the steps to install docker
on my EC2
instance which is based on Amazon AMI
using the instructions from the official link – official docker installation on centos. I am getting the below error.
$ sudo yum update
........
$ sudo yum install docker-ce docker-ce-cli containerd.io
........
--------> Finished Dependency Resolution
Error: Package: 3:docker-ce-19.03.8-3.el7.x86_64 (docker-ce-stable)
Requires: systemd
Error: Package: 3:docker-ce-19.03.8-3.el7.x86_64 (docker-ce-stable)
Requires: libsystemd.so.0(LIBSYSTEMD_209)(64bit)
Error: Package: 3:docker-ce-19.03.8-3.el7.x86_64 (docker-ce-stable)
Requires: container-selinux >= 2:2.74
Error: Package: containerd.io-1.2.13-3.1.el7.x86_64 (docker-ce-stable)
Requires: systemd
Error: Package: 3:docker-ce-19.03.8-3.el7.x86_64 (docker-ce-stable)
Requires: libsystemd.so.0()(64bit)
Error: Package: containerd.io-1.2.13-3.1.el7.x86_64 (docker-ce-stable)
Requires: container-selinux >= 2:2.74
Where am I going wrong?
4
Answers
Amazon AMI best practices are to use their install procedures. You, of course, are at your liberty to do what best fits your needs:
https://docs.aws.amazon.com/AmazonECS/latest/developerguide/docker-basics.html
Figured it out because I had a similar issue an hour ago, and just realized I was doing it wrong:
https://serverfault.com/questions/836198/how-to-install-docker-on-aws-ec2-instance-with-ami-ce-ee-update
Use amazon-linux-extras to install docker
Solution in context of the image – Amazon Linux 2 AMI
One may need to remove the packages they installed using docker provided links
use the command here to remove all of that:-
sudo rm /etc/yum.repos.d/docker-ce.repo
And use the link given by AWS to install the docker here – https://docs.aws.amazon.com/AmazonECS/latest/developerguide/docker-basics.html
The content for that commands in that link are as below:-
Connect to your instance(Amazon Linux 2 AMI).
Update the installed packages and package cache on your instance.
sudo yum update -y
Install the most recent Docker Community Edition package.
sudo amazon-linux-extras install docker
Start the Docker service.
sudo service docker start
Add the ec2-user to the docker group so you can execute Docker commands without using sudo.
sudo usermod -a -G docker ec2-user
Log out and log back in again to pick up the new docker group permissions. You can accomplish this by closing your current SSH terminal window and reconnecting to your instance in a new one. Your new SSH session will have the appropriate docker group permissions.
Verify that the ec2-user can run Docker commands without sudo.
docker info
I installed docker using below link. May this be helping others
https://docs.aws.amazon.com/AmazonECS/latest/developerguide/docker-basics.html