How do I run a listening program (specifically unoconv as a listener) inside a container using systemd-nspawn, so that it can run in the background (without a console) and be reached by other processes? For example in a perfect world it would be as easy as this:
# something like this to start the container and program in background
systemd-nspawn -D <container path> --background <unoconv --listener>
# something like this to connect to container and execute command
systemd-run --machine <machine name> <unoconv -f pdf file.txt>
The furthest I've got so far is using Taming systemd-nspawn for running containers, which gets the container running in the background with machinectl. However,
sudo systemd-run --machine <machine name> ls
fails with the error:
Failed to create bus connection: Permission denied.
My question is two-fold. One, can you solve this error? Or two (preferably) can you give me a simpler way to start and connect to a container and run commands?
(I'm running Ubuntu Xenial on a secure machine with no internet access)