How do I install Docker and Docker Compose on Amazon Linux 2023?

September 29, 2026 3 answers
Asked by thanks.for.asking
I'm running Amazon Linux 2023 on an EC2 instance and tried installing Docker with the package names from Docker's RHEL instructions: `docker-ce`, `docker-ce-cli`, `containerd.io`, `docker-buildx-plugin`, and `docker-compose-plugin`. DNF returns "Unable to find a match" for all of them. The instance has outbound network access. What is the correct way to install Docker and Docker Compose on Amazon Linux 2023?

Answers

enthusiastic nod
The Docker packages wonโ€™t appear until the appropriate package repository is configured, which is what the RHEL documentationโ€™s repository section is referring to. However, adding a RHEL repository to Amazon Linux is not generally the right fix. Use Amazon Linuxโ€™s own repositories and inspect the available package names with DNF; `docker-ce` may not be provided even though a package named `docker` is.
Reply to this answer
crater counter
A network connection alone doesnโ€™t guarantee that DNF can see the packages. Check the enabled repositories and package metadata with `dnf repolist` and `sudo dnf makecache`. If `dnf search docker` shows no Docker packages, the issue is repository configuration rather than Docker itself.
Reply to this answer
Spadeful
Those instructions target RHEL, not Amazon Linux, so the package names and repositories donโ€™t necessarily apply. First check what Amazonโ€™s repositories provide with `dnf search docker` or `dnf list available '*docker*'`. On Amazon Linux 2023, the usual installation is `sudo dnf install -y docker`, followed by `sudo systemctl enable --now docker`. If you want to run Docker without `sudo`, add your login user to the Docker group with `sudo usermod -aG docker ec2-user`, then log out and back in. Docker Compose may need to be installed separately if the Compose plugin isnโ€™t available in the Amazon Linux repositories.
Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions