On a fresh Ubuntu development machine, you can install Docker Engine with Docker’s official script and test it by running one small container. Here’s how to do both and check which versions of Docker and Docker Compose you have.
1. Download and install Docker Engine
Open a terminal and download the installer. Review the script with less, then press q to return to the terminal.
curl -fsSL https://get.docker.com -o get-docker.sh && less get-docker.sh
Run the installer with administrator privileges. It configures Docker’s package repository and installs Docker Engine and its supporting tools.
sudo sh get-docker.sh
2. Run your first container
Use Docker’s small hello-world image to verify the installation.
sudo docker run --rm hello-world
On the first run, Docker downloads the image and starts a container. Look for Hello from Docker! in the output. That message confirms the engine ran the container successfully. The --rm option removes the container after it exits.
3. Check your Docker and Compose versions
To see the installed Docker client and engine versions, run:
sudo docker version
The Client section shows the version of the command-line tool. Under Server, find Engine and read its Version line. This is the version running your containers.
Docker Compose has its own version number. To display it, run:
docker compose version
For supported Ubuntu releases and additional installation methods, see the official Docker Engine installation guide for Ubuntu.
