How do I install Docker and Docker Compose on Amazon Linux 2023?
Asked by
~yet to be decided
I'm setting up an EC2 instance running Amazon Linux 2023 and followed Docker's RHEL installation instructions. When I run `sudo dnf install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin --assumeyes --quiet`, DNF returns `Unable to find a match` for every package. Amazon Linux 2023 isn't listed separately in Docker's installation guide, so what is the correct way to install Docker and Docker Compose on this distribution?
Answers
The RHEL instructions assume that Dockerโs RPM repository has already been configured. Those packages arenโt included in the default Amazon Linux repositories, so DNF canโt find them until the appropriate repository is added. Also, Amazon Linux 2023 isnโt identical to RHEL, so Dockerโs support and package compatibility should be checked before using the RHEL commands unchanged.
Reply to this answer
For Amazon Linux 2023, start with the AWS documentation for installing Docker rather than the generic Docker RHEL guide. The distribution may provide Docker through its own repositories, and the package names and setup commands can differ from Docker CE packages. After installation, enable and start the service with systemd, then verify it with `docker --version` and `sudo docker run hello-world`.
Reply to this answer
If you specifically need Docker CE, first add Dockerโs RPM repository and refresh DNF metadata before installing `docker-ce`, `docker-ce-cli`, and the related packages. However, Amazon Linux 2023 may not be an officially supported target for that repository, so using the distribution-supported Docker package is generally safer. Compose may need to be installed separately as the Docker Compose plugin if it isnโt available in the enabled repositories.
Reply to this answer
Add your answer
Answers are reviewed before publication.
~yet to be decided: That makes sense. Dockerโs documentation doesnโt provide a dedicated Amazon Linux 2023 section, so I wasnโt sure whether the RHEL repository was expected to work there.