Linuxhotel Wiki

Wie ging das nochmal?

Benutzer-Werkzeuge

Webseiten-Werkzeuge


admin_grundlagen:docker:volumes

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen gezeigt.

Link zu der Vergleichsansicht

Beide Seiten, vorherige Überarbeitung Vorherige Überarbeitung
Nächste Überarbeitung
Vorherige Überarbeitung
admin_grundlagen:docker:volumes [2026/05/31 11:26]
ingo_wichmann
admin_grundlagen:docker:volumes [2026/05/31 12:34] (aktuell)
ingo_wichmann
Zeile 7: Zeile 7:
   dnf install -y git   dnf install -y git
 ++++ ++++
- 
 Quellcode laden: Quellcode laden:
   git clone https://​github.com/​RalfNieuwenhuizen/​routes-explorer.git   git clone https://​github.com/​RalfNieuwenhuizen/​routes-explorer.git
   cd routes-explorer/​   cd routes-explorer/​
- 
 Dockerfile: Version hinzufügen Dockerfile: Version hinzufügen
 <file txt Dockerfile>​ <file txt Dockerfile>​
Zeile 25: Zeile 23:
 Container starten: Container starten:
   docker container run -d -p 5000:5000 --name routes-explorer ingo/​routes-explorer:​0.0.1   docker container run -d -p 5000:5000 --name routes-explorer ingo/​routes-explorer:​0.0.1
- 
 GPX-Tracks aussuchen und herunterladen:​ https://​wildnis-wandern.de/​gpx-downloads/​ GPX-Tracks aussuchen und herunterladen:​ https://​wildnis-wandern.de/​gpx-downloads/​
  
Zeile 50: Zeile 47:
 Container starten: Container starten:
   docker container run -d --restart=always -v /routes -p 5000:5000 --name routes-explorer ingo/​routes-explorer:​0.0.1   docker container run -d --restart=always -v /routes -p 5000:5000 --name routes-explorer ingo/​routes-explorer:​0.0.1
- 
 http://​localhost:​5000 http://​localhost:​5000
 -> GPX-Dateien hochladen -> GPX-Dateien hochladen
- 
   docker inspect routes-explorer --format json | jq '​.[0].Mounts'​   docker inspect routes-explorer --format json | jq '​.[0].Mounts'​
 -> die hochgeladenen GPX-Dateien liegen in "​Source"​ -> die hochgeladenen GPX-Dateien liegen in "​Source"​
Zeile 69: Zeile 64:
 Container löschen: Container löschen:
   docker container rm -f routes-explorer   docker container rm -f routes-explorer
- 
 Daten im Verzeichnis ''​routes''​ speichern: Daten im Verzeichnis ''​routes''​ speichern:
   mkdir routes   mkdir routes
Zeile 76: Zeile 70:
 ++++ ++++
   docker container run -d --restart=always -v ./​routes:/​routes -p 5000:5000 --name routes-explorer ingo/​routes-explorer:​0.0.1   docker container run -d --restart=always -v ./​routes:/​routes -p 5000:5000 --name routes-explorer ingo/​routes-explorer:​0.0.1
- 
 http://​localhost:​5000 http://​localhost:​5000
 -> GPX-Dateien hochladen -> GPX-Dateien hochladen
- 
   ls routes/   ls routes/
 -> zeigt die hochgeladenen GPX-Dateien -> zeigt die hochgeladenen GPX-Dateien
Zeile 91: Zeile 83:
 http://​localhost:​5000 http://​localhost:​5000
 -> GPX-Dateien sind noch da -> GPX-Dateien sind noch da
- 
   docker inspect routes-explorer --format json | jq '​.[0].Mounts'​   docker inspect routes-explorer --format json | jq '​.[0].Mounts'​
 -> relativer Pfad wird von Docker als absoluter Pfad verarbeitet. -> relativer Pfad wird von Docker als absoluter Pfad verarbeitet.
- 
 === Sicherheit === === Sicherheit ===
   container exec -it routes-explorer bash   container exec -it routes-explorer bash
Zeile 105: Zeile 95:
 Container löschen: Container löschen:
   docker container rm -f routes-explorer   docker container rm -f routes-explorer
- 
 Daten im Volume ''​routes''​ speichern: Daten im Volume ''​routes''​ speichern:
   docker volume create routes   docker volume create routes
   docker container run -d --restart=always -v routes:/​routes -p 5000:5000 --name routes-explorer ingo/​routes-explorer:​0.0.1   docker container run -d --restart=always -v routes:/​routes -p 5000:5000 --name routes-explorer ingo/​routes-explorer:​0.0.1
- 
 http://​localhost:​5000 http://​localhost:​5000
 -> GPX-Dateien hochladen -> GPX-Dateien hochladen
- 
 ++++ Podman | ++++ Podman |
   podman volume mount routes   podman volume mount routes
Zeile 127: Zeile 114:
 http://​localhost:​5000 http://​localhost:​5000
 -> GPX-Dateien sind noch da -> GPX-Dateien sind noch da
- 
 ===== Docker Compose ===== ===== Docker Compose =====
 +Docker CLI Container löschen:
   docker container rm -f routes-explorer   docker container rm -f routes-explorer
 +Compose Verzeichnis anlegen:
 +  mkdir -p /​srv/​docker/​routes-explorer
 +  cd /​srv/​docker/​routes-explorer
 ==== ohne Volume ==== ==== ohne Volume ====
 <file yaml docker-compose.yml>​ <file yaml docker-compose.yml>​
Zeile 138: Zeile 128:
       - "​5000:​5000"​       - "​5000:​5000"​
 </​file>​ </​file>​
- 
 Container starten: Container starten:
   docker compose up -d   docker compose up -d
- 
 http://​localhost:​5000 http://​localhost:​5000
 -> GPX-Dateien hochladen -> GPX-Dateien hochladen
Zeile 154: Zeile 142:
 http://​localhost:​5000 http://​localhost:​5000
 -> GPX-Dateien sind weg -> GPX-Dateien sind weg
- 
 ==== anonymes Volume ==== ==== anonymes Volume ====
 Container löschen: Container löschen:
Zeile 162: Zeile 149:
  
     image: ingo/​routes-explorer:​0.0.1     image: ingo/​routes-explorer:​0.0.1
- 
     volumes:     volumes:
-      - /routes</​file>​+      - /routes
 </​file>​ </​file>​
  
Zeile 171: Zeile 157:
 http://​localhost:​5000 http://​localhost:​5000
 -> GPX-Dateien hochladen -> GPX-Dateien hochladen
- +++++ Podman | 
-  ​docker ​inspect routes-explorer_routes-explorer_1 --format json | jq '​.[0].Mounts'​+  ​podman ​inspect routes-explorer_routes-explorer_1 ​--format json | jq '​.[0].Mounts'​ 
 +++++ 
 +  docker inspect routes-explorer-routes-explorer-1 ​--format json | jq '​.[0].Mounts'​
 -> die hochgeladenen GPX-Dateien liegen in "​Source"​ -> die hochgeladenen GPX-Dateien liegen in "​Source"​
  
Zeile 183: Zeile 171:
   docker compose up -d   docker compose up -d
 http://​localhost:​5000 http://​localhost:​5000
--> GPX-Dateien sind nicht sichtbar: sie liegen ​noch in dem alten anonymen Volume.+-> GPX-Dateien sind sind noch da ;-)
   docker volume ls   docker volume ls
 ==== relativer Pfad ==== ==== relativer Pfad ====
Zeile 194: Zeile 182:
  
     image: ingo/​routes-explorer:​0.0.1     image: ingo/​routes-explorer:​0.0.1
- 
     volumes:     volumes:
-      - ./​routes:/​routes:​Z</​file>​+      - ./​routes:/​routes:​Z
 </​file>​ </​file>​
 ++++ ++++
Zeile 202: Zeile 189:
  
     image: ingo/​routes-explorer:​0.0.1     image: ingo/​routes-explorer:​0.0.1
- 
     volumes:     volumes:
       - ./​routes:/​routes       - ./​routes:/​routes
 +    restart: unless-stopped
 </​file>​ </​file>​
 Container starten: Container starten:
Zeile 223: Zeile 210:
 http://​localhost:​5000 http://​localhost:​5000
 -> GPX-Dateien sind noch da -> GPX-Dateien sind noch da
 +++++ Podman |
   docker inspect routes-explorer_routes-explorer_1 --format json | jq '​.[0].Mounts'​   docker inspect routes-explorer_routes-explorer_1 --format json | jq '​.[0].Mounts'​
 +++++
 -> relativer Pfad wird von Docker als absoluter Pfad verarbeitet. -> relativer Pfad wird von Docker als absoluter Pfad verarbeitet.
  
Zeile 233: Zeile 222:
  
     image: ingo/​routes-explorer:​0.0.1     image: ingo/​routes-explorer:​0.0.1
- 
     volumes:     volumes:
       - routes:/​routes       - routes:/​routes
     restart: unless-stopped     restart: unless-stopped
 +
 volumes: volumes:
   routes:   routes:
Zeile 247: Zeile 236:
   podman volume mount routes   podman volume mount routes
 ++++ ++++
-  docker inspect routes-explorer_routes-explorer_1 ​--format json | jq '​.[0].Mounts.[0].Source'​+  docker inspect routes-explorer-routes-explorer-1 ​--format json | jq '​.[0].Mounts.[0].Source'​
 -> die hochgeladenen GPX-Dateien liegen in diesem Verzeichnis -> die hochgeladenen GPX-Dateien liegen in diesem Verzeichnis
  
Zeile 259: Zeile 248:
 http://​localhost:​5000 http://​localhost:​5000
 -> GPX-Dateien sind noch da -> GPX-Dateien sind noch da
 +
 +===== Übersicht =====
 +^                 ^ Docker CLI       ^ compose ^
 +^ ohne Volume ​    | nicht persistent | nicht persistent |
 +^ anonymes Volume | nicht sichtbar ​  | persistent |
 +^ relativer Pfad  | persistent ​      | persistent |
 +^ benantes Volume | persistent ​      | persistent |
  
admin_grundlagen/docker/volumes.1780226778.txt.gz · Zuletzt geändert: 2026/05/31 11:26 von ingo_wichmann