How do I install Docker and Docker Compose on Amazon Linux 2023?
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
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
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
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