Install Docker on Ubuntu and Linux
Docker Engine is the way to install Docker on Ubuntu and Linux. It installs from the official Docker repository and runs as a system service.
Start the service
This command starts the Docker daemon as a system service.
sudo systemctl start dockerEnable it at boot
This command starts Docker each time the machine boots.
sudo systemctl enable dockerCheck the install
This command shows the client and daemon versions.
docker version --format "Client: {{.Client.Version}} Server: {{.Server.Version}}"Example
docker run hello-worldKey points
- Docker Engine: Docker for Linux, installed as a system service.
- Add the official Docker repository, then install the docker.io package.
- Start the service with systemctl start docker, and enable it with systemctl enable docker.
- Use docker version to check the install, and docker run hello-world to test it.
- Linux runs Docker directly, with no Desktop app and no virtual machine.
In this example, Docker runs the hello-world test image on Linux. The image prints its greeting and stops. The greeting proves the Engine service runs and answers.
Note
The Ubuntu package is called docker.io. It holds the client and the daemon together.
Try it Yourself
Edit the code, then press Run.
Running is simulated · Rust Playground
Exercise
How is the Docker daemon started on Ubuntu?