Default apache webserver with configurable user+group
Base webserver with 2 external volumes : /config & /www
/config holds all apache2 & php8.2 config files
/www is the entire webroot \
| Variable | Default | Description |
|---|---|---|
APACHE_DOCUMENT_ROOT | /www | Apache’s DocumentRoot |
WEB_USER | www-data | Linux user Apache runs as |
WEB_GROUP | www-data | Linux group Apache runs as |
WEB_UID | 33 | UID to use (creates user if missing) |
WEB_GID | 33 | GID to use (creates group if missing) |
TZ | Europe/Brussels | Timezone for PHP (date.timezone) |
minimal:
docker create \
-p 4567:80 \
-v /some/host/folder/www:/www \
-v /some/host/folder/config:/config \
trueosiris/webserver
more options:
docker create \
-p 4567:80 \
-v /some/host/folder/www:/www \
-v /some/host/folder/config:/config \
-e APACHE_DOCUMENT_ROOT=/www \
-e PGID=983 \
-e PUID=983 \
-e TZ=Europe/Brussels \
-e HOST_HOSTNAME=$(hostname) \
-e HOST_IP=$(ip addr show enp0s3 | grep "inet\b" | awk '{print $2}' | cut -d/ -f1) \
--name webserver \
--restart=unless-stopped \
-v "/var/run/docker.sock:/var/run/docker.sock" \
trueosiris/webserver
docker compose
x-volume-localtime:
&etclocaltime
type: 'bind'
source: /etc/localtime
target: /etc/localtime
read_only: true
x-volume-webdefault-webroot:
&webdefaultwebroot
type: 'bind'
source: ./web/default/www
target: /www
bind:
create_host_path: true
x-volume-webdefault-config:
&webdefaultconfig
type: 'bind'
source: ./web/default/config
target: /config
bind:
create_host_path: true
services:
webserver:
image: insight4upublic/webserver
environment:
- APACHE_DOCUMENT_ROOT=/www
- PGID=1000
- PUID=1000
- TZ=Europe/Brussels
- HOST_HOSTNAME=$(hostname)
- HOST_IP=$(ip addr show enp0s3 | grep "inet\b" | awk '{print $2}' | cut -d/ -f1)
restart: unless-stopped
network_mode: bridge
volumes:
- <<: *etclocaltime
- <<: *webdefaultwebroot
- <<: *webdefaultconfig
ports:
- 8031:80
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:80"]
interval: 60s
timeout: 10s
retries: 5
Content type
Image
Digest
sha256:6a7b12999…
Size
176.4 MB
Last updated
over 1 year ago
docker pull insight4upublic/webserver