Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to install docker on AWS Linux AMI

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?

like image 262
zilcuanu Avatar asked Mar 15 '20 07:03

zilcuanu


People also ask

How do I run Docker on AWS Ami?

To get Docker running on the AWS AMI you should follow the steps below (these are all assuming you have ssh'd on to the EC2 instance). Add the ec2-user to the docker group so you can execute Docker commands without using sudo.

How do I start a docker service without Sudo?

Install the most recent Docker Community Edition package. Start the Docker service. Add the ec2-user to the docker group so you can execute Docker commands without using sudo.

How do I install Docker on an Amazon EC2 instance?

You can install Docker on an EC2 instance using the Amazon Linux 2 or Amazon Linux Operating System Migration Studio. Your instance should now communicate with your browser. Make sure the installed packages and cache are up to date in your instance. Make sure you have installed the most recent Docker Engine package.

Is it possible to run yum update before installing Docker?

@VikrantPawar yes. I have run the sudo yum update before installing docker No luck: sudo yum --nogpgcheck localinstall docker-ce docker-ce -cli containerd.io Loaded plugins: priorities, update-motd, upgrade-helper Skipping: docker-ce, filename does not end in .rpm. Skipping: docker-ce-cli, filename does not end in .rpm.


1 Answers

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).

  1. Update the installed packages and package cache on your instance.

    sudo yum update -y

  2. Install the most recent Docker Community Edition package.

    sudo amazon-linux-extras install docker

  3. Start the Docker service.

    sudo service docker start

  4. Add the ec2-user to the docker group so you can execute Docker commands without using sudo.

    sudo usermod -a -G docker ec2-user

  5. 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.

  6. Verify that the ec2-user can run Docker commands without sudo.

    docker info

like image 130
kakabali Avatar answered Sep 26 '22 07:09

kakabali