skip to Main Content

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


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

    Login or Signup to reply.
  2. Use amazon-linux-extras to install docker

    # install
    sudo rm /etc/yum.repos.d/docker-ce.repo # if you have already tried in the wrong way
    sudo amazon-linux-extras install docker
    
    # enable on boot and start daemon
    sudo systemctl enable docker
    sudo systemctl start docker
    
    # correct permissions
    sudo usermod -a -G docker $USER
    newgrp docker
    docker ps
    
    Login or Signup to reply.
  3. 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 herehttps://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

    Login or Signup to reply.
  4. I installed docker using below link. May this be helping others

    https://docs.aws.amazon.com/AmazonECS/latest/developerguide/docker-basics.html

    enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search