Die Installation von Docker CE (Community Edition) erfolgt über das von Docker bereitgestellte Repository. Die Installation folgt im wesentlichen dem offiziellen Guide.
Um Docker auf das System zu bekommen sind folgende Schritte notwendig:
Paketindex aktualisieren
$ apt-get update
Vorraussetzungen installieren
Die Pakete werden über HTTPS aus dem Repository heruntergeladen. Dazu sind einige weitere Pakete notwendig:
$ apt-get install \ apt-transport-https \ ca-certificates \ curl \ software-properties-common
Dockers GPG Key installieren
Die Pakete im Docker Repository sind zur Sicherung der Integrität mit einer GPG Signatur versehen. Der GPG Key zur Prüfung der Signatur kann wie folgt installiert werden:
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - OK
Der Key sollte nun installiert sein. Der Key hat den Fingerprint 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88. Eine Suche nach dem gekürzten Fingerprint (0EBFCD88) kann man mit apt-key durchführen. Die Ausgabe sollte in etwa so aussehen:
$ apt-key fingerprint 0EBFCD88 pub 4096R/0EBFCD88 2017-02-22 Key fingerprint = 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88 uid Docker Release (CE deb) <docker@docker.com> sub 4096R/F273FCD8 2017-02-22
Jetzt muss man noch das Repository dem System hinzufügen:
$ add-apt-repository \ "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) \ stable"
Das System sollte an diesem Punkt Zugriff auf das Docker Repository haben. Eine Aktualisierung des Paket-Indexes gefolgt von der Installation des Docker-Pakets (inkl. docker-compose) bringt Docker auf den Server:
$ apt-get update $ apt-get install docker-ce $ curl -L https://github.com/docker/compose/releases/download/1.19.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose $ chmod +x /usr/local/bin/docker-compose
Wenn alles gut gegangen ist, ist Docker jetzt lauffähig. Mit dem hello-world Container kann man dies kurz testen:
$ docker run hello-world Hello from Docker! This message shows that your installation appears to be working correctly. To generate this message, Docker took the following steps: 1. The Docker client contacted the Docker daemon. 2. The Docker daemon pulled the "hello-world" image from the Docker Hub. (amd64) 3. The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading. 4. The Docker daemon streamed that output to the Docker client, which sent it to your terminal. To try something more ambitious, you can run an Ubuntu container with: $ docker run -it ubuntu bash Share images, automate workflows, and more with a free Docker ID: https://cloud.docker.com/ For more examples and ideas, visit: https://docs.docker.com/engine/userguide/