This is a Docker image to run a NGINX instance.
This Docker image is based on the official Alpine image.
Table of Contents
- Install Docker
- Download
- How to use this image
- Next steps
- Important notes
- Update Docker image
- Advanced usage
- Technical details
- Development
To use this image you have to install Docker first.
You can get the trusted build from the Docker Hub registry:
docker pull thbe/nginx
Alternatively, you may build the Docker image from the source code on GitHub.
You can use two environment variables that will be recognized by the start script.
If this environment variable is set, the string will be used as the password for the root
user.
If this environment variable is set, the scripts inside the container will run in debug mode.
The instance can be started by the start script from GitHub:
wget https://raw.githubusercontent.com/thbe/docker-nginx/master/start_nginx.sh
export NGINX_PASSWORD='SeCre!1'
chmod 755 start_nginx.sh
./start_nginx.sh
You can use the standard Docker commands to examine the status of the NGINX instance:
docker logs --tail 1000 --follow --timestamps nginx
The next release of this Docker image should have a persistent NGINX configuration.
The username for the web server is root
/password
unless you don't change the password with the environment
variable as described in the Environment variables
section.
Simply download the trusted build from the Docker Hub registry:
docker pull thbe/nginx
You can build the image also from source. To do this you have to clone the docker-nginx repository from GitHub:
git clone https://github.com/thbe/docker-nginx.git
cd docker-nginx
docker build --rm --no-cache -t thbe/nginx .
If you need a shell inside the container you can run the following command:
docker exec -ti nginx /bin/sh
- Alpine base image
- nginx binary from official Alpine package repository
If you like to add functions or improve this Docker image, feel free to fork the repository and send me a merge request with the modification.