Output of executed ephemeral command

I’m attempting to run an ephemeral command in an Incus OCI image and capture or redirect its output, similar to docker run -rm <image> <command> <args> > myfile, following these instructions to setup Apache Guacamole.

I can verify that the output is correct by running a non-ephemeral instance, then incus execing into it to run the command, at which point I get the desired output.

However, if I run incus launch docker:guacamole/guacamole --console --ephemeral -c oci.entrypoint="/opt/guacamole/bin/initdb.sh --mysql" I get one of two results:

Launching the instance
Instance name is: gorgeous-stud
To detach from the console, press: +a q
Error: Failed running forkconsole: “container is not running: "gorgeous-stud"”

Or:

Launching the instance
Instance name is: driven-sole

Error: Invalid PID ‘�’

Neither of which are useful :slight_smile:

Am I doing something wrong? Or, is this even possible? I’m running Incus 6.15 by the way.

That suggests it died so quickly that the console couldn’t attach.

Can you start it with just incus start and then run incus console --show-log to see the full console output?

The logs consists of the SQL output I was expecting to be dumped to the console.

On the back of your suggestion, I’ve added a shell with sleep and it now works:

incus launch docker:guacamole/guacamole --ephemeral --console -c oci.entrypoint=‘/bin/sh -c “sleep 1; /opt/guacamole/bin/initdb.sh --mysql”’

Thanks for the prompt response and the pointer.

1 Like