List Containers

GET /containers/json

List containers

Example request:

GET /containers/json?all=1&before=8dfafdbc3a40&size=1 HTTP/1.1

Example response:

HTTP/1.1 200 OK
Content-Type: application/json

[
     {
             "Id": "52368c159761ea1832c891c128391d11ff87684b7f0aec683625296c9879dd57",
             "Names":["/boring_feynman"],
             "Image": "ubuntu:latest",
             "ImageID": "sha256:d74508fb6632491cea586a1fd7d748dfc5274cd6fdfedee309ecdcbc2bf5cb82",
             "Command": "echo 1",
             "Created": 1367854155,
             "Ports": [{"PrivatePort": 2222, "PublicPort": 3333, "Type": "tcp"}],
             "Labels": {
                     "com.example.vendor": "Acme",
                     "com.example.license": "GPL",
                     "com.example.version": "1.0"
                     "sh.hyper.fip": "",
                     "sh_hyper_instancetype": "xxs"
             },
             "SizeRw": 12288,
             "SizeRootFs": 0,
             "State": "",
             "Status": "Exit 0",
             "HostConfig": {
                      "NetworkMode": "bridge"
             },
             "NetworkSettings": {
                     "Networks": {
                             "bridge": {
                                      "IPAMConfig": null,
                                      "Links": null,
                                      "Aliases": null,
                                      "NetworkID": "",
                                      "EndpointID": "",
                                      "Gateway": "172.17.0.1",
                                      "IPAddress": "172.17.0.2",
                                      "IPPrefixLen": 16,
                                      "IPv6Gateway": "",
                                      "GlobalIPv6Address": "",
                                      "GlobalIPv6PrefixLen": 0,
                                      "MacAddress": ""
                              }
                     }
             }
     },
     {
             "Id": "7275e7626f770a1337c5a3479d4ac628b6ddb8d3f714dc0c465b08970008f115",
             "Names":["/coolName"],
             "Image": "ubuntu:latest",
             "ImageID": "sha256:d74508fb6632491cea586a1fd7d748dfc5274cd6fdfedee309ecdcbc2bf5cb82",
             "Command": "echo 222222",
             "Created": 1367854155,
             "Ports": [],
             "Labels": {
                     "sh.hyper.fip": "",
                     "sh_hyper_instancetype": "xxs"
             },
             "SizeRw": 12288,
             "SizeRootFs": 0,
             "State": "",
             "Status": "Exit 0",
             "HostConfig": {
                      "NetworkMode": "bridge"
             },
             "NetworkSettings": {
                     "Networks": {
                             "bridge": {
                                      "IPAMConfig": null,
                                      "Links": null,
                                      "Aliases": null,
                                      "NetworkID": "",
                                      "EndpointID": "",
                                      "Gateway": "172.17.0.1",
                                      "IPAddress": "172.17.0.8",
                                      "IPPrefixLen": 16,
                                      "IPv6Gateway": "",
                                      "GlobalIPv6Address": "",
                                      "GlobalIPv6PrefixLen": 0,
                                      "MacAddress": ""
                              }
                     }
             }

     },
     {
             "Id": "225fb31677846376d54eae5686ad1a11e86f033b0580ff63e678ed2f49f10e75",
             "Names":["/sleepy_dog"],
             "Image": "ubuntu:latest",
             "ImageID": "sha256:d74508fb6632491cea586a1fd7d748dfc5274cd6fdfedee309ecdcbc2bf5cb82",
             "Command": "echo 3333333333333333",
             "Created": 1367854154,
             "Ports":[],
             "Labels": {
                     "sh.hyper.fip": "",
                     "sh_hyper_instancetype": "xxs"
             },
             "SizeRw":12288,
             "SizeRootFs":0,
             "State": "",
             "Status": "Exit 0",
             "HostConfig": {
                      "NetworkMode": "bridge"
             },
             "NetworkSettings": {
                     "Networks": {
                             "bridge": {
                                      "IPAMConfig": null,
                                      "Links": null,
                                      "Aliases": null,
                                      "NetworkID": "",
                                      "EndpointID": "",
                                      "Gateway": "172.17.0.1",
                                      "IPAddress": "172.17.0.6",
                                      "IPPrefixLen": 16,
                                      "IPv6Gateway": "",
                                      "GlobalIPv6Address": "",
                                      "GlobalIPv6PrefixLen": 0,
                                      "MacAddress": ""
                              }
                     }
             }

     },
     {
             "Id": "781b3089f578545224cc32a62a428563f2d4e33bccd3494e2516b3ca0cc1ffb5",
             "Names":["/running_cat"],
             "Image": "ubuntu:latest",
             "ImageID": "sha256:d74508fb6632491cea586a1fd7d748dfc5274cd6fdfedee309ecdcbc2bf5cb82",
             "Command": "echo 444444444444444444444444444444444",
             "Created": 1367854152,
             "Ports": [],
             "Labels": {
                     "sh.hyper.fip": "",
                     "sh_hyper_instancetype": "xxs"
             },
             "SizeRw": 12288,
             "SizeRootFs": 0,
             "State": "",
             "Status": "Exit 0",
             "HostConfig": {
                      "NetworkMode": "bridge"
             },
             "NetworkSettings": {
                     "Networks": {
                             "bridge": {
                                      "IPAMConfig": null,
                                      "Links": null,
                                      "Aliases": null,
                                      "NetworkID": "",
                                      "EndpointID": "",
                                      "Gateway": "172.17.0.1",
                                      "IPAddress": "172.17.0.5",
                                      "IPPrefixLen": 16,
                                      "IPv6Gateway": "",
                                      "GlobalIPv6Address": "",
                                      "GlobalIPv6PrefixLen": 0,
                                      "MacAddress": ""
                              }
                     }
             }

     }
]

Query Parameters:

  • all – 1/True/true or 0/False/false, Show all containers. Only running containers are shown by default (i.e., this defaults to false)

  • limit – Show limit last created containers, include non-running ones.

  • since – Show only containers created since Id, include non-running ones.

  • before – Show only containers created before Id, include non-running ones.

  • size – 1/True/true or 0/False/false, Show the containers sizes

  • filters - a JSON encoded value of the filters (a map[string][]string) to process on the containers list. Available filters:

    • exited=<int>; -- containers with exit code of <int> ;

    • status=(created|restarting|running|exited)

    • label=key or label="key=value" of a container label

Status Codes:

  • 200 – no error

  • 400 – bad parameter

  • 500 – server error

Last updated