Docker Community Forums

Share and learn in the Docker community.

DOCKER API can't apply json parameters


(Stobor) #1

According to https://docs.docker.com/engine/reference/api/docker_remote_api_v1.24/#/list-tasks filter can be used to get only running containers with a particular service name. For some reason i get full list of all tasks regardless of their names or desired states. I cant find any proper examples of docker api curl with json requests.
Command im using
curl -X GET -H “Content-Type: application/json” -d ‘{“filters”:[{ “service”:“demo”, “desired-state”:“running” }]}’ https://HOSTNAME:2376/tasks --cert ~/.docker/cert.pem --key ~/.docker/key.pem --cacert ~/.docker/ca.pem