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 OverflowDocker 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.
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
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
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
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
Videos
06:52
How to Install Docker on Amazon Linux 2 - YouTube
07:57
How to Install Docker and Docker Compose on Amazon Linux 2023 - ...
58:34
Install Docker on Amazon Linux 2 EC2 | Step-by-Step AWS Docker ...
How to setup and use Docker on Free AWS Linux | Complete beginners ...
01:03
How to Install Docker in Amazon Linux 2023 | sudo yum install -y ...
08:10
How To Install & Run Docker on AWS EC2 Linux Instance | Amazon ...
Top answer 1 of 9
50
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
2 of 9
19
So sorry, it was my misunderstanding. My OS is Redhat Linux. I get to install docker by
yum-config-manager --enable rhui-REGION-rhel-server-extras
sudo yum -y install docker
systemctl start docker
systemctl enable docker
docker version
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.
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
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.docker.com › layers › library › amazonlinux › 2 › images › sha256-37b666a59e80b8b0c78f8e3396c944fe4cf0a1ba27e3d6d93324d3f57a2cfeb5
Image Layer Details - amazonlinux:2
© 2026 Docker, Inc. All rights reserved. | Terms of Service | Subscription Service Agreement | Privacy | Legal
AWS
docs.aws.amazon.com › aws simspace weaver › user guide for version 1.16.0 › setting up for simspace weaver › set up your local environment for simspace weaver › set up amazon linux 2 (al2) in docker
Set up Amazon Linux 2 (AL2) in Docker - AWS SimSpace Weaver
This section provides instructions for setting up your local AL2 environment in Docker . For instructions to set up AL2 in Windows Subsystem for Linux (WSL) , see .
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.
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 › aws serverless application model › developer guide › aws sam reference › installing docker to use with the aws sam cli
Installing Docker to use with the AWS SAM CLI - AWS Serverless Application Model
Instructions about installing Docker for use with the AWS SAM CLI.
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...
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: