dockerinstall.sh is a standalone command-line tool for installing, upgrading, validating, backing up, and uninstalling Docker Engine on supported Debian and Ubuntu systems.
The project uses Docker's official APT repository and provides both interactive operation and predictable non-interactive workflows for automated system provisioning.
Deutsche Dokumentation | English documentation | License
Das Skript verwaltet den vollständigen Docker-Lebenszyklus in einer einzelnen ausführbaren Datei. Es validiert Betriebssystem und Kommandozeilenargumente, richtet das offizielle Docker-Repository ein und prüft die Installation nach Abschluss.
Zum installierten Umfang gehören:
- Docker Engine und Docker CLI
- containerd
- Docker Buildx
- Docker Compose v2
- systemd-Servicekonfiguration
| Distribution | Unterstützte Versionen |
|---|---|
| Debian | 11 (Bullseye), 12 (Bookworm), 13 (Trixie) |
| Ubuntu | 22.04 LTS, 24.04 LTS, 25.10, 26.04 LTS |
Zusätzlich erforderlich sind:
- systemd
- eine von Docker unterstützte Architektur
- Root-Rechte über
rootodersudo - Internetzugriff auf die Paketquellen von Debian beziehungsweise Ubuntu und Docker
Nicht unterstützte Distributionen und Versionen werden vor Änderungen am Paketsystem abgelehnt. Die Support-Matrix orientiert sich an den offiziellen Docker-Anleitungen für Debian und Ubuntu.
- Docker-APT-Repository im Deb822-Format unter
/etc/apt/sources.list.d/docker.sources - offizieller Docker-Signaturschlüssel unter
/etc/apt/keyrings/docker.asc - Erkennung und Entfernung konfliktbehafteter Pakete
- validierte interaktive und nicht-interaktive Ausführung
- getrennte Protokolle für Installation, Self-Check und Deinstallation
- optionales Host-Level-Backup bei angehaltenen Docker-Diensten
- explizite Bestätigung vor dem Löschen persistenter Docker-Daten
- abschließende Prüfung von Docker Engine, Compose, Buildx und Docker-Daemon
Repository klonen und Installation starten:
git clone https://github.com/foxly-it/dockerinstall.git
cd dockerinstall
sudo ./dockerinstall.sh installInteraktives Hauptmenü öffnen:
sudo ./dockerinstall.shNicht-interaktive Installation ohne hello-world-Test:
sudo ./dockerinstall.sh install --non-interactive --no-helloStandard-Upgrade über APT:
sudo ./dockerinstall.sh upgradeUpgrade mit vorherigem Host-Level-Backup:
sudo ./dockerinstall.sh upgrade --backup-dataErzwungene Reinstallation der Docker-Pakete:
sudo ./dockerinstall.sh upgrade --force-upgradeOhne --force-upgrade aktualisiert APT nur Pakete, für die eine neuere Version verfügbar ist.
Docker-Pakete entfernen und persistente Daten behalten:
sudo ./dockerinstall.sh uninstall --non-interactiveVor der Deinstallation ein Backup erstellen und die Daten anschließend ausdrücklich löschen:
sudo ./dockerinstall.sh uninstall --backup-data --remove-data --non-interactiveDie Option --backup-data führt niemals automatisch zu einer Datenlöschung. Ohne --remove-data bleiben /var/lib/docker und /var/lib/containerd erhalten.
| Option | Beschreibung |
|---|---|
--add-user=USER |
Fügt USER zur Gruppe docker hinzu |
--add-user USER |
Alternative Schreibweise für --add-user |
--no-hello |
Überspringt die hello-world-Prüfung |
--no-clear |
Leert das Terminal beim Start nicht |
--no-color |
Deaktiviert farbige Ausgabe |
--log-file=PATH |
Verwendet eine benutzerdefinierte Logdatei |
--non-interactive |
Deaktiviert sämtliche Eingabeaufforderungen |
--backup-data |
Erstellt ein Host-Level-Backup bei angehaltenen Diensten |
--remove-data |
Löscht Docker-Daten bei der Deinstallation |
--keep-data |
Behält Docker-Daten bei der Deinstallation; Standardverhalten |
--force-upgrade |
Reinstalliert Docker-Pakete während des Upgrades |
--self-check |
Prüft das System, ohne Docker zu installieren |
-h, --help |
Zeigt die integrierte Hilfe an |
--version |
Zeigt die Skriptversion an |
Mitglieder der Gruppe docker besitzen root-ähnliche Rechte. Nur vertrauenswürdige Benutzer sollten dieser Gruppe hinzugefügt werden.
Das Host-Level-Backup archiviert vorhandene Daten aus /var/lib/docker, /var/lib/containerd und /etc/docker nach /var/backups. Docker und containerd werden dafür vorübergehend angehalten und anschließend wieder gestartet, sofern Docker zuvor aktiv war.
Dieses Backup ist als administratives Notfall-Backup vorgesehen. Für Datenbanken und produktive Anwendungen sind zusätzlich anwendungskonsistente Dumps und getestete Volume-Backups erforderlich. Daten aus Bind-Mounts außerhalb der genannten Verzeichnisse sind nicht enthalten.
| Vorgang | Standardpfad |
|---|---|
| Installation und Upgrade | /var/log/docker-install.log |
| Deinstallation | /var/log/docker-uninstall.log |
| Self-Check | /var/log/docker-self-check.log |
bash -n dockerinstall.sh tests/integration.sh tests/mock-command.sh
bash tests/integration.sh
shellcheck dockerinstall.sh tests/integration.sh tests/mock-command.shDie Integrationstests verwenden ein isoliertes Test-Root und simulierte Systembefehle. Sie verändern weder Docker noch APT auf dem Entwicklungsrechner. Vor einer Veröffentlichung sollte der vollständige Ablauf zusätzlich auf frischen virtuellen Maschinen für alle als getestet ausgewiesenen Distributionen geprüft werden.
The script manages the complete Docker lifecycle from a single executable file. It validates the operating system and command-line arguments, configures Docker's official repository, and verifies the resulting installation.
The installed components include:
- Docker Engine and Docker CLI
- containerd
- Docker Buildx
- Docker Compose v2
- systemd service configuration
| Distribution | Supported releases |
|---|---|
| Debian | 11 (Bullseye), 12 (Bookworm), 13 (Trixie) |
| Ubuntu | 22.04 LTS, 24.04 LTS, 25.10, 26.04 LTS |
Additional requirements:
- systemd
- an architecture supported by Docker
- root privileges through
rootorsudo - network access to the Debian or Ubuntu package repositories and Docker's package repository
Unsupported distributions and releases are rejected before the package system is modified. The support matrix follows Docker's official installation documentation for Debian and Ubuntu.
- Docker APT repository in Deb822 format at
/etc/apt/sources.list.d/docker.sources - official Docker signing key at
/etc/apt/keyrings/docker.asc - detection and removal of conflicting packages
- validated interactive and non-interactive operation
- separate logs for installation, self-check, and uninstallation
- optional host-level backup while Docker services are stopped
- explicit confirmation before persistent Docker data is removed
- post-installation validation of Docker Engine, Compose, Buildx, and the Docker daemon
Clone the repository and start the installation:
git clone https://github.com/foxly-it/dockerinstall.git
cd dockerinstall
sudo ./dockerinstall.sh installOpen the interactive main menu:
sudo ./dockerinstall.shRun a non-interactive installation without the hello-world test:
sudo ./dockerinstall.sh install --non-interactive --no-helloStandard upgrade through APT:
sudo ./dockerinstall.sh upgradeCreate a host-level backup before upgrading:
sudo ./dockerinstall.sh upgrade --backup-dataForce reinstallation of all Docker packages:
sudo ./dockerinstall.sh upgrade --force-upgradeWithout --force-upgrade, APT only updates packages for which a newer version is available.
Remove the Docker packages while retaining persistent data:
sudo ./dockerinstall.sh uninstall --non-interactiveCreate a backup before uninstalling and then explicitly remove the data:
sudo ./dockerinstall.sh uninstall --backup-data --remove-data --non-interactiveThe --backup-data option never removes data automatically. Unless --remove-data is supplied, /var/lib/docker and /var/lib/containerd are retained.
| Option | Description |
|---|---|
--add-user=USER |
Adds USER to the docker group |
--add-user USER |
Alternative syntax for --add-user |
--no-hello |
Skips the hello-world verification |
--no-clear |
Does not clear the terminal at startup |
--no-color |
Disables colored output |
--log-file=PATH |
Uses a custom log file |
--non-interactive |
Disables all prompts |
--backup-data |
Creates a host-level backup while services are stopped |
--remove-data |
Removes Docker data during uninstallation |
--keep-data |
Retains Docker data during uninstallation; default behavior |
--force-upgrade |
Reinstalls Docker packages during an upgrade |
--self-check |
Validates the system without installing Docker |
-h, --help |
Displays the built-in help |
--version |
Displays the script version |
Membership in the docker group grants root-level privileges. Only trusted users should be added to this group.
The host-level backup archives existing data from /var/lib/docker, /var/lib/containerd, and /etc/docker to /var/backups. Docker and containerd are stopped temporarily and restarted afterward if Docker was previously active.
This backup is intended as an administrative emergency backup. Databases and production applications also require application-consistent dumps and tested volume backups. Data from bind mounts outside the listed directories is not included.
| Operation | Default path |
|---|---|
| Installation and upgrade | /var/log/docker-install.log |
| Uninstallation | /var/log/docker-uninstall.log |
| Self-check | /var/log/docker-self-check.log |
bash -n dockerinstall.sh tests/integration.sh tests/mock-command.sh
bash tests/integration.sh
shellcheck dockerinstall.sh tests/integration.sh tests/mock-command.shThe integration tests use an isolated test root and simulated system commands. They do not modify Docker or APT on the development machine. Before publishing a release, the complete workflow should also be tested on clean virtual machines for every distribution advertised as tested.
This project is licensed under the MIT License.
Copyright Foxly IT.