If you're using the EC2 Container service, the AWS ECS-optimized AMI (2015.09.b) is running docker-1.7.1 as of this writing. A post in the AWS forums states "[AWS is] testing 1.9 RC and plan to deliver it this month."

To expand on Hzmy's answer, here's how to upgrade Docker to 1.9.0 in an SSH session:

service docker stop
cp /usr/bin/docker /usr/bin/docker.old
curl -o /usr/bin/docker https://get.docker.com/builds/Linux/x86_64/docker-1.9.0
service docker start

If you're using CloudFormation templates, here's a command you can drop in your AWS::Cloudformation::Init:

...
"commands": {
    ...,
    "03_upgrade_docker_for_log_driver_support": {
        "command": {
            "Fn::Join": [
                "",
                [
                    "#!/bin/bash -xe\n",
                    "service docker stop\n",
                    "cp /usr/bin/docker /usr/bin/docker.old\n",
                    "curl -o /usr/bin/docker https://get.docker.com/builds/Linux/x86_64/docker-1.8.3\n",
                    "service docker start\n"
                ]
            ]
        }
    }
    ...
}
...

Maybe not the cleanest, but it seems to work for me.

Answer from Pete on Stack Overflow
🌐
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
🌐
Docker Hub
hub.docker.com › _ › amazonlinux
amazonlinux - Official Image | Docker Hub
Yes; in order to avoid any disruption to your existing applications and to facilitate migration to Amazon Linux 2023, AWS will provide regular security updates for Amazon Linux 2 and Amazon Linux 2018.03. Please refer to their FAQs for more information.
Discussions

Not sure how to update Amazon Linux 2 packages for docker container
As part of your Dockerfile you can still try to update the packages by executing yum. That’s assuming the packages were installed via the package manager and not compiled from source by hand. However you should also hit up the owner of the image and nudge them to update things. More on reddit.com
🌐 r/aws
6
1
December 17, 2021
Upgrading Docker on Amazon Linux AMI - Stack Overflow
The only thing I corrected is that haveged installation is not necessary on the latest Amazon Linux 2 LTS Candidate. Also, since SELinux is disabled by default on Amazon Linux, so all the steps realated to SELinux are not necessary too, but container-selinux is required by docker-ce, so it ... More on stackoverflow.com
🌐 stackoverflow.com
Updating docker engine and docker compose plugin in Amazon Linux 2?
I have an Amazon AWS EC2 instance running Amazon Linux 2. It has Docker engine 25.0.5 installed (which is an old version that comes with Docker compose v2.3.3). Via yum, the docker package is already up to date. There exists a vulnerability in this version of Docker Engine (Docker Engine | Tenable®) I need to update ... More on forums.docker.com
🌐 forums.docker.com
4
0
November 20, 2024
How do I install docker version 27.3.1 on Amazon Linux 2023?
Updated docker packages addressing the issue are available for Amazon Linux 2 (docker-20.10.25-1.amzn2.0.5 and docker-25.0.6-1.amzn2.0.1) and for Amazon Linux 2023 (docker-25.0.6-1amzn2023.0.1). AWS recommends that customers using docker upgrade to these or later versions. More on repost.aws
🌐 repost.aws
5
0
November 27, 2024
🌐
Docker Community
forums.docker.com › docker engine › general
Updating docker engine and docker compose plugin in Amazon Linux 2? - General - Docker Community Forums
November 20, 2024 - I have an Amazon AWS EC2 instance running Amazon Linux 2. It has Docker engine 25.0.5 installed (which is an old version that comes with Docker compose v2.3.3). Via yum, the docker package is already up to date. There …
Top answer
1 of 5
4
Here is what has worked for me: ``` sudo dnf update -y # Remove old version sudo dnf remove -y docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-engine # Install dnf plugin sudo dnf -y install dnf-plugins-core # Add CentOS repository sudo dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo # Adjust release server version in the path as it will not match with Amazon Linux 2023 sudo sed -i 's/$releasever/9/g' /etc/yum.repos.d/docker-ce.repo # Install as usual sudo dnf -y install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin # Enable the docker service sudo systemctl enable --now docker ```
2 of 5
1
`My EC2 VM currently has Docker version 25.0.5, build 5dc9bcc installed, but this version has a security flaw that has been patched in versions 27.1.1 and above.` Are you referring to CVE-2024-41110? Affected versions include `<= v25.0.5` and `<= v27.1.0` You can refer to Amazon Linux Security Center ALAS-2024-674 which mentions `AWS is aware of CVE-2024-41110, an issue affecting the Moby open source project, packaged in Amazon Linux as "docker". Docker is a component of several open source container management systems.` `Updated docker packages addressing the issue are available for Amazon Linux 2 (docker-20.10.25-1.amzn2.0.5 and docker-25.0.6-1.amzn2.0.1) and for Amazon Linux 2023 (docker-25.0.6-1amzn2023.0.1). AWS recommends that customers using docker upgrade to these or later versions. (CVE-2024-41110)` On my AL2023, docker 25.0.6 is installed ``` $ cat /etc/os-release | grep PRETTY PRETTY_NAME="Amazon Linux 2023.6.20241121" $ dnf info docker Installed Packages Name : docker Version : 25.0.6 Release : 1.amzn2023.0.2 Architecture : aarch64 Size : 150 M Source : docker-25.0.6-1.amzn2023.0.2.src.rpm Repository : @System From repo : amazonlinux Summary : Automates deployment of containerized applications URL : http://www.docker.com License : ASL 2.0 and MIT and BSD and MPLv2.0 and WTFPL Description : Docker is an open-source engine that automates the deployment of any : application as a lightweight, portable, self-sufficient container that will : run virtually anywhere. : : Docker containers can encapsulate any payload, and will run consistently on : and between virtually any server. The same container that a developer builds : and tests on a laptop will run at scale, in production*, on VMs, bare-metal : servers, OpenStack clusters, public instances, or combinations of the above. ```
Find elsewhere
Top answer
1 of 2
3
Hi Slacker, please try this solution it will be helpful for you. To prepare for the upcoming Docker version 20.10 update in your AWS EKS cluster running Amazon Linux 2 nodes, you should follow a systematic approach to ensure minimal disruption and continued application stability. Begin by reviewing the AWS notification and Docker 20.10 release notes to understand the scope and impact of the update. Next, create a staging environment that mirrors your production setup, and update Docker in this environment to test your applications thoroughly. Deploy your applications to the staging cluster and run comprehensive tests, including unit, integration, and load tests, to verify compatibility and performance. Once validated, plan the update for your production environment during a scheduled maintenance window to minimize user impact. For managed node groups, update the node group to the latest Amazon EKS optimized AMI that includes Docker 20.10. For self-managed nodes, manually update Docker using package management commands, ensuring you drain and uncord on nodes one at a time to maintain service availability. Monitor your applications closely using tools like AWS CloudWatch or Prometheus to track performance and health post-update. By carefully planning, testing, and executing the update, you can ensure a smooth transition to Docker 20.10 with minimal service interruptions. please look at Documents you will get more information. https://docs.docker.com/reference/cli/docker/service/update/ https://askubuntu.com/questions/472412/how-do-i-upgrade-docker
2 of 2
6
**Review the Docker Version Change: **Understand the details of the Docker version change, including any new features, bug fixes, and potential compatibility issues. Docker version upgrades often include improvements and security patches, so it's important to stay informed about the changes. **Compatibility with EKS**: Ensure that the new Docker version is compatible with AWS EKS. While AWS EKS is designed to work seamlessly with Docker, it's still recommended to check for any compatibility issues or known limitations. **Test in Non-Production Environment:** Before applying the Docker version update to your production EKS cluster, consider testing it in a non-production environment. Create a test cluster with similar configurations and deploy your applications to verify compatibility and identify any issues proactively. **Backup and Rollback Plan**: Always have a backup and rollback plan in place before making any changes to your production environment. Take snapshots of your EKS cluster, including both control plane and worker nodes, so that you can revert to the previous state if necessary. **Monitor for Service Interruptions: **During the Docker version update, monitor your EKS cluster and applications closely for any service interruptions or performance issues. Use AWS CloudWatch metrics, EKS logs, and application monitoring tools to track the health and performance of your services. **Communicate with Stakeholders:** Keep your team and stakeholders informed about the Docker version update and any planned maintenance windows. Communicate the potential impact on services and outline the steps you're taking to minimize disruptions. https://stackoverflow.com/questions/63279765/docker-how-to-update-your-container-when-your-code-changes
🌐
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 - Make a new Dockerfile using a text ... test image for installing static webpage with Apache2" # Install apache2 with less RUN yum -y update && \ yum -y install httpd && \ yum clean all # Sample index.html for test COPY index.html ...
Top answer
1 of 5
98

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

  1. Update the packages on your instance

    [ec2-user ~]$ sudo yum update -y

  2. Install Docker

    [ec2-user ~]$ sudo yum install docker -y

  3. Start the Docker Service

    [ec2-user ~]$ sudo service docker start

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

    [ec2-user ~]$ sudo usermod -a -G docker ec2-user

You should then be able to run all of the docker commands without requiring sudo. After running the 4th command I did need to logout and log back in for the change to take effect.

2 of 5
7

The hardest part to figure all of this out was the container-selinux requirement. Just find the latest version in http://mirror.centos.org/centos/7/extras/x86_64/Packages/ and install that first. In addition EC2 instances may not have a proper entropy generator so haveged may need to be installed.

The rest is taken from https://docs.docker.com/install/linux/docker-ce/centos/ with the addition of haveged and firewalld. All these have to be done as root so sudo appropriately.

yum install -q -y http://mirror.centos.org/centos/7/extras/x86_64/Packages/container-selinux-2.42-1.gitad8f0f7.el7.noarch.rpm
yum install -q -y http://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/h/haveged-1.9.1-1.el7.x86_64.rpm
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum install -q -y firewalld docker-ce
systemctl enable firewalld
systemctl start firewalld
firewall-cmd --add-port=2377/tcp --permanent
firewall-cmd --add-port=2376/tcp --permanent
firewall-cmd --add-port=7946/tcp --permanent
firewall-cmd --add-port=7946/udp --permanent
firewall-cmd --add-port=4789/udp --permanent
firewall-cmd --zone=public --permanent --add-masquerade
firewall-cmd --reload
systemctl enable haveged
systemctl start haveged
systemctl enable docker
systemctl start docker
setenforce 1

Enable SELinux by modifying /etc/sysconfig/selinux to be

SELINUX=enforcing
SELINUXTYPE=targeted

Then reboot your instance by issuing shutdown -r now

Executing sudo docker version should yield as of the time of this posting...

Client:
 Version:       18.03.0-ce
 API version:   1.37
 Go version:    go1.9.4
 Git commit:    0520e24
 Built: Wed Mar 21 23:09:15 2018
 OS/Arch:       linux/amd64
 Experimental:  false
 Orchestrator:  swarm

Server:
 Engine:
  Version:      18.03.0-ce
  API version:  1.37 (minimum version 1.12)
  Go version:   go1.9.4
  Git commit:   0520e24
  Built:        Wed Mar 21 23:13:03 2018
  OS/Arch:      linux/amd64
  Experimental: false
🌐
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 · 3. ...
🌐
OneUptime
oneuptime.com › home › blog › how to install docker on amazon linux 2023
How to Install Docker on Amazon Linux 2023
February 8, 2026 - AL2023 is a versioned distribution with deterministic updates, but it is still good practice to start fresh. Docker is available in the default AL2023 package repository. No need to add external repos. # Install Docker from the AL2023 default repository sudo dnf install -y docker · This installs the Docker Engine, CLI, and containerd. The version may be slightly behind Docker's official releases because Amazon packages and tests it for compatibility.
🌐
Untitled Publication
innosufiyan.hashnode.dev › installing-docker-on-amazon-linux-ec2-instance
Installing Docker on Amazon Linux EC2 Instance
January 23, 2025 - Now that the packages are updated, we’ll install Docker using the Yum install command. Run: ... This installs the Docker package on your Amazon Linux EC2 instance.
🌐
Tenable
tenable.com › plugins › nessus › 306289
Amazon Linux 2 : docker, --advisory ALAS2DOCKER-2026-108 (ALAS...<!-- --> | Tenable®
April 13, 2026 - Run 'yum update docker' or or 'yum update --advisory ALAS2DOCKER-2026-108' to update your system. https://alas.aws.amazon.com//AL2/ALAS2DOCKER-2026-108.html
🌐
Saturn Cloud
saturncloud.io › blog › how-to-install-docker-on-amazon-linux-2
Saturn Cloud | Saturn Cloud | The Control Plane for GPU Clouds
June 19, 2023 - Saturn Cloud is the white-labeled control plane for GPU clouds: multi-tenant isolation, day-2 support, and integrated billing, running in your cloud under your brand.