[lxc-users] lxd api return of /1.0/containers/<name>/exec

Robert Johnson robert.j at bendtel.com
Fri Dec 23 17:47:06 UTC 2016


I've been working on obtaining two way communications with the /exec 
URI, but your needs may more simple then mine.

When you POST to /exec, you probably want to include the 'record-output' 
key with a (boolean) value of true. ie

'{"command": ["df -f /"], "record-output": true}'

The doc's state that stdout and stderr will be redirected to a log file.

It doesn't state where the log file is; but I'm willing to bet that the 
reply will include a path that you can subsequently GET.

If this works for you, let me know, I'm interested in at least obtaining 
the output from some commands.

On 12/23/2016 05:02 AM, laurent ducos wrote:
> Hello.
>
> Is there a solution to get the return of a command launch by lxd exec API ?
>
> curl -s --unix-socket /var/lib/lxd/unix.socket
> a/1.0/containers/$CONTAINER/exec -X POST -d '{"command": ["df -f /"]}' |
> jq .
>
> I would like to see something like this in return of the command.
>
> output: /dev/sda5           15G    4,6G  9,8G  32% /
>
>
> _______________________________________________
> lxc-users mailing list
> lxc-users at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-users
>


More information about the lxc-users mailing list