How do I install Docker and Docker Compose on Amazon Linux 2023?
Asked by
MellowPine47
I'm setting up an Amazon Linux 2023 instance and followed Docker's installation instructions for RHEL. However, running `sudo dnf install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin --assumeyes --quiet` fails with `Unable to find a match` for every package. What is the correct way to install Docker and Docker Compose on Amazon Linux 2023?
Answers
The packages in that command arenโt part of the default Amazon Linux repositories. You need to configure an appropriate RPM repository before trying to install `docker-ce`, or use the Docker package provided through Amazon Linux if it meets your needs. After installation, start and enable the service with `sudo systemctl enable --now docker`, then add your account to the Docker group with `sudo usermod -aG docker ec2-user` and sign in again.
Reply to this answer
Amazon Linux 2023 isnโt the same distribution as RHEL, even though both use RPM packages and DNF. The Docker CE packages wonโt be available until you add a compatible Docker repository, and the RHEL instructions arenโt guaranteed to work on Amazon Linux. Start with AWSโs Amazon Linux or Docker installation instructions instead of installing the CE packages blindly.
Reply to this answer
AWSโs Docker setup documentation is the better starting point for Amazon Linux. It covers installing the distribution-supported Docker package, starting the daemon, and configuring access for the `ec2-user`. Docker Compose may need to be installed separately as the Compose plugin, depending on which Docker package and repositories you use; verify it afterward with `docker compose version`.
Reply to this answer
Installing from the Ubuntu instructions wonโt fix this because Ubuntu uses APT while Amazon Linux uses RPM and DNF. The important part is adding a repository that actually publishes packages for your operating system, or using Amazon Linuxโs own Docker package. If you specifically need Docker CE, configure Dockerโs RPM repository only after confirming that its packages support Amazon Linux 2023.
Reply to this answer
Add your answer
Answers are reviewed before publication.
MellowPine47: Docker doesnโt provide a dedicated Amazon Linux section, so I was unsure whether the RHEL or CentOS instructions were supposed to apply.