/nginx_alpinelinux

Simple and lightweight nginx container based on AlpineLinux

Primary LanguageDockerfile

nginx_AlpineLinux

Docker container image which automates the installation and basic configuration of nginx and uses curl to check whether the nginx server is working. This container image is based on the official Docker alpine:latest image.

Installation

$ sudo docker build --no-cache --tag alpine_nginx /path/to/Dockerfile

Breaking down what the container does

a. Fetch from apk repos and check if an update is available;
b. Install nginx and curl;
c. Create a user called www and adds it to the www group;
d. Create a /usr/local/www folder which will server as root folder for nginx;
e. Set www:www recursive permission to /usr/local/www;
f. Copy a basic nginx.conf file to /etc/nginx/nginx.conf;
g. Copy the default nginx index.html page to /usr/local/www;
h. Symlinking /dev/stdout to /var/log/nginx/access.log;
i. Symlinking /dev/stderr to /var/log/nginx/error.log;
l. Initiating the nginx server and test it is working by running curl localhost;