Public | Automated Build

Last pushed: 2 years ago
Short Description
Docker Nginx image for Raspberry pi. Based on Alpine Linux for minimal footprint.
Full Description

Nginx Docker image for armhf devices

This is a Docker image used to run Nginx on arm devices, built on a Raspberry Pi 3.
Based on Alpine Linux for a minimal and clean image.

Getting the image

It's available onf the Docker Registry :

docker pull drakerin/rpi-alpine-nginx

Using the image (default configuration)

To start Nginx with the default settings :

docker run -p 80:80 -p 443:443 drakerin/rpi-alpine-nginx

It starts Nginx with a default server redirecting to an index showing "It Works".

Customizing configuration

A script searches configuration or static websites files in the containers folder /tmp/conf_override before starting Nginx.
In order to provide your own configuration / virtual server(s) files, you will need to create a directory to share with the containers volume, e.g.:

mkdir /srv/nginx

(According to the FHS, /srv/ contains data for the services provided by the system so it's a good idea to place your files here)

If you only want to override the default nginx configuration, you can place the nginx.conf file in the newly created directory.
If you want to add virtual servers, you first need to create a conf.d directory inside the first one, e.g.:

mkdir /srv/nginx/conf.d

Then you can place your configuration files in there.
You can also add your websites files by creating a /var/www directory and placing your files there.

mkdir -P /srv/nginx/var/www
cp -aR /var/www /srv/nginx/var/www

Then run the container with the good volumes :

docker run -p 80:80 -p 443:443 -v /srv/nginx:/tmp/conf_override drakerin/rpi-alpine-nginx


FROM hypriot/rpi-alpine-scratch


RUN apk update \
    && apk upgrade \
    && apk add nginx \
    && rm -rf /var/cache/apk/*

RUN rm /etc/nginx/nginx.conf

RUN chown -R nginx:www-data /var/lib/nginx

ADD root /

RUN mkdir /tmp/conf_override

VOLUME ["/tmp/conf_override"]

WORKDIR /etc/nginx

EXPOSE 80 443

CMD ["/bin/sh", "/"]
Docker Pull Command
Source Repository