Readme erweitert
This commit is contained in:
parent
8a26c18c83
commit
308e7d934d
1 changed files with 115 additions and 0 deletions
115
README.md
115
README.md
|
|
@ -111,3 +111,118 @@ ansible installieren und anschließend direkt alles aus ["Install Docker Engine
|
||||||
root@fobiX:~# bash scripts/01<TAB><ENTER>
|
root@fobiX:~# bash scripts/01<TAB><ENTER>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
einen Wimpernschlag später (oder 100...) ist docker auf dem Server fertig eingerichtet.
|
||||||
|
|
||||||
|
### Test, ob alles geklappt hat
|
||||||
|
|
||||||
|
#### Version prüfen
|
||||||
|
Wenn du `docker version` eintippst, sollte die Ausgabe in etwa so aussehen:
|
||||||
|
```
|
||||||
|
# docker version
|
||||||
|
Client: Docker Engine - Community
|
||||||
|
Version: 28.5.1
|
||||||
|
API version: 1.51
|
||||||
|
Go version: go1.24.8
|
||||||
|
Git commit: e180ab8
|
||||||
|
Built: Wed Oct 8 12:17:24 2025
|
||||||
|
OS/Arch: linux/amd64
|
||||||
|
Context: default
|
||||||
|
|
||||||
|
Server: Docker Engine - Community
|
||||||
|
Engine:
|
||||||
|
Version: 28.5.1
|
||||||
|
API version: 1.51 (minimum version 1.24)
|
||||||
|
Go version: go1.24.8
|
||||||
|
Git commit: f8215cc
|
||||||
|
Built: Wed Oct 8 12:17:24 2025
|
||||||
|
OS/Arch: linux/amd64
|
||||||
|
Experimental: false
|
||||||
|
containerd:
|
||||||
|
Version: v1.7.28
|
||||||
|
GitCommit: b98a3aace656320842a23f4a392a33f46af97866
|
||||||
|
runc:
|
||||||
|
Version: 1.3.0
|
||||||
|
GitCommit: v1.3.0-0-g4ca628d1
|
||||||
|
docker-init:
|
||||||
|
Version: 0.19.0
|
||||||
|
GitCommit: de40ad0
|
||||||
|
```
|
||||||
|
|
||||||
|
#### einen Container starten:
|
||||||
|
Weil sich [hello world](https://de.wikipedia.org/wiki/Hallo-Welt-Programm) als Tradition etabliert hat, wollen auch wir unseren ersten Container in dieser Tradition starten:
|
||||||
|
```
|
||||||
|
root@fobiX:~# docker run hello-world
|
||||||
|
```
|
||||||
|
Wenn hier sinnvoller output kommt, dann
|
||||||
|
- ist docker korrekt installiert
|
||||||
|
- kann der docker-Dienst auf die ***Docker-Registry*** zugreifen und dort automatisch nach ***Images*** suchen und sie herunterladen.
|
||||||
|
- hat der Container seine Aufgabe erfüllt und sich beendet.
|
||||||
|
|
||||||
|
Jetzt rufst du diesen Befehl noch zwei drei mal auf, damit wir gleich beim nächsten Schritt was zu sehen haben :)
|
||||||
|
|
||||||
|
#### laufende Container auflisten
|
||||||
|
`docker ps` listet die laufenden Container auf:
|
||||||
|
```
|
||||||
|
root@fobiX:~# docker ps
|
||||||
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
|
root@fobiX:~#
|
||||||
|
```
|
||||||
|
wie du siehts, siehst du nix. Klar, es läuft ja kein Container mehr :)
|
||||||
|
|
||||||
|
erweitere den Befehl mit dem Parameter `-a` ("bedeutet all")
|
||||||
|
```
|
||||||
|
# docker ps -a
|
||||||
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
|
7bb05fa9feff hello-world "/hello" 4 minutes ago Exited (0) 7 minutes ago beautiful_elion
|
||||||
|
dcb9ee2e3a89 hello-world "/hello" 4 minutes ago Exited (0) 4 minutes ago adoring_snyder
|
||||||
|
4b350e1e7f74 hello-world "/hello" 4 minutes ago Exited (0) 4 minutes ago kind_brattain
|
||||||
|
root@fobiX:~#
|
||||||
|
```
|
||||||
|
Damit siehst du auch die ganzen Container, die zwar erstellt wurden, aber nicht mehr laufen.
|
||||||
|
Diesen Datenmüll wollen wir gerne entfernen:
|
||||||
|
- einzeln: `docker rm 7bb0` entfernt den Container, dessen CONTAINER ID mit 7bb0 anfängt.
|
||||||
|
- mehrere: `docker container prune` entfernt alle, die Container, nicht mehr laufen
|
||||||
|
|
||||||
|
```bash
|
||||||
|
root@fobiX:~# docker container prune
|
||||||
|
WARNING! This will remove all stopped containers.
|
||||||
|
Are you sure you want to continue? [y/N] y
|
||||||
|
Deleted Containers:
|
||||||
|
7bb05fa9feffa5ea28a08c715983e1d7be75289296fa75486043fa32ffe43eab
|
||||||
|
dcb9ee2e3a895803c24796bdf68aa2dea7e1fc6131ffd76194dd522d01ec427b
|
||||||
|
4b350e1e7f74eccffc220174e8b16d3e8ceac890b826dcb9b817324c9ef8bba3
|
||||||
|
```
|
||||||
|
|
||||||
|
Um gar nicht erst alte Container herumliegen zu lassen kann man den Container mit dem Parameter --rm ("remove") starten. Dann wird er nach dem Stoppen direkt gelöscht:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
root@fobiX:~# docker run --rm 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://hub.docker.com/
|
||||||
|
|
||||||
|
For more examples and ideas, visit:
|
||||||
|
https://docs.docker.com/get-started/
|
||||||
|
|
||||||
|
root@fobiX:~# docker ps -a
|
||||||
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
|
root@fobiX:~#
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue