Skip to content

Instantly share code, notes, and snippets.

@jose16-21
Last active August 19, 2023 22:33
Show Gist options
  • Save jose16-21/06df3c82bb0116f3d141fb9b678ceb61 to your computer and use it in GitHub Desktop.
Save jose16-21/06df3c82bb0116f3d141fb9b678ceb61 to your computer and use it in GitHub Desktop.
How to install Docker on Amazon Linux 2

Apply pending updates using the yum command:

  • sudo yum update

Search for Docker package:

  • sudo yum search docker

Get version information:

  • sudo yum info docker

Install docker, run:

  • sudo yum install docker

Add group membership for the default ec2-user so you can run all docker commands without using the sudo command:

  • sudo usermod -a -G docker ec2-user
  • id ec2-user
  • newgrp docker

Enable docker service at AMI boot time

  • sudo systemctl enable docker.service
Start the Docker service
  • sudo systemctl start docker.service
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment