TRAININGS REPO - PRIVATE - nginx alpine without root
920
This docker image will be used for serving PHP and other projects. It's based on the idea of micro containers and should be able to run without root privilege. This is a requirement to run on the Oracle OpenShift platform.
These instructions will help you getting a copy of the project up and running on your local machine for development and testing purposes.
sudo docker pull bsdevat/nginx
TODO: how to copy default nginx.conf and change config how to enable https
Replace with e.g. 80 to serve HTTP on the default port and with 443.
Otherwise you can use 8080 and 8443 for alternative ports without the requirement to start it as root.
docker run -d -p <your-http-port>:8080 -p <your-https-port>:8443 --name nginx-instance bsdevat/nginx
If you want higher performance and run your container without the docker NAT, you can use the following command.
docker run --network host bsdevat/nginx
The container now will use the ports from your host machine without port mapping and without the time cost of translating the ports from host to container.
For more information about running a docker container, visit the link in the references section.
The images is a minimal alpine linux and only offers an sh shell. To attach your console to the container user following command.
docker exec -it nginx-instance sh
TODO: how to mount/link the docker web root to an external directory
docker run -d \
-p <your-http-port>:8080 \
-p <your-https-port>:8443 \
-v /path/to/host/html:/usr/share/nginx/html:ro
--name nginx-instance \
bsdevat/nginx
With the -v option you can set the mount point of the html files and override the docker image folder content.
TODO: how to link to a php fpm and a optimized config
If you run a public accessible nginx, consider some changes to harden your configuration.
docker build -t nginx-dev .
docker run -p 8080:8080 nginx-dev
Now you can open http://host-ip:8080. You can start the image with options described in the section about running nginx but with your given name when you built it. In this case it's nginx-dev.
Content type
Image
Digest
Size
7.5 MB
Last updated
over 8 years ago
docker pull bsdevat/nginx