Docker Hub Container API

Create and manage containers.

GitHub OpenAPI
Pull this API's OpenAPI, operations, scores and pricing into your own code or AI agent with a free APIs.io key — sign in with GitHub, Google or LinkedIn. No form to fill in; signing in shares your email address with us (Privacy).

Operations 25

Each operation below carries the questions people ask an LLM about it and the instructions they give an agent to run it. Generated by API Evangelist overlay

GET /containers/json List containers · List containers #
Ask an LLM
“Which containers are running on my Docker host?”
“Can I list containers that have been stopped too?”
Tell an agent
List all containers on the host.
Show the first {limit} containers, including stopped ones.
POST /containers/create Create a container · Create a container #
Ask an LLM
“How do I create a container from an image?”
“Can I set environment variables and a command when creating a container?”
Tell an agent
Create a container from image {image}.
Create container {name} from {image} with command {cmd}.
GET /containers/{id}/json Inspect a container · Inspect a container #
Ask an LLM
“What are the details of a container, like its IP and ports?”
“Can I see the size of a container's filesystem?”
Tell an agent
Inspect container {id}.
Show the filesystem size of container {id}.
GET /containers/{id}/top List processes inside a container · List processes running inside a container #
Ask an LLM
“Which processes are running inside a container?”
“Can I sort the process list with a custom ps command?”
Tell an agent
List processes running in container {id}.
Show the process list of container {id} sorted with {ps_args}.
GET /containers/{id}/logs Get a container's logs · Get container logs #
Ask an LLM
“Where can I read the logs a container has output?”
“Can I follow a container's logs in real time?”
Tell an agent
Get the logs of container {id}.
Follow the logs of container {id} since {since}.
GET /containers/{id}/changes Show filesystem changes on a container · Get changes on a container’s filesystem #
Ask an LLM
“What files have been added, changed or deleted in a container's filesystem?”
“Can I see the filesystem changes since a container was created?”
Tell an agent
Show filesystem changes on container {id}.
List which files were modified in container {id}.
GET /containers/{id}/export Export a container's filesystem · Export a container #
Ask an LLM
“How do I export a container's filesystem as a tarball?”
“Can I download a container's filesystem for backup?”
Tell an agent
Export container {id} as a tarball.
Download the filesystem of container {id}.
GET /containers/{id}/stats Get a container's resource usage · Get container stats based on resource usage #
Ask an LLM
“How much CPU and memory is a container using?”
“Can I stream a container's resource usage stats?”
Tell an agent
Get resource usage stats for container {id}.
Stream stats for container {id} with stream {stream}.
POST /containers/{id}/resize Resize a container's TTY · Resize a container TTY #
Ask an LLM
“How do I resize the terminal window of a container?”
“Does a container need to be restarted after resizing its TTY?”
Tell an agent
Resize the TTY of container {id} to {h} rows by {w} columns.
Change the terminal size of container {id} to {h}x{w}.
POST /containers/{id}/start Start a container · Start a container #
Ask an LLM
“How do I start a container that is stopped?”
“Can I start a container and keep it running in the background?”
Tell an agent
Start container {id}.
Start container {id} and detach with keys {detachKeys}.
POST /containers/{id}/stop Stop a container · Stop a container #
Ask an LLM
“How do I stop a running container?”
“Can I wait a few seconds before a container is forcefully killed?”
Tell an agent
Stop container {id}.
Stop container {id} after {t} seconds.
POST /containers/{id}/restart Restart a container · Restart a container #
Ask an LLM
“How do I restart a container?”
“Can I wait a few seconds before a container is restarted?”
Tell an agent
Restart container {id}.
Restart container {id} after {t} seconds.
POST /containers/{id}/kill Kill a container with a signal · Kill a container #
Ask an LLM
“How do I send a signal to a container to stop it?”
“Can I kill a container with SIGTERM instead of SIGKILL?”
Tell an agent
Kill container {id}.
Send signal {signal} to container {id}.
POST /containers/{id}/update Update a container's configuration · Update a container #
Ask an LLM
“How do I change a container's CPU or memory limits without recreating it?”
“Can I update a container's restart policy?”
Tell an agent
Set container {id} memory limit to {memory}.
Update container {id} restart policy to {restart}.
POST /containers/{id}/rename Rename a container · Rename a container #
Ask an LLM
“How do I rename a container?”
“Can I give a container a new name after it's created?”
Tell an agent
Rename container {id} to {name}.
Give container {id} the new name {name}.
POST /containers/{id}/pause Pause a container · Pause a container #
Ask an LLM
“How do I pause a container so its processes freeze?”
“Can I pause a container without it noticing?”
Tell an agent
Pause container {id}.
Freeze all processes in container {id}.
POST /containers/{id}/unpause Unpause a container · Unpause a container #
Ask an LLM
“How do I resume a paused container?”
“Can I unfreeze a container's processes?”
Tell an agent
Unpause container {id}.
Resume the frozen processes in container {id}.
POST /containers/{id}/attach Attach to a container's streams · Attach to a container #
Ask an LLM
“How do I attach to a container's stdin, stdout and stderr?”
“Can I replay a container's logs when attaching?”
Tell an agent
Attach to container {id} and stream its output.
Attach to container {id} and replay its logs.
GET /containers/{id}/attach/ws Attach to a container over WebSocket · Attach to a container via a websocket #
Ask an LLM
“Can I attach to a container using a WebSocket instead of hijacking the HTTP connection?”
“Is there a WebSocket endpoint for container attach?”
Tell an agent
Connect to container {id} over WebSocket.
Attach to container {id} via WebSocket and stream its output.
POST /containers/{id}/wait Wait for a container to stop · Wait for a container #
Ask an LLM
“How do I block until a container exits?”
“Can I wait for a container to stop before continuing?”
Tell an agent
Wait for container {id} to stop.
Wait until container {id} reaches condition {condition}.
DELETE /containers/{id} Remove a container · Remove a container #
Ask an LLM
“How do I delete a container I no longer need?”
“Can I force-remove a running container?”
Tell an agent destructive · confirm first
Remove container {id}.
Remove container {id} and its volumes.
HEAD /containers/{id}/archive Get file info for a container path · Get information about files in a container #
Ask an LLM
“What are the filesystem stats of a file inside a container?”
“Can I check a container path without downloading it?”
Tell an agent
Get info about {path} in container {id}.
Show the stat of {path} inside container {id}.
GET /containers/{id}/archive Download a file or directory from a container · Get an archive of a filesystem resource in a container #
Ask an LLM
“How do I download a file from inside a container?”
“Can I fetch a directory's contents as a tar archive?”
Tell an agent
Download {path} from container {id} as an archive.
Get the file {path} inside container {id}.
PUT /containers/{id}/archive Upload a file or directory to a container · Extract an archive of files or folders to a directory in a container #
Ask an LLM
“How do I upload a tar archive into a container?”
“Can I extract an archive into a specific directory inside a container?”
Tell an agent
Extract {path} into container {id}.
Upload this archive to container {id} at {path}.
POST /containers/prune Delete stopped containers · Delete stopped containers #
Ask an LLM
“How do I clean up stopped containers?”
“Can I remove containers created before a certain time?”
Tell an agent destructive · confirm first
Prune stopped containers.
Remove stopped containers matching {filters}.

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/docker-hub:docker-hub-container-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

docker-hub-container-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Docker Engine Container API
  version: '1.33'
  x-logo:
    url: https://docs.docker.com/images/logo-docker-main.png
  description: 'The Engine API is an HTTP API served by Docker Engine. It is the API the Docker client uses to communicate with the Engine, so everything the Docker client can do can be done with the API.


    Most of the client''s commands map directly to API endpoints (e.g. `docker ps` is `GET /containers/json`). The notable exception is running containers, which consists of several API calls.


    # Errors


    The API uses standard HTTP status codes to indicate the success or failure of the API call. The body of the response will be JSON in the following format:


    ```

    {

    "message": "page not found"

    }

    ```


    # Versioning


    The API is usually changed in each release of Docker, so API calls are versioned to ensure that clients don''t break.


    For Docker Engine 17.09, the API version is 1.32. To lock to this version, you prefix the URL with `/v1.32`. For example, calling `/info` is the same as calling `/v1.32/info`.


    Engine releases in the near future should support this version of the API, so your client will continue to work even if it is talking to a newer Engine.


    In previous versions of Docker, it was possible to access the API without providing a version. This behaviour is now deprecated will be removed in a future version of Docker.


    The API uses an open schema model, which means server may add extra properties to responses. Likewise, the server will ignore any extra query parameters and request body properties. When you write clients, you need to ignore additional properties in responses to ensure they do not break when talking to newer Docker daemons.


    This documentation is for version 1.33 of the API. Use this table to find documentation for previous versions of the API:


    Docker version | API version | Changes

    ----------------|-------------|---------

    17.09.x | 1.31 | API changes

    17.07.x | 1.31 | API changes

    17.06.x | 1.30 | API changes

    17.05.x | 1.29 | API changes

    17.04.x | 1.28 | API changes

    17.03.1 | 1.27 | API changes

    1.13.1 & 17.03.0 | 1.26 | API changes

    1.13.0 | 1.25 | API changes

    1.12.x | 1.24 | API changes

    1.11.x | 1.23 | API changes

    1.10.x | 1.22 | API changes

    1.9.x | 1.21 | API changes

    1.8.x | 1.20 | API changes

    1.7.x | 1.19 | API changes

    1.6.x | 1.18 | API changes


    # Authentication


    Authentication for registries is handled client side. The client has to send authentication details to various endpoints that need to communicate with registries, such as `POST /images/(name)/push`. These are sent as `X-Registry-Auth` header as a Base64 encoded (JSON) string with the following structure:


    ```

    {

    "username": "string",

    "password": "string",

    "email": "string",

    "serveraddress": "string"

    }

    ```


    The `serveraddress` is a domain/IP without a protocol. Throughout this structure, double quotes are required.


    If you have already got an identity token from the `/auth` endpoint, you can just pass this instead of credentials:


    ```

    {

    "identitytoken": "9cbaf023786cd7..."

    }

    ```'
servers:
- url: /v1.33
tags:


# --- truncated at 32 KB (117 KB total) ---
# Full source: https://artifacts.apis.io/docker-hub/openapi/docker-hub-container-api-openapi.yml