I am trying to create an nginx docker container (to provide file upload/download). Under the html root I'm looking to create some additional subfolders (upload and download).
I took the nginx docker image as my base and added some additional lines to create/initialise the subfolders.
FROM nginx
MAINTAINER Carl Wainwright <[email protected]>
ENV HTML_PATH /var/www/html
COPY nginx.conf /etc/nginx/nginx.conf
RUN mkdir -p $HTML_PATH/upload && mkdir -p $HTML_PATH/download
RUN chmod 755 $HTML_PATH/upload && mkdir chmod 755 $HTML_PATH/download
RUN chown nginx:nginx $HTML_PATH/upload && chown nginx:nginx $HTML_PATH/download
In my docker-compose file I am creating my container as follows:
wbh-device-asset-server:
restart: always
image: wbh-device-asset-server/nginx:test
container_name: wbh-device-asset-server
volumes:
- /www-data:/var/www/html
ports:
- "8081:8081"
networks:
- mynetwork
My nginx configuration has the following server configuration.
server {
error_log /var/log/nginx/error.log debug;
access_log /var/log/nginx/access.log main;
# Running port
listen 8081;
# Proxy requests to get SDP's
location ~ \.sdp {
root /var/www/html;
try_files $uri =404;
limit_except GET { deny all; }
}
# Proxy requests to put APD's.
location ~ \.(apd) {
dav_methods PUT;
limit_except PUT { deny all; }
client_body_temp_path /tmp/files/;
client_body_in_file_only on;
client_body_buffer_size 128K;
client_max_body_size 30M;
}
On my local machine /www-data exists and has write permissions. Each time I bring the container up the contents of /www-data are empty.
Why is it I cannot create folders under /var/www/html/ ? What is stopping me from doing this.
NOTE: As part of my troubleshooting I created a docker image based on centos and installed nginx from packages and I faced the same issue.