Minimal and up-to-date nginx docker image
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
apk Add apk artifacts Feb 14, 2016
LICENSE Cleanups Feb 16, 2016 Update img_fresh for compat with docker < 1.8 Feb 16, 2016


A minimal and up-to-date nginx image based on Alpine Linux.

Why ?

At this time:

  1. Nginx maintainers are still using a bloated debian:jessie base image
  2. Alpine packages nginx stable (1.8) instead of mainline (1.9)

This image gives the best of both world: up-to-date nginx in a small image.


BSD 2-Clause, see accompanying LICENSE file.


The latest build of this image (1.9.11) is available on Docker Hub

docker run -p 8080:80 huguesb/alpinx


FROM hugues/alpinx

Build Requirements

  • bash
  • docker 1.5+

Implentation details

To build this image from scratch, a two-step process is required:

  1. Build apk package(s) from source on the host


    This is rather slow, should be fairly infrequent, and uses explicit mapping of volumes to host folders so it cannot be easily integrated in a containerized CI.

    Instead, the artifacts are stored in the repo and have to be rebuilt manually as needed.

  2. Install the package(s) into a docker image


    This will build and tag huguesb/alpinx locally, instead of fetching it from Docker Hub.

    Doing the second step "right" is a little convoluted due to limitations of the docker build command. In particular, it is not possible to access files from the build context in a RUN statement. One could use a COPY statement but then the intermediate artifacts would remain in the final image even if a rm command were used in a subsequent layer.

    To be easily integrated in a containerized CI, this script eschews explicit mapping of volumes to host folders, which requires additional contorsions.