Manage OCI on Incus
I have been deploying more OCI containers on my setup and this is a post about the things I have learned. This is mostly to remind me of commands I have used to work around the differences between using OCI on Incus and docker.
Useful Commands
Each command is from evaluating kanidm.
Add an OCI remote
The following command adds the remote image source for Docker. incus remote add docker https://docker.io --protocol=oci
Launch OCI container
This launches a container with the name kanidm.
incus launch docker:kanidm/server:latest kanidm
This launches a container with the name kanidm and passes an environment file.
incus launch docker:kanidm/server:latest kanidm --environment-file=/home/user/kanidm/.env
Persistent storage
Add a persistent storage to the conatiner.
incus config device add kanidm data disk path=/data source=/home/user/kanidm/data shift=true
Running initial commands
If you need to run a command in the container like docker run you can do the following. I had to do this to run kanidm container and the command references that.
incus config set kanidm oci.entrypoint='/sbin/kanidm cert-generate'
After running the container again you can unset this with the following.
incus config unset kanidm oci.entrypoint
This is equivalent to the following.
1
2
3
docker run --rm -i -t -v kanidmd:/data \
docker.io/kanidm/server:latest \
kanidmd cert-generate