Docker is the fastest way to package and run applications on an EC2 instance. If you are on an Amazon Linux box, you can have the Docker engine up and running in a couple of minutes. This cheatsheet walks through the install for both Amazon Linux 2 and Amazon Linux 2023.
ec2-user).sudo privileges.If you need help connecting to your instance, see our guide on how to set up an AWS bastion host or a jump server.
SSH into your instance and make sure existing packages are up to date.
sudo yum update -y
On Amazon Linux 2023, yum is symlinked to dnf, so the same command works.
Amazon Linux 2 ships Docker in the Amazon Linux Extras repository:
sudo amazon-linux-extras install docker -y
On Amazon Linux 2023, Docker is available directly from the default repositories:
sudo dnf install docker -y
Start the Docker daemon and enable it so it survives reboots.
sudo systemctl start docker
sudo systemctl enable docker
Verify the service is running:
sudo systemctl status docker
By default you need sudo for every Docker command. Add your user to the docker group so you can run Docker directly.
sudo usermod -aG docker ec2-user
Log out and back in (or run newgrp docker) for the group change to take effect.
Check the version and run a test container:
docker --version
docker run hello-world
If you see the "Hello from Docker!" message, your engine is working.
To orchestrate multi-container apps, install the Compose plugin. For a full walkthrough, see installing Docker Compose in Linux.
docker compose version
Giving developers SSH keys to EC2 hosts running Docker means standing credentials and limited visibility into who ran what. With Adaptive, teams get Just-in-Time, credential-less access to their infrastructure — including SSH and AWS — with every session logged and auditable.
That's it — Docker on Amazon Linux in well under five minutes.

