Think of Docker as standardized shipping crates for software. An image is the packed crate (all code + libraries + runtime). A container is the crate running on a ship (an isolated process on your machine). Docker makes it easy to build those crates, share them, and run them the same way everywhere; your laptop, CI, or cloud. Docker separates apps from the host OS so you get consistent behavior. (Docker Documentation)
Containers are much lighter than virtual machines because they share the host kernel (less overhead), so you can run more things on the same hardware. (Docker Documentation)
docker command you type.These commands come straight from Docker’s install instructions for Ubuntu. They set up Docker’s repository, then install the engine + CLI + compose plugin.
# 1) Install prerequisites and add Docker's GPG key
sudo apt-get update
sudo apt-get install -y ca-certificates curl gnupg
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL <https://download.docker.com/linux/ubuntu/gpg> \\
-o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
# 2) Add Docker apt repo (auto-detects your Ubuntu codename)
echo \\
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] \\
<https://download.docker.com/linux/ubuntu> \\
$(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}") stable" | \\
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
# 3) Install Docker Engine + CLI + buildx + compose plugin
sudo apt-get install -y docker-ce docker-ce-cli containerd.io \\
docker-buildx-plugin docker-compose-plugin
# 4) Verify
sudo docker run hello-world
If you want to run docker without sudo, follow the Linux post-install steps to create the docker group and add your user (and read the security note first). (Docker Documentation)