Installation on Ubuntu / Debian
Two paths coexist. The official script get.docker.com detects the distribution, adds the repository, and installs the engine in one command: ideal for a development machine or a disposable server, but discouraged in production because it always installs the latest version without any pinning control. The recommended path is Docker's official APT repository: you control the version, updates go through apt, and you get the full engine (docker-ce), the client, containerd, Buildx, and the Compose plugin.
Before any installation, remove the docker.io or docker-compose packages provided by Ubuntu: they are old and conflict with the official repository.
Service and permissions
The engine runs as the docker systemd service. Enable automatic startup with sudo systemctl enable --now docker. By default, the socket belongs to the docker group: without membership in this group, every command requires sudo. Adding yourself to the group (sudo usermod -aG docker $USER) removes this constraint but grants control equivalent to root over the machine, because the daemon runs as root.
Daemon configuration
The /etc/docker/daemon.json file (create it if it does not exist) centralizes the daemon configuration: logging driver, mirror registries, DNS, address range of the default networks. After changes, reload with sudo systemctl restart docker. The data (images, volumes, containers) resides in /var/lib/docker; this directory can grow quickly, so monitor disk space and prune regularly with docker system prune.