Linuxhotel Wiki

Wie ging das nochmal?

Benutzer-Werkzeuge

Webseiten-Werkzeuge


admin_grundlagen:apache_httpd_mit_docker_compose

Apache httpd mit Docker 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
/srv/docker/httpd/docker-compose.yml
version: "3.7"
services:
  apache:
    image: httpd:2.4
    container_name: my-httpd
    restart: always
    ports:
      - 8888:80
    volumes:
      - ./htdocs:/usr/local/apache2/htdocs/
      - ./httpd.conf:/usr/local/apache2/conf/httpd.conf

Erster Test, 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
admin_grundlagen/apache_httpd_mit_docker_compose.txt · Zuletzt geändert: 2024/02/24 08:52 von ingo_wichmann