Hi all,
This is my first post so first of all, thanks to Jim and all the people who built this wonderful resource.
Now, to my questions.
I recently switched to Bluefin, which being “immutable,” I can’t install sanoid directly. I’m currently using sanoid-portable as a standalone binary, and it works well.
However, I wanted to try running sanoid in a Docker container in order to use the latest version from the Ubuntu repos.
Here’s what I did:
- Created a Docker container based on
ubuntu:latest
- Installed
sanoid and zfsutils-linux
- Set the container to run
sanoid --cron with the appropriate config, cache and run dirs set.
I run it like so:
docker run --privileged --rm -v .:/config -v /dev/zfs:/dev/zfs test-sanoid
And it seems to work—snapshots are created on the host according to the config in /config dir.
My question is, does anyone see issues with this setup? I’m not very experienced with containers and want to avoid accidentally damaging the snapshots. Is there a more canonical or safer way to run sanoid in a container? Any pitfalls I should watch out for?
To me at least the approach seems fine as it looks like what is described in the “Other OSes” section of the Installation docs, but I am getting the sanoid binary and its dependencies from the ubuntu repos and not cloning the git repo itself.
Regards,
Nikolay
As far as I can think it through, if it’s working at all from within the container, it should be perfectly fine.
There are lots of ways to screw up running something like sanoid or syncoid inside a container, but they pretty much all result in a very obvious “it’s not working” result, unless somebody can think of an error state that I’m missing.
I tried something like this a few years ago, and got very odd errors. It turned out it was a mismatch between the zfs userland tools and the host kernel zfs version. I ended up installing on the host because I didn’t like that kind of coupling.
But if it’s working now, you’re probably good until you upgrade your host or the container and there’s a mismatch in the libraries shipped!
Thank you both. I guess I will continue down the road and see what happens.
@deviantintegral Thanks, I have been bitten by zfs version mismatches before. This might be a problem in the future indeed.
1 Like
Is there an easy way to turn a Sanoid script into a static go binary or app image?
Then one would just copy the standalone file to the host.
I am essentially doing this right now, using sanoid-portable, and it works absolutely fine.
I am experimenting with containers, because I would not have to manually update versions, I would just have to update the image and it will download the most recent one in the repos.
The other reason, frankly, is that i just wanted to try and do it.
2 Likes