3 ms·
I would be happy to, but I don't really have one. I can give you a really quick rundown of how to do it, though. 1. Install jq, umoci and skopeo on your host.
by Cu3PO42 6y ago
I would be happy to, but I don't really have one. I can give you a really quick rundown of how to do it, though.
1. Install jq, umoci and skopeo on your host.
2. Run "lxc-create -n <name> -t oci -f <temp-config> -- -u docker://<link to container on registry> --no-cache"
3. Start the resulting container with "lxc-execute -d" rather than "lxc-start".
The <temp-config> file should contain a uid and gid mapping for LXC. If you don't intend to run the containers rootless, you can omit it and "--no-cache" (the caching mechanism is broken for rootless containers).
After container creation we patch the generated config file with our network configuration, etc. similarly to what we would do with a normal LXC container.
This has worked with all containers we tried it with, but if it relies on interacting with the Docker domain directly via docker.sock it obviously won't.
A colleague has had success adding the init system from a container (in that case tini) and changing the confict so the container can start with lxc-start, this was a much more manual process, though.
- m463 6y agoThis is really interesting. I wish I could upvote you more than once. I use proxmox with lxc, but there's nothing like the simplicity of a Dockerfile I think it would be nice to have say "dockerpull2lxc" or even better "dockerbuild2lxc".
- Cu3PO42 6y agoThank you! The votes on my post suggest there are a few people interested in this, so I might eventually write a small blog post on this. Running the resulting container in Proxmox was actually the reason why my colleague needed the container to start with lxc-start rather than lxc-execute. The process involves finding the init system in the container and setting up lxc.init.cmd rather than lxc.execute.cmd, which is set by lxc-create. We have not yet investigated whether it might be possible to automate this for the majority of cases, but this is something we might look at in the future.
- Havoc 6y ago>so I might eventually write a small blog post on this. Be sure to post it on the reddit proxmox sub - it's sure to generate traffic
- Havoc 6y agoInteresting. Entire proxmox community is constantly arguing over LXC > Docker > Container or VM > Docker > Container ...with it being accepted wisdom that container on lxc is impossible. Thought whether above steps can be integrated into proxmox is another question. Either way - thanks
- Cu3PO42 6y agoThey can with a few extra steps that are still somewhat manual. Specifically, changing the configuration such that using lxc-start rather than lxc-execute is possible. It may be possible to automate these in the future, it's something I'll eventually look at.