How to Install Docker on Ubuntu (Including EC2)

Ubuntu is the most common Linux distribution for running Docker — whether on a local dev machine, a CI runner, or an EC2 instance. The install process is the same in all three cases. Update the System sudo apt update && sudo apt upgrade -y Install Required Packages sudo apt install -y apt-transport-https ca-certificates curl software-properties-common Add Docker’s Official GPG Key curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg Add the Docker Repository echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] \ https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" \ | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null Install Docker Engine sudo apt update sudo apt install -y docker-ce docker-ce-cli containerd.io Start Docker and Enable at Boot sudo systemctl start docker sudo systemctl enable docker Allow Non-Root Usage (Recommended) By default, Docker commands require sudo. Add your user to the docker group to remove that requirement: ...

June 10, 2026 · 2 min · 383 words · Kiprono Elijah