Run container unprivileged

This commit is contained in:
Berger Adrian 2022-04-01 10:38:31 +02:00
parent 2c9b50c16b
commit 8019cd7240
3 changed files with 6 additions and 6 deletions

View file

@ -1,6 +1,6 @@
FROM nginx:alpine
FROM nginxinc/nginx-unprivileged:stable-alpine
MAINTAINER Mohammad Naghavi <mohamnag@gmail.com>
LABEL author="Mohammad Naghavi <mohamnag@gmail.com>"
ADD default.conf /etc/nginx/conf.d/default.conf
ADD css/ /opt/www/file-browser/css/
@ -9,4 +9,4 @@ ADD js/ /opt/www/file-browser/js/
ADD index.html /opt/www/file-browser/
VOLUME /opt/www/files/
EXPOSE 80
EXPOSE 8080

View file

@ -12,11 +12,11 @@ A sample nginx configuration is also included which mounts **file browser** unde
Mainly for demonstration purposes a docker image is also available [here](https://hub.docker.com/r/mohamnag/nginx-file-browser/).
In order to use this docker image, the volume which has to be served should
be mounted under `/opt/www/files/` and port `80` of container shall be mapped
be mounted under `/opt/www/files/` and port `8080` of container shall be mapped
to a proper port on host. A proper run would look like:
```
$ docker run -p 8080:80 -v /path/to/my/files/:/opt/www/files/ mohamnag/nginx-file-browser
$ docker run -p 8080:8080 -v /path/to/my/files/:/opt/www/files/ mohamnag/nginx-file-browser
```
With container up and running you can point your browser to IP of docker host with given port to view the files. For example with above run command assuming docker host having IP with `192.168.0.200` we have to navigate to this URL:

View file

@ -1,5 +1,5 @@
server {
listen 80;
listen 8080;
server_name localhost;
root /opt/www/;