How to Install Docker CE/EE on AWS EC2: AMI-Compatible Methods for Latest Versions


2 views

With Docker's transition to CE (Community Edition) and EE (Enterprise Edition), the installation process on AWS EC2 instances running Amazon Linux AMI requires updated methods. The legacy yum install docker approach now delivers outdated versions (like 1.12.6), while GitHub shows significantly newer releases.

The previous docker-engine package has been replaced by:

  • docker-ce (Community Edition)
  • docker-ee (Enterprise Edition)

Official Docker documentation explicitly states that Docker CE isn't supported on RHEL-based systems, which affects our AMI installation approach.

For AWS EC2 instances running Amazon Linux AMI:

Method 1: Installing Docker CE

sudo amazon-linux-extras install docker
sudo service docker start
sudo usermod -a -G docker ec2-user

Method 2: Manual Installation via Docker Repository

sudo yum install -y yum-utils
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
sudo yum install docker-ce docker-ce-cli containerd.io
sudo systemctl start docker

To install specific Docker CE versions:

sudo yum list docker-ce --showduplicates | sort -r
sudo yum install docker-ce-<VERSION_STRING> docker-ce-cli-<VERSION_STRING> containerd.io

For Docker EE on AWS EC2:

sudo yum install -y yum-utils
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ee.repo
sudo yum install docker-ee docker-ee-cli containerd.io

After installation:

docker --version
sudo docker run hello-world

Remember to configure Docker to start on boot:

sudo systemctl enable docker

Amazon Linux 2 AMI users can leverage the amazon-linux-extras command for easier Docker CE installation, while legacy AMI users should prefer the repository method.


Since Docker's 2017 announcement splitting into Community (CE) and Enterprise (EE) editions, the installation process on AWS AMI has evolved. The old yum install docker method is no longer recommended as it provides outdated versions (like 1.12.6).

sudo yum update -y
sudo yum install -y device-mapper-persistent-data lvm2

For most development environments, Docker CE is the preferred choice:

# Add Docker CE repository
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

# Install Docker CE
sudo yum install -y docker-ce docker-ce-cli containerd.io

# Start and enable Docker
sudo systemctl start docker
sudo systemctl enable docker

For production environments requiring support:

# Add Docker EE repository
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ee.repo

# Install Docker EE
sudo yum install -y docker-ee docker-ee-cli containerd.io

# Configure storage driver
sudo mkdir /etc/docker
cat <<EOF | sudo tee /etc/docker/daemon.json
{
  "storage-driver": "devicemapper"
}
EOF

After installation, verify with:

docker --version
docker info

For optimal performance on EC2:

# Configure Docker to start on boot
sudo systemctl enable docker

# Add ec2-user to docker group
sudo usermod -aG docker ec2-user

# Relaunch session to apply group changes

If encountering storage driver problems:

# Clean existing Docker setup
sudo yum remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-engine

# Reinstall with explicit storage driver
sudo yum install -y docker-ce --setopt=obsoletes=0