Execute command for starting oci container application

I’m trying to start a Keycloak oci container. Running:
incus launch oci-docker:keycloak/keycloak:26.0.5 keycloak-1 --ephemeral -c environment.KC_BOOTSTRAP_ADMIN_USERNAME=<username> -c environment.KC_BOOTSTRAP_ADMIN_PASSWORD=<password>
works fine but it needs a command to start. Namely start-dev.

The docker equivalent is:
docker run -p 8080:8080 -e KC_BOOTSTRAP_ADMIN_USERNAME=admin -e KC_BOOTSTRAP_ADMIN_PASSWORD=admin quay.io/keycloak/keycloak:26.0.5 start-dev

Is there any way to send the start-dev command to the container at startup?

You can do it through raw.lxc=lxc.init.cmd=/path/to/init args.

Not exactly the cleanest thing ever but we still need to find a better way to handle those images that don’t have a functional daemon entrypoint out of the box.

1 Like

Thank you for your response! I didn’t really get it to work but I found the Bitnami Keycloak Docker image which has a CMD at the end of the Dockerfile and that worked fine.

For anyone looking, if you want to use incus launch with an OCI image, the proper config option is raw.lxc=lxc.execute.cmd=/path/to/command args (github issue). For example,

incus launch docker:mycontainer --console --ephemeral --config "raw.lxc=lxc.execute.cmd=/bin/bash"

Starting with Incus 6.11 we have oci.entrypoint instead.