Skip to content

Instantly share code, notes, and snippets.

@jreuben11 jreuben11/DockerRest.md Secret
Last active Dec 14, 2016

Embed
What would you like to do?
Docker REST API Quickref

The Docker CLI commands actually encapsulate Rest calls to the host Docker Daemon https://docs.docker.com/engine/reference/api/docker_remote_api_v1.24/

The daemon listens on unix:///var/run/docker.sock - which you can curl into: curl --unix-socket /var/run/docker.sock http:/containers/json

  • In theory, a Container app could be Cluster-enabled via startup calls to the host Docker Remote REST API !
POST /swarm/join
POST /services/create

Here's a summary of the exposed API surface:

Containers

  • GET /containers/json - List containers
  • POST /containers/create - Create a container
  • GET /containers/(id or name)/json - Inspect a container
  • GET /containers/(id or name)/top - List processes running in a container
  • GET /containers/(id or name)/logs - Get container logs
  • GET /containers/(id or name)/changes - Inspect changes on a container’s filesystem
  • GET /containers/(id or name)/export - Export a container
  • GET /containers/(id or name)/stats - Get container stats based on resource usage
  • POST /containers/(id or name)/resize - Resize a container TTY
  • POST /containers/(id or name)/start - Start a container
  • POST /containers/(id or name)/stop - Stop a container
  • POST /containers/(id or name)/restart - Restart a container
  • POST /containers/(id or name)/kill - Kill a container
  • POST /containers/(id or name)/update - Update a container config
  • POST /containers/(id or name)/rename - Rename a container
  • POST /containers/(id or name)/pause - Pause a container
  • POST /containers/(id or name)/unpause - Unpause a container
  • POST /containers/(id or name)/attach - Attach to a container
  • GET /containers/(id or name)/attach/ws - Attach to a container (websocket)
  • POST /containers/(id or name)/wait - Wait for a container
  • DELETE /containers/(id or name) - Remove a container
  • HEAD /containers/(id or name)/archive - Retrieving information about files and folders in a container
  • GET /containers/(id or name)/archive - Get an archive of a filesystem resource in a container
  • PUT /containers/(id or name)/archive - Extract an archive of files or folders to a directory in a container

Images

  • GET /images/json - Build image from a Dockerfile
  • POST /build - List Images
  • POST /images/create - Create an image
  • GET /images/(name)/json - Inspect an image
  • GET /images/(name)/history - Get the history of an image
  • POST /images/(name)/push - Push an image on the registry
  • POST /images/(name)/tag - Tag an image into a repository
  • DELETE /images/(name) - Remove an image
  • GET /images/search - Search images

Misc

  • POST /auth - Check auth configuration
  • GET /info - Display system-wide information
  • GET /version - Show the docker version information
  • GET /_ping - Ping the docker server
  • POST /commit - Create a new image from a container’s changes
  • GET /events - Monitor Docker’s events
  • GET /images/(name)/get - Get a tarball containing all images in a repository
  • GET /images/get - Get a tarball containing all images
  • POST /images/load - Load a tarball with a set of images and tags into docker
  • POST /containers/(id or name)/exec - Exec Create
  • POST /exec/(id)/start - Exec Start
  • POST /exec/(id)/resize - Exec Resize
  • GET /exec/(id)/json - Exec Inspect

Volumes

  • GET /volumes - List volumes
  • POST /volumes/create - Create a volume
  • GET /volumes/(name) - Inspect a volume
  • DELETE /volumes/(name) - Remove a volume

Networks

  • GET /networks - List networks
  • GET /networks/ - Inspect network
  • POST /networks/create - Create a network
  • POST /networks/(id)/connect - Connect a container to a network
  • POST /networks/(id)/disconnect - Disconnect a container from a network
  • DELETE /networks/(id) - Remove a network

Nodes

  • GET /nodes - list nodes
  • GET /nodes - inspect a node

Swarm

  • POST /swarm/init - Initialize a new Swarm
  • POST /swarm/join - Join an existing Swarm
  • POST /swarm/leave - Leave a Swarm
  • POST /swarm/update - Update a Swarm

Services

  • GET /services - List services
  • POST /services/create - Create a service
  • DELETE /services/(id or name) - Remove a service
  • GET /services/(id or name) - Inspect one or more services
  • POST /services/(id or name)/update - Update a service

Tasks

  • GET /tasks - List tasks
  • GET /tasks/(task id) - Inspect a task

Happy Docking !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.