Install Docker

sudo yum update -y
sudo yum -y install docker

Start Docker

sudo service docker start

Access Docker commands in ec2-user user

sudo usermod -a -G docker ec2-user
sudo chmod 666 /var/run/docker.sock
docker version
Answer from Prashanth Sams on Stack Overflow
🌐
Docker Hub
hub.docker.com › _ › amazonlinux
amazonlinux - Official Image | Docker Hub
You can run Amazon Linux container images in any Docker based environment. Examples include, your laptop, in AWS EC2 instances, and ECS clusters.
🌐
GitHub
gist.github.com › npearce › 6f3c7826c7499587f00957fee62f8ee9
Amazon Linux 2 - install docker & docker-compose using 'sudo amazon-linux-extras' command · GitHub
Amazon changed the install in Linux 2. One no-longer using 'yum' See: https://aws.amazon.com/amazon-linux-2/release-notes/ sudo amazon-linux-extras install docker sudo service docker start sudo usermod -a -G docker ec2-user
Discussions

How to install docker on Amazon Linux2 - Stack Overflow
I had to fix permission issue. Also described here How to fix docker: Got permission denied issue ... This response is misleading. The requester is asking how to install amazon-linux-extras. 2020-01-20T03:09:24.71Z+00:00 More on stackoverflow.com
🌐 stackoverflow.com
dockerfile - How to setup amazon Linux 2 docker image so it emulates an ec2 instance with an ec2-user - Stack Overflow
I am trying to get a docker image going for an amazon Linux upgrade project. I would like to do some local testing and was hoping to use docker to emulate an ec2 instance with Linux 2 running. Does More on stackoverflow.com
🌐 stackoverflow.com
Docker installation gives an error on Amazon Linux 2 when following the official documentation. Any ideas how to fix this?
Why not try the provided script instead? curl -fsSL https://get.docker.com -o get-docker.sh sudo sh get-docker.sh Does this fail too? Or download the .rpm https://download.docker.com/linux/centos/ and install that? https://download.docker.com/linux/centos/2/x86_64/stable/repodata/repomd.xml : For whatever reason the repo is trying to access the folder for version "2", which doesnt exist as you can see here . [docker-ce-stable] name=Docker CE Stable - $basearch baseurl=https://download.docker.com/linux/centos/$releasever/$basearch/stable enabled=1 gpgcheck=1 gpgkey=https://download.docker.com/linux/centos/gpg Probably because your OS is reporting version "2" as the OS version, but the Docker repo expects a version number for CentOS such as "9" and "2" is simply not supported at all. Maybe you can manually add the correct URL to your package manager. Look at documentation for CentOS/AL2. A 5 second Google search gives this for example: https://www.cyberciti.biz/faq/how-to-install-docker-on-amazon-linux-2/ More on reddit.com
🌐 r/docker
7
0
October 12, 2024
AWS linux container image
From the docs: The Amazon Linux container image contains a minimal set of packages. To install additional packages, use yum. So it won't include everything that's in the actual AMIs, if you need the aws cli you can just use yum install awscli More on reddit.com
🌐 r/aws
5
1
March 4, 2022
🌐
nixCraft
cyberciti.biz › nixcraft › howto › amazon cloud computing › how to install docker on amazon linux 2
How to install Docker on Amazon Linux 2 - nixCraft
October 8, 2024 - This page explains how to install Docker and docker-compose on Amazon Linux 2 to containerized applications on AMI on EC2/Lightsail cloud.
🌐
Medium
medium.com › axops-academy › setting-up-amazon-linux-2-docker-containers-on-macos-46d9dce8bf1c
Setting Up Amazon Linux 2 Docker Containers for AWS Development | by Ali Saif | AxOps Academy | Medium
February 23, 2024 - The -it flag opens the container in interactive mode, allowing you to interact directly with the Amazon Linux 2 environment from your terminal. Once inside the container, you can install necessary packages, configure settings, and modify the environment to fit your development needs. After setting up your environment, you can create a customized image using docker commit.
🌐
Medium
swapnasagarpradhan.medium.com › how-to-install-docker-on-amazon-linux-2-8e5161ac5464
How to install Docker on Amazon Linux 2 | by Swapnasagar Pradhan | Medium
October 15, 2022 - The procedure to install Docker on AMI 2 (Amazon Linux 2) Login into the remote AWS server using the ssh command or connect EC2 Instance Connect (browser-based SSH connection. Apply pending updates using the yum command: $ sudo yum update · ...
🌐
GitHub
gist.github.com › toricls › e17c7f2f1c024cc368dcd860804194f5
Docker-in-Docker with Amazon Linux 2 Container - Gist - GitHub
docker run -d --privileged \ --name ecs-anywhere \ -p 8080-8090:8080-8090 ecs-anywhere-node:latest docker exec -it ecs-anywhere /bin/bash
Find elsewhere
🌐
DEV Community
dev.to › rodrigobruner › how-to-install-docker-on-amazon-linux-2-1na4
How to install Docker on Amazon Linux 2 - DEV Community
May 29, 2023 - Sep 08 05:03:52 amazon.example.local dockerd[3312]: time=2021-09-08T05:03... Hint: Some lines were ellipsized, use -l to show in full. ... Client: Version: 20.10.13 API version: 1.41 Go version: go1.16.15 Git commit: a224086 Built: Thu Mar 31 ...
🌐
AWS
docs.aws.amazon.com › aws cloud9 › user guide › tutorials for aws cloud9 › docker tutorial for aws cloud9
Docker tutorial for AWS Cloud9 - AWS Cloud9
To do this, with the SSH client still connected to the instance, in the /tmp directory on the instance, create a file named Dockerfile. For example, run the touch command as follows. ... Add the following contents to the Dockerfile file. # Build a Docker image based on the Amazon Linux 2 Docker ...
🌐
Stack Overflow
stackoverflow.com › questions › 73643235 › how-to-setup-amazon-linux-2-docker-image-so-it-emulates-an-ec2-instance-with-an
dockerfile - How to setup amazon Linux 2 docker image so it emulates an ec2 instance with an ec2-user - Stack Overflow
I don't know what user groups are currently setup in their Linux version. I would like to be able to use ansible to setup things via ssh with ec2-user keys. Here is my dockerfile so far... FROM amazonlinux:2 RUN yum -y upgrade && \ amazon-linux-extras install -y epel && \ yum -y install openssh && \ yum -y install sudo && \ groupadd -g 1000 ec2-user && \ useradd -u 1000 -g ec2-user -m ec2-user -G docker && \ usermod -p "*" ec2-user &&\ su - ec2-user && \ mkdir .ssh && \ chmod 700 .ssh && \ touch .ssh/authorized_keys && \ chmod 600 .ssh/authorized_keys EXPOSE 80 CMD ["/bin/bash while true; do sleep 1000; done"]
🌐
Docker Hub
hub.docker.com › r › amd64 › amazonlinux
amd64/amazonlinux - Docker Image
You can run Amazon Linux container images in any Docker based environment. Examples include, your laptop, in AWS EC2 instances, and ECS clusters.
🌐
LinuxVox
linuxvox.com › blog › amazon-linux-docker-image
Amazon Linux Docker Image: A Comprehensive Guide — linuxvox.com
These images are available on Docker Hub and Amazon Elastic Container Registry (ECR), and they come in different versions, such as Amazon Linux 2 and Amazon Linux 2023. You can pull the Amazon Linux Docker image from Docker Hub using the docker pull command. Here is an example of pulling the ...
🌐
Untitled Publication
innosufiyan.hashnode.dev › installing-docker-on-amazon-linux-ec2-instance
Installing Docker on Amazon Linux EC2 Instance
January 23, 2025 - Amazon Linux provides a package manager called Yum. It’s similar to npm for Node.js and allows us to install and update applications and packages. First, we need to update the existing packages installed on our EC2 instance to ensure that we’re using the latest versions with all the latest security updates. To do this, run: ... Now that the packages are updated, we’ll install Docker using the Yum install command.
🌐
AWS
docs.aws.amazon.com › amazon linux › user guide › using al2023 on aws › using al2023 in containers › using the al2023 base container image
Using the AL2023 base container image - Amazon Linux 2023
1 month ago - Authenticate your Docker client to the Amazon Linux Public registry. Authentication tokens are valid for 12 hours. For more information, see Private registry authentication in the Amazon Elastic Container Registry User Guide. The get-login-password command is supported using the latest version of AWS CLI version 2...
🌐
Medium
medium.com › @geeekfa › docker-and-docker-compose-on-aws-linux-2-9e90f79502db
Docker and Docker Compose on AWS Linux 2 | by GeeekFa | Medium
December 13, 2023 - docker login # amd64 docker buildx build --platform linux/amd64 -t <your_docker_hub_username>/api-flask:latest-amd64 --push . # arm64 docker buildx build --platform linux/arm64 -t <your_docker_hub_username>/api-flask:latest-arm64 --push .
🌐
DEV Community
dev.to › dasanirban834 › docker-installation-on-amazon-linux-2-or-amazon-linux-2023-5afa
Docker: Installation on Amazon Linux 2 or Amazon Linux 2023 - DEV Community
September 8, 2024 - Linux: https://docs.docker.com/desktop/install/linux-install/ MAC: https://docs.docker.com/desktop/install/mac-install/ Windows: https://docs.docker.com/desktop/install/windows-install/
🌐
LinuxVox
linuxvox.com › blog › docker-amazon-linux
Docker on Amazon Linux: A Comprehensive Guide — linuxvox.com
An Amazon Linux instance (Amazon Linux 2 is recommended). Root or sudo privileges. Update the installed packages and package cache on your instance: ... Log out and log back in for the group changes to take effect. Create a Dockerfile in your project directory. Here is a simple example for a Python Flask application: