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?
4 Answers
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.
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`.
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.
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.

Docker doesn’t provide a dedicated Amazon Linux section, so I was unsure whether the RHEL or CentOS instructions were supposed to apply.