Hi! I'm trying to figure out how to provide filters when listing containers and images with https://github.com/lispyclouds/contajners. (docs: https://docs.docker.com/engine/api/v1.41/#tag/Container/operation/ContainerList).
Example: Get first 3 containers with status exited
(let [client (c/client {:engine :docker
:version "v1.41"
:conn {:uri "unix:///var/run/docker.sock"}
:category :containers})]
(c/invoke client {:op :ContainerList
:params {:limit 3
:filters {:status ["exited"]}}}))
Here I get this error
{:message "invalid character ':' looking for beginning of object key string"}
The :limit query param works as expected, but I can't figure out what to give to :filters. I've tried the following formats
{:filters {:status ["exited"]}}
{:filters {:status "exited"}}
{:filters {"status""exited"}}
{:filters {'status "exited"}}
{:filters ["status=exited]"]} ;; the docker cli syntax
With no luck. Anyone has a working example of how to provide filters? Thanks in advance πDiese Nachricht enthΓ€lt interaktive Elemente.
I think I tried that very manually yesterday, but I'll give it a try when I'm home and report back :)
tried now with
(invoke client
{:op :ContainerList
:params {:limit 3
:filters "{\"status\": [\"exited\"]}"}})
seems to worki ran on Podman now, but should work fine on Docker too
Confirmed working on Docker as well mario-star
:filters (json/generate-string {:status ["exited" "dead"]})
Thanks a lot π