So I’ve pretty much transferred all my apps (arr, syncthing, jellyfin, webserver) over from k3s to docker in a jailmaker jail (thanks @ Stux!), including nextcloud. Lots of learning about paths & permissions along the way!
Now - here’s a challenge for y’all…the unifi controller.
The latest image from linuxserver.io needs a separate mongo container running.
I have got a working mongo install, accessible by mongoexpress, but I’ll be damned if I can get the needed ‘unifi’ db with its ‘unifi’ user set up as per the instructions by using a ‘mongo-init.js’ file which gets inserted and runs on first start up.
Basically, the init-mongo.js file doesn’t seem to have any effect, and the unifi database and user never get setup, so the unifi-controller then fails to connect to anything.
Hmmmm ?!?
So - have any of you managed to get this working in docker inside a jailmaker jail? There’s a virtual beer reward for anyone who reports success
The reason that one works is because the mongodb container is being created for you in that compose file on-the-fly, same as the controller container. Someone feel free to correct me on this, but I think the reason LSIO didn’t do it this way is because they always provide the docker run command in their setup guides in addition to docker compose, and there probably isn’t a way to state dependencies in docker run commands.
If you look at the 3rd line, that creates one container for mongodb with its own configuration and volumes, and the 10th line creates the container for the controller portion. The ‘depends on’ line states that unifi controller requires mongodb as a dependency, so it ensures that the mongodb container is started before unifi controller — if that line was omitted, there’s a chance the container would fail due to differing startup times for each.
And this is why compose is a good thing. It allows you to make “compositions” of multiple containers.
As a benefit its also just a really good way to document the “configuration” for running a single container too, otherwise you’re reduced to text files and scripts with magic docker incantations listed in them.
I also had a nightmare trying to get the Unifi Network Application to work in Jailmaker/Docker. The final magic was that I had to add –capability=CAP_IPC_LOCK under the systemd_nspawn_user_args section in my docker config.