Blog software updated with containers
by Sunny Chan
Posted on Sunday March 07, 2021 at 12:44pm in Linux
Another upgrade recently - I used to run the blog with a tomcat instance directly installed in the OS but I have just containerized it with podman. I used Tomcat docker image and basically mapped the existing data files from my home directory into the container and it pretty much works.
The more challenging part is to convince systemctl to start the blog container every time the system restarts. I use podman as my container runtime as it allows running the container in the user namespace instead of root, which makes it more secure. However it seems that running as user namespace makes it difficult to setup systemctl due to issues with podman. You should follow the advise in this podman bug if you are having trouble:
- Set Requires/After to user@<uid>.service to ensure all the user environment is setup before systemctl starts the blog container
- You will need to run "loginctl enable-linger" for the user (see the issue comment)
Once it is all set it works like a treat. Now I can move my blog to any vps hosts that support docker container without dependent on the whole OS setup