Could someone please help me with remote api for docker exec to run a command?
I am able to run it directly:
# docker exec 941430a3060c date
Fri Apr
The API section which would help you is: Exec Create/Start
You can see some example in integration-cli/docker_api_exec_test.go
create:
sockRequest("POST", fmt.Sprintf("/containers/%s/exec", name), map[string]interface{}{"Cmd": []string{"true"}})
start:
sockRequestRaw("POST", fmt.Sprintf("/exec/%s/start", id), strings.NewReader(`{"Detach": true}`), "application/json")
inspect:
sockRequestRaw("GET", fmt.Sprintf("/exec/%s/json", id), nil, "")