How to run Web File Server in the Container
Prerequisites
Clone the squirrelistic-blog repo and go to how_to_run_web_file_server_in_the_container directory.
git clone https://github.com/Squirrelistic/squirrelistic-blog.git
cd squirrelistic-blog\how_to_run_web_file_server_in_the_container
How to run Web File Server in the Windows Container
Follow the prerequisites. Run the following, in the Windows command line.
docker run --rm -it -p 8080:80 -v .\iis-file-server:c:/inetpub/wwwroot mcr.microsoft.com/windows/servercore/iis:windowsservercore-ltsc2019
If you don't want web.config to be displayed, make it hidden.
attrib +H .\iis-file-server\web.config
How to run Web File Server in the Linux Container
Method 1: Follow the prerequisites. Run the following, in the Windows command line.
docker run --rm -it -p 8080:80 -v .\nginx-file-server\nginx.conf:/etc/nginx/nginx.conf:ro -v .\nginx-file-server\html:/etc/nginx/html nginx
Method 2: Follow the prerequisites. Run the following, in the Linux command line (volume path for relative host directory is different).
docker run --rm -it -p 8080:80 -v ./nginx-file-server/nginx.conf:/etc/nginx/nginx.conf:ro -v ./nginx-file-server/html:/etc/nginx/html nginx
How do I use it?
Web server is available at http://localhost:8080 and http://[your-server-ip]:8080 addresses.
How is that useful?
I use the Web File Server to host installer files while testing and improving Dockerfile.
Some installers are pretty large (over 1GB) and would be downloaded many times over the Internet. Once I am happy with Dockerfile, I change the links to the Internet ones.
When you specify the URL in the Dockerfile, make sure to use your computer's IP address: http://[your-server-ip]:8080, not localhost.
Possible issues
Pay attention to the encodings of text files (txt, html, etc.).
Search for 'utf-8' in web.config and nginx.conf files in this repository for some guidance.