A minimal Nginx Docker image based on different Ubuntu LTS versions.
3.4K
Minimal Nginx Docker image based on Ubuntu LTS distributions.
The image provides a predictable Nginx environment using the official Ubuntu Nginx packages. This ensures long-term stability, security updates, and behavior similar to a standard Ubuntu server installation.
The repository name still contains swrm for historical reasons. The image was originally created for Docker Swarm deployments but is today mainly used as a general-purpose Nginx container for standard Docker setups.
Many Nginx Docker images are based on Alpine Linux or custom builds.
This image follows a different approach:
The goal is to provide a stable and low-maintenance container that behaves similarly to a typical Ubuntu server installation.
| Nginx | Ubuntu Base | Tag Pattern |
|---|---|---|
| 1.24 | Ubuntu 24.04 LTS | latest, 1.24-* |
| 1.18 | Ubuntu 22.04 LTS | 1.18-* |
The Nginx version corresponds to the version shipped with the respective Ubuntu LTS release.
Image tags follow the Nginx version plus an internal image revision number.
Examples:
latest
1.24-6
1.24-4
1.18-6
...
latest always refers to the current Ubuntu LTS based image maintained in this repository.
docker pull geschke/nginx-swrm
Example:
docker run -d \
--name nginx \
--restart unless-stopped \
-p 80:80 \
-v /srv/docker/nginx/html:/var/www/html \
-v /srv/docker/nginx/sites-enabled:/etc/nginx/sites-enabled \
-v /srv/docker/nginx/conf.d:/etc/nginx/conf.d \
geschke/nginx-swrm:latest
In this example:
/srv/docker/nginx/html is mounted to /var/www/html inside the container/srv/docker/nginx/sites-enabled is mounted to /etc/nginx/sites-enabled/srv/docker/nginx/conf.d are mounted to /etc/nginx/conf.dThis keeps the container image itself unchanged while configuration and website data remain on the host system.
A simple docker compose setup may look like this compose.yaml:
services:
nginx:
image: geschke/nginx-swrm:latest
restart: unless-stopped
ports:
- "80:80"
volumes:
- ./html:/var/www/html
- ./nginx/sites-enabled:/etc/nginx/sites-enabled
- ./nginx/conf.d:/etc/nginx/conf.d
Start it with:
docker compose up -d
In this example:
./html contains the website content./nginx/sites-enabled contains the virtual host configuration./nginx/conf.d contains additional Nginx configuration snippetsA simple project structure could look like this:
project-directory/
├── compose.yaml
├── html/
│ └── index.html
└── nginx/
├── sites-enabled/
│ └── default
└── conf.d/
└── compression.conf
html/ contains the website contentnginx/sites-enabled/ contains virtual host configurationsnginx/conf.d/ contains additional Nginx configuration snippetsThe names of the host directories are completely arbitrary. They are simply mounted to the appropriate locations inside the container.
The container follows the standard Ubuntu Nginx configuration layout.
Typical locations inside the container include:
/etc/nginx/sites-enabled for virtual host configuration/etc/nginx/conf.d for additional configuration snippets/var/www/html for website contentThese directories can be populated through bind mounts or similar Docker mechanisms from the host system. This allows you to manage configuration and content outside the container while keeping the container image itself immutable.
The container can be used for example as:
MIT License
Content type
Image
Digest
sha256:386a0ac4c…
Size
52.7 MB
Last updated
5 months ago
docker pull geschke/nginx-swrm