Prerequisites:
- A Linux computer(mine is Fedora 36)
- Docker(or podman) installed
I know, there’s traditional ways to share files over network such as samba or the very current cloud way such as Google Drive. Or I can just use a USB key. But I managed to impress my child(who has to use Windows because of her school) with Docker.
The reason I didn’t use samba is that it’s current broken between my Fedora 36 and Windows 10, and I was not interested to troubleshoot that.
Ok here are the steps:
# grab LAN IP
hostname -I
192.168.86.29 xxx
# create a configuration to enable auto index from nginx image
docker run --rm --entrypoint bash nginx:latest -c 'cat /etc/nginx/conf.d/default.conf' |sed 's|location / {|location / {\n autoindex on;|1' >/tmp/default.conf
# start nginx docker container and share current directory with the configuration
# the :Z mount option is for SELinux
docker run -v $(pwd):/usr/share/nginx/html:Z -v /tmp/default.conf:/etc/nginx/conf.d/default.conf:Z --rm -p 8080:80 nginx:latestNow I can let my child to type http://192.168.86.29:8080 in her browser to download stuff from my laptop.

Handy, isn’t it? 🙂
