This sample contains docker-compose / podman-compose services intended to:
- Call an url to get some dad jokes.
- Update a templated html file with the new content.
- Expose it on
localhost:8080throughtnginx.
You can pass arguments to the updater.sh script as the template path, output path and sleep interval for it.
The flow is the following:
The challenge was to actually make nginx not run as root, and not update back permissions to the default index.html file fron it.
Another aspect was the cap-ad that was needed in the end to be added to the docker compose file for nginx, as docker sets the down limit to ports for non-root users to bind to 0,
so I had to set cap-ad with at least NET_BIND_SERVICE.
Both users on both containers share the same UID / GUID (101), but not sure if that would do any difference in the end.
It's a small project that can show how ton put containers, even with some hard dependency as the volumes here, to run as non-root.
docker compose up --buildOr
podman-compose up --buildThe --build can be removed, but if you push further changes mainly to code, build it again.
In order to remove the volumes included on the compose recipe, after cancelling the compose execution, or when bringing it down run the following:
docker comnpose down -vOr
podman-conmpose down -vSome references I've found on the way to surpass some of the issues:
