Apache httpd mit Docker Compose
++++ Podman | benötigt:
dnf install -y podman-compose
++++
mkdir -p /srv/docker/httpd/htdocs cd /srv/docker/httpd
HTML-Datei erstellen:
- /srv/docker/httpd/htdocs/index.html
<html> <head> <title>Hello World!</title> </head> <body> Hello World </body> </html>
Extrahieren der Konfigurationsdatei:
docker run --rm httpd:2.4 cat /usr/local/apache2/conf/httpd.conf > httpd.conf
++++ 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.
- /srv/docker/httpd/compose.yml
services: apache: image: httpd:2.4 restart: always ports: - 8888:8001 volumes: - ./htdocs:/usr/local/apache2/htdocs/:Z - ./httpd.conf:/usr/local/apache2/conf/httpd.conf:Z
++++
- /srv/docker/httpd/compose.yml
services: apache: image: httpd:2.4 restart: always ports: - 8888:8001 volumes: - ./htdocs:/usr/local/apache2/htdocs/ - ./httpd.conf:/usr/local/apache2/conf/httpd.conf
Datei testen:
docker compose config
++++ Podman |
podman compose config
Warnung loswerden:
- /etc/containers/containers.conf.d/10-disable_compose_warning_logs.conf
[engine] compose_warning_logs=false
++++ Erster Start, im Vordergrund:
docker compose up
→ http://localhost:8888 → wieder abbrechen mit Strg+c
Dienst starten:
docker compose up -d
Logs ansehen:
docker compose logs
Dienst stoppen:
docker compose down
Aufgabe: BentoPDF
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.
