1.25.4http3-alpine
,1.25-alpine
,latest
(Dockerfile)1.25.4-alpine
(Dockerfile)1.24.0-alpine
,1.24-alpine
(Dockerfile)1.23.3-alpine
,1.23-alpine
(Dockerfile)1.23.1-alpine
(Dockerfile)
Nginx built for many CPU architecture.
The difference from the official Nginx docker image:
- with njs scripting language dynamic module (with js_inline patch)
- with mruby scripting language dynamic module
- with Sticky dynamic module
- with Sync upstreams dynamic module
- with Stream sync upstreams dynamic module
- with Upstream health check module
- with Brotli module
- with ZStd module
- with Various set_xxx directives dynamic module
- with Headers more dynamic module
- with SRCache dynamic module
- with Memc dynamic module
- with PostgreSQL dynamic module
- with Redis dynamic module
- with Redis2 dynamic module
- with Resty DBD Streams to JSON dynamic module
- with Echo dynamic module
- with A forward proxy module
- with Opentracing dynamic module and Jaeger plugin
- with degradation module
- using
/etc/nginx/sites-enabled/
for virtual host configuration (like Ubuntu) - without modules: http_xslt, http_image_filter, http_sub, http_dav, http_flv, http_mp4, http_random_index, http_slice, mail, mail_ssl, http_geoip, stream_geoip
- with http3 module
- with socks server module
- with sock5 rpoxy module
docker run --name some-nginx -d -v /some/content:/usr/share/nginx/html:ro wsandwitch/nginx
docker run --name some-nginx -d -p 80:80 -e 443 -p 443:443 wsandwitch/nginx
docker run --name some-nginx -d -v /host/path/virtualhosts.d:/etc/nginx/sites-enabled:ro wsandwitch/nginx
For example porting Ubuntu nginx to docker:
docker run --name some-nginx -d -p 80:80 -e 443 -p 443:443 \
-v /etc/nginx/conf.d:/etc/nginx/conf.d \
-v /etc/nginx/sites-available:/etc/nginx/sites-available \
-v /etc/nginx/sites-enabled:/etc/nginx/sites-enabled \
-v /var/log/nginx:/var/log/nginx \
wsandwitch/nginx
List dynamic modules in container:
docker run -t --rm wsandwitch/nginx ls /usr/lib/nginx/modules
Example of loading a module in nginx.conf
:
load_module modules/ngx_http_js_module.so;
docker run -it --rm wsandwitch/nginx njs
>> var a = {b: []};
undefined
>> console.log(a);
{b:[]}
undefined
>> JSON.stringify(a);
'{"b":[]}'
>>
Sample configurations and module tests are located in a folder named test
.
To run tests, go to the folder test
and run command make
.
To start a specific example, go to an example folder and run docker-compose up
.
This image is based on the popular Alpine Linux project, available in the alpine
official image.
Alpine Linux is much smaller than most distribution base images (~5MB), and thus leads to much slimmer images in general.
This variant is highly recommended when final image size being as small as possible is desired. The main caveat to note is that it does use musl libc instead of glibc and friends, so certain software might run into issues depending on the depth of their libc requirements. However, most software doesn't have an issue with this, so this variant is usually a very safe choice. See this Hacker News comment thread for more discussion of the issues that might arise and some pro/con comparisons of using Alpine-based images.
To minimize image size, it's uncommon for additional related tools (such as git
or bash
) to be included in Alpine-based images. Using this image as a base, add the things you need in your own Dockerfile (see the alpine
image description for examples of how to install packages if you are unfamiliar).
View license information for the software contained in this image or license information for the Nginx Dockerfile.
As with all Docker images, these likely also contain other software which may be under other licenses (such as Bash, etc from the base distribution, along with any direct or indirect dependencies of the primary software being contained).
As for any pre-built image usage, it is the image user's responsibility to ensure that any use of this image complies with any relevant licenses for all software contained within.