Docker engine api exec - executable file not found in $PATH


I am trying to create a dir inside a running docker container and I want to do it remotely using the docker engine api.
I am using Postman to test the communication so first I create the exec instance like this:


with body:

{“Cmd”:[“mkdir testDir”],

and then I use the returned Id to start the exec like this:


but I get an error:

�OCI runtime exec failed: exec failed: container_linux.go:296: starting container process caused "exec: \"mkdir testDir\": executable file not found in $PATH": unknown

Any ideas how to execute the command from http request?

Ok, found it.
mkdir is under /bin so the Body request should be “/bin/mkdir/” and the folder name separately inside the array:


and it works fine.

EDIT: It also works without putting “/bin/”