mkdir -p /srv/docker/httpd/htdocs cd /srv/docker/httpd
docker run -d --name hello-httpd -p 8888:80 -v '/srv/docker/httpd/htdocs:/usr/local/apache2/htdocs/' httpd:2.4
curl http://localhost:8888
Betreten der Instanz:
docker exec -it hello-httpd /bin/bash ls conf/httpd.conf exit
Instanz löschen:
docker stop hello-httpd docker rm hello-httpd
Extrahieren der Konfigurationsdatei:
cd /srv/docker/httpd docker run --rm httpd:2.4 cat /usr/local/apache2/conf/httpd.conf > httpd.conf
Konfigurationsdatei bearbeiten:
sed -i.bak 's/^Listen 80/Listen 8001/' httpd.conf diff httpd.conf{,.bak}
Starten:
docker run -d --name httpd_8001 -p 8888:8001 -v '/srv/docker/httpd/htdocs:/usr/local/apache2/htdocs/' -v '/srv/docker/httpd/httpd.conf:/usr/local/apache2/conf/httpd.conf' httpd:2.4
Löschen:
docker stop httpd_8001 docker rm httpd_8001
TODO:
FROM httpd:2.4 CMD sed -i 's/^Listen 80/Listen 8001/' /usr/local/apache2/conf/httpd.conf