Skip to content

Using the rancher container exec api #19

@3goats

Description

@3goats

Hi,

I'm trying to get this to work via the rancher container exec api. It works fine from the command line

sudo docker exec -i 3e8756acf56815459b7a50e36f889b1126792caf1fa14c6b7103678cfaf5d009 sh -c 'echo hello 123 >/data.txt

However if I make this request via the Rancher REST API:

HTTP/1.1 POST /v2-beta/projects/1a5/containers/1i177/?action=execute
Host: 192.168.13.129:8080
Accept: application/json
Content-Type: application/json
Content-Length: 98

{
"attachStdin": true,
"attachStdout": true,
"command": [
"sh -c 'echo hello 456 >/data.txt"
],
"tty": true
}

It returns the following error.

rpc error: code = 2 desc = oci runtime error: exec failed: exec: "sh -c 'echo hello 456 >/data.txt": stat sh -c 'echo hello 456 >/data.txt: no such file or directory

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions