List containers Run in API Explorer
Returns a list of containers. For details on the format, see the inspect endpoint.
Note that it uses a different, smaller representation of a container than inspecting a single container. For example, the list of linked containers is not propagated .
Query parameters
-
Return all containers. By default, only running containers are shown.
Default value is
false
. -
Return this number of most recently created containers, including non-running ones.
-
Return the size of container as fields
SizeRw
andSizeRootFs
.Default value is
false
. -
Filters to process on the container list, encoded as JSON (a
map[string][]string
). For example,{"status": ["paused"]}
will only return paused containers.Available filters:
ancestor
=(<image-name>[:<tag>]
,<image id>
, or<image@digest>
)before
=(<container id>
or<container name>
)expose
=(<port>[/<proto>]
|<startport-endport>/[<proto>]
)exited=<int>
containers with exit code of<int>
health
=(starting
|healthy
|unhealthy
|none
)id=<ID>
a container's IDisolation=
(default
|process
|hyperv
) (Windows daemon only)is-task=
(true
|false
)label=key
orlabel="key=value"
of a container labelname=<name>
a container's namenetwork
=(<network id>
or<network name>
)publish
=(<port>[/<proto>]
|<startport-endport>/[<proto>]
)since
=(<container id>
or<container name>
)status=
(created
|restarting
|running
|removing
|paused
|exited
|dead
)volume
=(<volume name>
or<mount point destination>
)
GET
/containers/json
curl \
--request GET 'http://api.example.com/v1.44/containers/json'
Response examples (200)
[
{
"Id": "8dfafdbc3a40",
"Image": "ubuntu:latest",
"Names": [
"/boring_feynman"
],
"Ports": [
{
"Type": "tcp",
"PublicPort": 3333,
"PrivatePort": 2222
}
],
"State": "Exited",
"Labels": {
"com.example.vendor": "Acme",
"com.example.license": "GPL",
"com.example.version": "1.0"
},
"Mounts": [
{
"RW": false,
"Mode": "ro,Z",
"Name": "fac362...80535",
"Driver": "local",
"Source": "/data",
"Destination": "/data",
"Propagation": ""
}
],
"SizeRw": 12288,
"Status": "Exit 0",
"Command": "echo 1",
"Created": 1367854155,
"ImageID": "d74508fb6632491cea586a1fd7d748dfc5274cd6fdfedee309ecdcbc2bf5cb82",
"HostConfig": {
"NetworkMode": "default"
},
"SizeRootFs": 0,
"NetworkSettings": {
"Networks": {
"bridge": {
"Gateway": "172.17.0.1",
"IPAddress": "172.17.0.2",
"NetworkID": "7ea29fc1412292a2d7bba362f9253545fecdfa8ce9a6e37dd10ba8bee7129812",
"EndpointID": "2cdc4edb1ded3631c81f57966563e5c8525b81121bb3706a9a9a3ae102711f3f",
"MacAddress": "02:42:ac:11:00:02",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0
}
}
}
},
{
"Id": "9cd87474be90",
"Image": "ubuntu:latest",
"Names": [
"/coolName"
],
"Ports": [],
"State": "Exited",
"Labels": {},
"Mounts": [],
"SizeRw": 12288,
"Status": "Exit 0",
"Command": "echo 222222",
"Created": 1367854155,
"ImageID": "d74508fb6632491cea586a1fd7d748dfc5274cd6fdfedee309ecdcbc2bf5cb82",
"HostConfig": {
"NetworkMode": "default"
},
"SizeRootFs": 0,
"NetworkSettings": {
"Networks": {
"bridge": {
"Gateway": "172.17.0.1",
"IPAddress": "172.17.0.8",
"NetworkID": "7ea29fc1412292a2d7bba362f9253545fecdfa8ce9a6e37dd10ba8bee7129812",
"EndpointID": "88eaed7b37b38c2a3f0c4bc796494fdf51b270c2d22656412a2ca5d559a64d7a",
"MacAddress": "02:42:ac:11:00:08",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0
}
}
}
},
{
"Id": "3176a2479c92",
"Image": "ubuntu:latest",
"Names": [
"/sleepy_dog"
],
"Ports": [],
"State": "Exited",
"Labels": {},
"Mounts": [],
"SizeRw": 12288,
"Status": "Exit 0",
"Command": "echo 3333333333333333",
"Created": 1367854154,
"ImageID": "d74508fb6632491cea586a1fd7d748dfc5274cd6fdfedee309ecdcbc2bf5cb82",
"HostConfig": {
"NetworkMode": "default"
},
"SizeRootFs": 0,
"NetworkSettings": {
"Networks": {
"bridge": {
"Gateway": "172.17.0.1",
"IPAddress": "172.17.0.6",
"NetworkID": "7ea29fc1412292a2d7bba362f9253545fecdfa8ce9a6e37dd10ba8bee7129812",
"EndpointID": "8b27c041c30326d59cd6e6f510d4f8d1d570a228466f956edf7815508f78e30d",
"MacAddress": "02:42:ac:11:00:06",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0
}
}
}
},
{
"Id": "4cb07b47f9fb",
"Image": "ubuntu:latest",
"Names": [
"/running_cat"
],
"Ports": [],
"State": "Exited",
"Labels": {},
"Mounts": [],
"SizeRw": 12288,
"Status": "Exit 0",
"Command": "echo 444444444444444444444444444444444",
"Created": 1367854152,
"ImageID": "d74508fb6632491cea586a1fd7d748dfc5274cd6fdfedee309ecdcbc2bf5cb82",
"HostConfig": {
"NetworkMode": "default"
},
"SizeRootFs": 0,
"NetworkSettings": {
"Networks": {
"bridge": {
"Gateway": "172.17.0.1",
"IPAddress": "172.17.0.5",
"NetworkID": "7ea29fc1412292a2d7bba362f9253545fecdfa8ce9a6e37dd10ba8bee7129812",
"EndpointID": "d91c7b2f0644403d7ef3095985ea0e2370325cd2332ff3a3225c4247328e66e9",
"MacAddress": "02:42:ac:11:00:05",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0
}
}
}
}
]
Response examples (200)
[
{
"Id": "string",
"Names": [
"string"
],
"Image": "string",
"ImageID": "string",
"Command": "string",
"Created": 42,
"Ports": [
{
"Type": "tcp",
"PublicPort": 80,
"PrivatePort": 8080
}
],
"SizeRw": 42,
"SizeRootFs": 42,
"Labels": {
"additionalProperty1": "string",
"additionalProperty2": "string"
},
"State": "string",
"Status": "string",
"HostConfig": {
"NetworkMode": "string"
},
"NetworkSettings": {
"Networks": {
"additionalProperty1": {
"IPAMConfig": {
"IPv4Address": "172.20.30.33",
"IPv6Address": "2001:db8:abcd::3033",
"LinkLocalIPs": [
"169.254.34.68",
"fe80::3468"
]
},
"Links": [
"container_1",
"container_2"
],
"MacAddress": "02:42:ac:11:00:04",
"Aliases": [
"server_x",
"server_y"
],
"NetworkID": "08754567f1f40222263eab4102e1c733ae697e8e354aa9cd6e18d7402835292a",
"EndpointID": "b88f5b905aabf2893f3cbc4ee42d1ea7980bbc0a92e2c8922b1e1795298afb0b",
"Gateway": "172.17.0.1",
"IPAddress": "172.17.0.4",
"IPPrefixLen": 16,
"IPv6Gateway": "2001:db8:2::100",
"GlobalIPv6Address": "2001:db8::5689",
"GlobalIPv6PrefixLen": 64,
"DriverOpts": {
"com.example.some-label": "some-value",
"com.example.some-other-label": "some-other-value"
},
"DNSNames": [
"foobar",
"server_x",
"server_y",
"my.ctr"
]
},
"additionalProperty2": {
"IPAMConfig": {
"IPv4Address": "172.20.30.33",
"IPv6Address": "2001:db8:abcd::3033",
"LinkLocalIPs": [
"169.254.34.68",
"fe80::3468"
]
},
"Links": [
"container_1",
"container_2"
],
"MacAddress": "02:42:ac:11:00:04",
"Aliases": [
"server_x",
"server_y"
],
"NetworkID": "08754567f1f40222263eab4102e1c733ae697e8e354aa9cd6e18d7402835292a",
"EndpointID": "b88f5b905aabf2893f3cbc4ee42d1ea7980bbc0a92e2c8922b1e1795298afb0b",
"Gateway": "172.17.0.1",
"IPAddress": "172.17.0.4",
"IPPrefixLen": 16,
"IPv6Gateway": "2001:db8:2::100",
"GlobalIPv6Address": "2001:db8::5689",
"GlobalIPv6PrefixLen": 64,
"DriverOpts": {
"com.example.some-label": "some-value",
"com.example.some-other-label": "some-other-value"
},
"DNSNames": [
"foobar",
"server_x",
"server_y",
"my.ctr"
]
}
}
},
"Mounts": [
{
"Type": "volume",
"Name": "myvolume",
"Source": "/var/lib/docker/volumes/myvolume/_data",
"Destination": "/usr/share/nginx/html/",
"Driver": "local",
"Mode": "z",
"RW": true,
"Propagation": "string"
}
]
}
]
Response examples (400)
{
"message": "Something went wrong."
}
Response examples (400)
{
"message": "Something went wrong."
}
Response examples (500)
{
"message": "Something went wrong."
}
Response examples (500)
{
"message": "Something went wrong."
}