List containers Run in API Explorer

GET /containers/json

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

  • all boolean

    Return all containers. By default, only running containers are shown.

    Default value is false.

  • limit integer

    Return this number of most recently created containers, including non-running ones.

  • size boolean

    Return the size of container as fields SizeRw and SizeRootFs.

    Default value is false.

  • filters string

    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 ID
    • isolation=(default|process|hyperv) (Windows daemon only)
    • is-task=(true|false)
    • label=key or label="key=value" of a container label
    • name=<name> a container's name
    • network=(<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>)

Responses

  • 200 application/json

    no error

    Hide response attributes Show response attributes object
    • Id string

      The ID of this container

    • Names array[string]

      The names that this container has been given

    • Image string

      The name of the image used when creating this container

    • ImageID string

      The ID of the image that this container was created from

    • Command string

      Command to run when starting the container

    • Created integer(int64)

      When the container was created

    • Ports array[object]

      The ports exposed by this container

      An open port on a container

      Hide Ports attributes Show Ports attributes object
      • IP string(ip-address)

        Host IP address that the container's port is mapped to

      • PrivatePort integer(uint16) Required

        Port on the container

      • PublicPort integer(uint16)

        Port exposed on the host

      • Type string Required

        Values are tcp, udp, or sctp.

    • SizeRw integer(int64)

      The size of files that have been created or changed by this container

    • SizeRootFs integer(int64)

      The total size of all the files in this container

    • Labels object

      User-defined key/value metadata.

      Hide Labels attribute Show Labels attribute object
      • * string Additional properties
    • State string

      The state of this container (e.g. Exited)

    • Status string

      Additional human-readable status of this container (e.g. Exit 0)

    • HostConfig object
      Hide HostConfig attribute Show HostConfig attribute object
      • NetworkMode string
    • NetworkSettings object

      A summary of the container's network settings

      Hide NetworkSettings attribute Show NetworkSettings attribute object
      • Networks object
        Hide Networks attribute Show Networks attribute object
        • * object Additional properties

          Configuration for a network endpoint.

          Hide * attributes Show * attributes object
          • IPAMConfig object

            EndpointIPAMConfig represents an endpoint's IPAM configuration.

            Hide IPAMConfig attributes Show IPAMConfig attributes object
            • IPv4Address string
            • IPv6Address string
            • LinkLocalIPs array[string]
          • MacAddress string

            MAC address for the endpoint on this network. The network driver might ignore this parameter.

          • Aliases array[string]
          • NetworkID string

            Unique ID of the network.

          • EndpointID string

            Unique ID for the service endpoint in a Sandbox.

          • Gateway string

            Gateway address for this network.

          • IPAddress string

            IPv4 address.

          • IPPrefixLen integer

            Mask length of the IPv4 address.

          • IPv6Gateway string

            IPv6 gateway address.

          • GlobalIPv6Address string

            Global IPv6 address.

          • GlobalIPv6PrefixLen integer(int64)

            Mask length of the global IPv6 address.

          • DriverOpts object

            DriverOpts is a mapping of driver options and values. These options are passed directly to the driver and are driver specific.

            Hide DriverOpts attribute Show DriverOpts attribute object
            • * string Additional properties
          • DNSNames array[string]

            List of all DNS names an endpoint has on a specific network. This list is based on the container name, network aliases, container short ID, and hostname.

            These DNS names are non-fully qualified but can contain several dots. You can get fully qualified DNS names by appending .<network-name>. For instance, if container name is my.ctr and the network is named testnet, DNSNames will contain my.ctr and the FQDN will be my.ctr.testnet.

    • Mounts array[object]

      MountPoint represents a mount point configuration inside the container. This is used for reporting the mountpoints in use by a container.

      Hide Mounts attributes Show Mounts attributes object
      • Type string

        The mount type:

        • bind a mount of a file or directory from the host into the container.
        • volume a docker volume with the given Name.
        • tmpfs a tmpfs.
        • npipe a named pipe from the host into the container.
        • cluster a Swarm cluster volume

        Values are bind, volume, tmpfs, npipe, or cluster.

      • Name string

        Name is the name reference to the underlying data defined by Source e.g., the volume name.

      • Source string

        Source location of the mount.

        For volumes, this contains the storage location of the volume (within /var/lib/docker/volumes/). For bind-mounts, and npipe, this contains the source (host) part of the bind-mount. For tmpfs mount points, this field is empty.

      • Destination string

        Destination is the path relative to the container root (/) where the Source is mounted inside the container.

      • Driver string

        Driver is the volume driver used to create the volume (if it is a volume).

      • Mode string

        Mode is a comma separated list of options supplied by the user when creating the bind/volume mount.

        The default is platform-specific ("z" on Linux, empty on Windows).

      • RW boolean

        Whether the mount is mounted writable (read-write).

      • Propagation string

        Propagation describes how mounts are propagated from the host into the mount point, and vice-versa. Refer to the Linux kernel documentation for details. This field is not used on Windows.

  • 400 application/json

    bad parameter

    Hide response attribute Show response attribute object
    • message string Required

      The error message.

  • 500 application/json

    server error

    Hide response attribute Show response attribute object
    • message string Required

      The error message.

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."
}