nginx

Provides the open-source NGINX web server in a ready-to-run container format.


What is nginx

The nginx image provides the open-source NGINX web server in a ready-to-run container format. NGINX is a high-performance HTTP server, reverse proxy, and load balancer known for its stability, low resource usage, and ability to handle high concurrency. It’s widely used for serving static content, terminating TLS, load balancing across services, and acting as a gateway in containerized and microservice architectures.

It’s commonly used in production to expose containerized applications to the internet or to route traffic between internal services. The nginx image is relevant for developers building modern web infrastructure, and is frequently deployed in Kubernetes clusters, CI/CD pipelines, and edge environments.

How to use this image

The nginx image is commonly used to serve static content, reverse proxy to backend services, or run custom configurations. It listens on port 80 by default.

Basic usage:

bashCopyEdit# Run nginx with the default config, exposing it on port 8080 docker run -d -p 8080:80 nginx

Serve static files with a volume mount:

bashCopyEdit# Mount a local directory with HTML files to serve as the site root docker run -d -p 8080:80 -v $(pwd)/html:/usr/share/nginx/html nginx

Use a custom nginx.conf:

bashCopyEditdocker run -d -p 8080:80 \ -v $(pwd)/nginx.conf:/etc/nginx/nginx.conf:ro nginx

Drop in additional configuration:

bashCopyEdit# Add a custom config file without replacing the base config docker run -d -p 8080:80 \ -v $(pwd)/my-site.conf:/etc/nginx/conf.d/default.conf:ro nginx

Build a custom image with static content baked in:

DockerfileCopyEditFROM nginx COPY ./html /usr/share/nginx/html

This approach is recommended for production deployments, as it avoids dependency on runtime-mounted volumes.

Logging:

nginx logs to stdout and stderr by default, making logs accessible via docker logs. No extra logging configuration is required out of the box.

Image variants

The nginx image supports multiple variants depending on the base OS and use case:

‍nginx:latest

The default tag, typically based on Debian. Includes full NGINX functionality with modules and package manager support. Use this when you need compatibility, configurability, and Debian tooling.•nginx:alpineBased on Alpine Linux. Much smaller image size, but includes fewer packages by default. Ideal for minimal containers where small size and security are priorities.

‍nginx:mainline / nginx:mainline-alpine

Tracks the mainline (development) branch of NGINX instead of the stable release. Use these if you want the latest features or are testing changes before they land in stable.

‍nginx:stable / nginx:stable-alpine

‍Explicit tags for the stable NGINX version. Use these when you want consistency over time and prefer slower release cycles.In addition to these variants, the nginx image supports versioned tags, such as nginx:1.25.3 or nginx:1.24.0-alpine.

These are useful for pinning to a specific release and avoiding changes from newer upstream versions. Versioned tags can be combined with variants (e.g. nginx:1.25.3-alpine).

Why use nginx with echo

With echo, the nginx image is CVE-free, so you don’t have to worry about debloating, patching, or hardening.

Interested in base images that start and stay clean?

This is a not a valid email
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.