$ sudo apt-get update $ sudo apt-get install docker-ce docker-ce-cli \ containerd.io docker-compose-plugin Setting up docker-ce … Created symlink docker.service $ sudo docker run hello-world Hello from Docker!
Docker install, the right way for your system
There are three common ways to install Docker. Choose one based on where it will run, follow the matching steps and finish with a quick health check.
Choose your Docker install method
Each path ends with a working docker command. They differ in what else comes along.
Docker Desktop
A graphical app for macOS, Windows and Linux desktops. Best for development and learning.
Engine from a repository
Add the Docker package repository to Linux and install with apt or dnf. Easy to update and audit.
Convenience script
A single script installs the latest Engine. Handy for throwaway VMs, not recommended for production.
Install Docker Engine on Linux
Remove any old docker.io packages first, then add the repository key and source. After that, installation is one apt command.
sudo apt-get install ca-certificates curlsudo install -m 0755 -d /etc/apt/keyringssudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-pluginOn Fedora and RHEL the flow is the same with dnf and the matching repository file.
Install with the convenience script
Download the script, read it if you like, then run it with root rights. It detects your distribution automatically.
curl -fsSL https://get.docker.com -o get-docker.shsudo sh get-docker.shAfter the Docker install
A few small tweaks make daily work more comfortable on Linux.
Skip sudo
Run sudo usermod -aG docker $USER, then log out and in again.
Start on boot
Enable the service with sudo systemctl enable docker.
Limit logs
Set a max log size in daemon.json so containers do not fill the disk.
Keep it updated
Docker updates arrive with your regular apt or dnf upgrades.
Confirm the Docker install
Run docker run hello-world. If you see a greeting, the engine, network and image pulls all work.
Docker install questions
Should I install docker.io or docker-ce?
docker.io comes from your distribution and can lag behind. docker-ce comes from Docker’s own repository and gets new features first.
Can I install Docker without root?
Yes, rootless mode runs the daemon as a normal user. It has some networking limits but improves isolation on shared machines.
How do I uninstall Docker?
Remove the packages with apt or dnf purge, then delete /var/lib/docker if you also want to erase images and volumes.
Does the install include Compose?
Yes, when you add docker-compose-plugin. Use it as docker compose, with a space.