sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin. Test it with sudo docker run hello-world. On AlmaLinux or Rocky Linux, add Docker’s repository with dnf config-manager and install the same packages with dnf.
Before you start
- Log in over SSH as root or as a sudo user. Root users can leave out
sudo. - Docker Engine is the program that runs containers. A container is an app packaged with everything it needs, isolated from the rest of the server.
- Don’t install Docker from the Ubuntu snap store. Several apps (Portainer, Nextcloud AIO, Coolify) don’t support snap Docker.
- Use a supported release. Docker supports Ubuntu 22.04 and 24.04 LTS (and newer), Debian 12 and 13, and RHEL 8, 9 and 10. See Docker’s install docs.
How to install Docker
- Ubuntu
- Debian
- AlmaLinux / Rocky
1
Remove conflicting packages
Remove unofficial packages such as If none are installed, apt tells you there is nothing to remove.
docker.io or podman-docker if they are installed:2
Add Docker's GPG key
3
Add the Docker repository
4
Install Docker Engine and Compose
How to check it worked
hello-world prints Hello from Docker! and exits. The version commands print lines such as:
How to run Docker without sudo
The install creates adocker group but adds nobody to it. Add your user (for example alex):
docker ps without sudo.
How to stop container logs filling your disk
By default Docker keeps container logs forever. Create/etc/docker/daemon.json with log rotation:
sudo systemctl restart docker. This applies to new containers only, so recreate existing ones to pick it up.
Docker and your firewall
Frequently asked questions
Should I use the get.docker.com script?
Docker’s convenience script works, but Docker recommends it only for testing and development. Use the repository method above on a production server.What is the difference between docker.io and docker-ce?
docker.io is the package built by Ubuntu and Debian. docker-ce comes from Docker’s own repository and is updated sooner. Don’t install both.
How do I update Docker?
Docker updates with your normal system updates:sudo apt update && sudo apt upgrade or sudo dnf upgrade. Containers stop while the Docker service restarts. Containers with a restart policy such as unless-stopped start again on their own.
Does Docker work on Alpine or Arch Linux?
Yes, both ship Docker in their own repositories, but Docker’s install guide doesn’t cover them. Follow your distribution’s documentation.Related guides
VPS and dedicated server guides
Every guide in this section.
Docker Compose tutorial
Run multi-container apps from one file.
Docker commands cheat sheet
The commands you use every day.
Install Portainer
Manage Docker in your browser.
Clean up Docker disk space
Free space with docker system prune.
Set up a firewall with UFW
Allow only the ports you need.
Checked against the official Docker Engine install documentation on 4 November 2026; package names,
daemon.json and post-install commands tested on Ubuntu 24.04 LTS with Docker Engine 29.9.2. Commands can differ on other distributions or releases.Need Extra Help?
If you encounter any issues, our support team is ready to assist:- Live Chat: Quick assistance via our website.
- Support Ticket: Open a Ticket
- Discord: Join our Community
- Email: support@freakhosting.com
Last Updated: November 2026