Hier werden die Unterschiede zwischen zwei Versionen gezeigt.
| Beide Seiten, vorherige Überarbeitung Vorherige Überarbeitung Nächste Überarbeitung | Vorherige Überarbeitung | ||
|
admin_grundlagen:docker:apache_httpd_mit_docker_compose [2026/03/24 12:10] ingo_wichmann [Apache httpd mit Docker Compose] |
admin_grundlagen:docker:apache_httpd_mit_docker_compose [2026/06/02 09:57] (aktuell) peter_rossbach2 |
||
|---|---|---|---|
| Zeile 1: | Zeile 1: | ||
| ====== Apache httpd mit Docker Compose ====== | ====== Apache httpd mit Docker Compose ====== | ||
| + | ++++ Podman | | ||
| + | benötigt: | ||
| + | dnf install -y podman-compose | ||
| + | ++++ | ||
| mkdir -p /srv/docker/httpd/htdocs | mkdir -p /srv/docker/httpd/htdocs | ||
| cd /srv/docker/httpd | cd /srv/docker/httpd | ||
| Zeile 19: | Zeile 22: | ||
| docker run --rm httpd:2.4 cat /usr/local/apache2/conf/httpd.conf > httpd.conf | docker run --rm httpd:2.4 cat /usr/local/apache2/conf/httpd.conf > httpd.conf | ||
| - | <code yaml /srv/docker/httpd/docker-compose.yml> | + | ++++ SELinux | |
| + | Wenn SELinux aktiv ist :Z bei den Volumes hinzufügen. Das veranlasst Podman, das Volume mit einem privaten SELinux-Kontext zu relabeln, wodurch der Container Zugriff darauf erhält. Alternativ die Volumes unter ''/var/lib/containers/httpd'' ablegen. | ||
| + | <code yaml /srv/docker/httpd/compose.yml> | ||
| services: | services: | ||
| apache: | apache: | ||
| Zeile 25: | Zeile 30: | ||
| restart: always | restart: always | ||
| ports: | ports: | ||
| - | - 8888:80 | + | - 8888:8001 |
| + | volumes: | ||
| + | - ./htdocs:/usr/local/apache2/htdocs/:Z | ||
| + | - ./httpd.conf:/usr/local/apache2/conf/httpd.conf:Z | ||
| + | </code> | ||
| + | ++++ | ||
| + | <code yaml /srv/docker/httpd/compose.yml> | ||
| + | services: | ||
| + | apache: | ||
| + | image: httpd:2.4 | ||
| + | restart: always | ||
| + | ports: | ||
| + | - 8888:8001 | ||
| volumes: | volumes: | ||
| - ./htdocs:/usr/local/apache2/htdocs/ | - ./htdocs:/usr/local/apache2/htdocs/ | ||
| - ./httpd.conf:/usr/local/apache2/conf/httpd.conf | - ./httpd.conf:/usr/local/apache2/conf/httpd.conf | ||
| </code> | </code> | ||
| - | Erster Test, im Vordergrund: | + | Datei testen: |
| + | docker compose config | ||
| + | ++++ Podman | | ||
| + | podman compose config | ||
| + | Warnung loswerden: | ||
| + | <file ini /etc/containers/containers.conf.d/10-disable_compose_warning_logs.conf> | ||
| + | [engine] | ||
| + | compose_warning_logs=false | ||
| + | </file> | ||
| + | ++++ | ||
| + | Erster Start, im Vordergrund: | ||
| docker compose up | docker compose up | ||
| -> http://localhost:8888 | -> http://localhost:8888 | ||
| Zeile 43: | Zeile 70: | ||
| Dienst stoppen: | Dienst stoppen: | ||
| docker compose down | docker compose down | ||
| - | + | | |
| - | ====== Aufgabe: BentoPDF ====== | + | ====== Aufgabe: BentoPDF ====== |
| - | Schreibe eine ''docker-compose.yml'' für das Image ''bentopdfteam/bentopdf:latest'' und starte den Container. Konvertiere ein Bild aus dem WWW in ein PDF. | + | Lege ein Verzeichnis ''/srv/docker/bentopdf'' an, schreibe eine ''compose.yml'' für das Image ''bentopdfteam/bentopdf:latest'' und starte den Container. Konvertiere ein Bild aus dem WWW in ein PDF. |