docs/reference/index.xml

18255 lines
795 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>References on Docker Docs</title>
<link>http://localhost/reference/</link>
<description>Recent content in References on Docker Docs</description>
<generator>Hugo -- gohugo.io</generator>
<language>en-us</language>
<atom:link href="http://localhost/reference/index.xml" rel="self" type="application/rss+xml" />
<item>
<title></title>
<link>http://localhost/reference/api/README/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>http://localhost/reference/api/README/</guid>
<description>&lt;p&gt;This directory holds the authoritative specifications of APIs defined and implemented by Docker. Currently this includes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The remote API by which a docker node can be queried over HTTP&lt;/li&gt;
&lt;li&gt;The registry API by which a docker node can download and upload
images for storage and sharing&lt;/li&gt;
&lt;li&gt;The index search API by which a docker node can search the public
index for images to download&lt;/li&gt;
&lt;li&gt;The docker.io OAuth and accounts API which 3rd party services can
use to access account information&lt;/li&gt;
&lt;/ul&gt;
</description>
</item>
<item>
<title></title>
<link>http://localhost/reference/logging/journald/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>http://localhost/reference/logging/journald/</guid>
<description>
&lt;h1 id=&#34;journald-logging-driver&#34;&gt;Journald logging driver&lt;/h1&gt;
&lt;p&gt;The &lt;code&gt;journald&lt;/code&gt; logging driver sends container logs to the &lt;a href=&#34;http://www.freedesktop.org/software/systemd/man/systemd-journald.service.html&#34;&gt;systemd
journal&lt;/a&gt;. Log entries can be retrieved using the &lt;code&gt;journalctl&lt;/code&gt;
command or through use of the journal API.&lt;/p&gt;
&lt;p&gt;In addition to the text of the log message itself, the &lt;code&gt;journald&lt;/code&gt; log
driver stores the following metadata in the journal with each message:&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Field&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;CONTAINER_ID&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;The container ID truncated to 12 characters.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;CONTAINER_ID_FULL&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;The full 64-character container ID.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;CONTAINER_NAME&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;The container name at the time it was started. If you use &lt;code&gt;docker rename&lt;/code&gt; to rename a container, the new name is not reflected in the journal entries.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h2 id=&#34;usage&#34;&gt;Usage&lt;/h2&gt;
&lt;p&gt;You can configure the default logging driver by passing the
&lt;code&gt;--log-driver&lt;/code&gt; option to the Docker daemon:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;docker --log-driver=journald
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You can set the logging driver for a specific container by using the
&lt;code&gt;--log-driver&lt;/code&gt; option to &lt;code&gt;docker run&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;docker run --log-driver=journald ...
&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&#34;note-regarding-container-names&#34;&gt;Note regarding container names&lt;/h2&gt;
&lt;p&gt;The value logged in the &lt;code&gt;CONTAINER_NAME&lt;/code&gt; field is the container name
that was set at startup. If you use &lt;code&gt;docker rename&lt;/code&gt; to rename a
container, the new name will not be reflected in the journal entries.
Journal entries will continue to use the original name.&lt;/p&gt;
&lt;h2 id=&#34;retrieving-log-messages-with-journalctl&#34;&gt;Retrieving log messages with journalctl&lt;/h2&gt;
&lt;p&gt;You can use the &lt;code&gt;journalctl&lt;/code&gt; command to retrieve log messages. You
can apply filter expressions to limit the retrieved messages to a
specific container. For example, to retrieve all log messages from a
container referenced by name:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;# journalctl CONTAINER_NAME=webserver
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You can make use of additional filters to further limit the messages
retrieved. For example, to see just those messages generated since
the system last booted:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;# journalctl -b CONTAINER_NAME=webserver
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Or to retrieve log messages in JSON format with complete metadata:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;# journalctl -o json CONTAINER_NAME=webserver
&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&#34;retrieving-log-messages-with-the-journal-api&#34;&gt;Retrieving log messages with the journal API&lt;/h2&gt;
&lt;p&gt;This example uses the &lt;code&gt;systemd&lt;/code&gt; Python module to retrieve container
logs:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;import systemd.journal
reader = systemd.journal.Reader()
reader.add_match(&#39;CONTAINER_NAME=web&#39;)
for msg in reader:
print &#39;{CONTAINER_ID_FULL}: {MESSAGE}&#39;.format(**msg)
&lt;/code&gt;&lt;/pre&gt;
</description>
</item>
<item>
<title>Docker Glossary</title>
<link>http://localhost/reference/glossary/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>http://localhost/reference/glossary/</guid>
<description>
&lt;h1 id=&#34;glossary&#34;&gt;Glossary&lt;/h1&gt;
&lt;p&gt;A list of terms used around the Docker project.&lt;/p&gt;
&lt;h2 id=&#34;aufs&#34;&gt;aufs&lt;/h2&gt;
&lt;p&gt;aufs (advanced multi layered unification filesystem) is a Linux &lt;a href=&#34;#filesystem&#34;&gt;filesystem&lt;/a&gt; that
Docker supports as a storage backend. It implements the
&lt;a href=&#34;http://en.wikipedia.org/wiki/Union_mount&#34;&gt;union mount&lt;/a&gt; for Linux file systems.&lt;/p&gt;
&lt;h2 id=&#34;boot2docker&#34;&gt;boot2docker&lt;/h2&gt;
&lt;p&gt;&lt;a href=&#34;http://boot2docker.io/&#34;&gt;boot2docker&lt;/a&gt; is a lightweight Linux distribution made
specifically to run Docker containers. It is a common choice for a &lt;a href=&#34;#virtual-machine&#34;&gt;VM&lt;/a&gt;
to run Docker on Windows and Mac OS X.&lt;/p&gt;
&lt;p&gt;boot2docker can also refer to the boot2docker management tool on Windows and
Mac OS X which manages the boot2docker VM.&lt;/p&gt;
&lt;h2 id=&#34;btrfs&#34;&gt;btrfs&lt;/h2&gt;
&lt;p&gt;btrfs (B-tree file system) is a Linux &lt;a href=&#34;#filesystem&#34;&gt;filesystem&lt;/a&gt; that Docker
supports as a storage backend. It is a &lt;a href=&#34;http://en.wikipedia.org/wiki/Copy-on-write&#34;&gt;copy-on-write&lt;/a&gt;
filesystem.&lt;/p&gt;
&lt;h2 id=&#34;build&#34;&gt;build&lt;/h2&gt;
&lt;p&gt;build is the process of building Docker images using a &lt;a href=&#34;#dockerfile&#34;&gt;Dockerfile&lt;/a&gt;.
The build uses a Dockerfile and a &amp;ldquo;context&amp;rdquo;. The context is the set of files in the
directory in which the image is built.&lt;/p&gt;
&lt;h2 id=&#34;cgroups&#34;&gt;cgroups&lt;/h2&gt;
&lt;p&gt;cgroups is a Linux kernel feature that limits, accounts for, and isolates
the resource usage (CPU, memory, disk I/O, network, etc.) of a collection
of processes. Docker relies on cgroups to control and isolate resource limits.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Also known as : control groups&lt;/em&gt;&lt;/p&gt;
&lt;h2 id=&#34;compose&#34;&gt;Compose&lt;/h2&gt;
&lt;p&gt;&lt;a href=&#34;https://github.com/docker/compose&#34;&gt;Compose&lt;/a&gt; is a tool for defining and
running complex applications with Docker. With compose, you define a
multi-container application in a single file, then spin your
application up in a single command which does everything that needs to
be done to get it running.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Also known as : docker-compose, fig&lt;/em&gt;&lt;/p&gt;
&lt;h2 id=&#34;container&#34;&gt;container&lt;/h2&gt;
&lt;p&gt;A container is a runtime instance of a &lt;a href=&#34;#image&#34;&gt;docker image&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;A Docker container consists of&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A Docker image&lt;/li&gt;
&lt;li&gt;Execution environment&lt;/li&gt;
&lt;li&gt;A standard set of instructions&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The concept is borrowed from Shipping Containers, which define a standard to ship
goods globally. Docker defines a standard to ship software.&lt;/p&gt;
&lt;h2 id=&#34;data-volume&#34;&gt;data volume&lt;/h2&gt;
&lt;p&gt;A data volume is a specially-designated directory within one or more containers
that bypasses the Union File System. Data volumes are designed to persist data,
independent of the container&amp;rsquo;s life cycle. Docker therefore never automatically
delete volumes when you remove a container, nor will it &amp;ldquo;garbage collect&amp;rdquo;
volumes that are no longer referenced by a container.&lt;/p&gt;
&lt;h2 id=&#34;docker&#34;&gt;Docker&lt;/h2&gt;
&lt;p&gt;The term Docker can refer to&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The Docker project as a whole, which is a platform for developers and sysadmins to
develop, ship, and run applications&lt;/li&gt;
&lt;li&gt;The docker daemon process running on the host which manages images and containers&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;docker-hub&#34;&gt;Docker Hub&lt;/h2&gt;
&lt;p&gt;The &lt;a href=&#34;https://hub.docker.com/&#34;&gt;Docker Hub&lt;/a&gt; is a centralized resource for working with
Docker and its components. It provides the following services:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Docker image hosting&lt;/li&gt;
&lt;li&gt;User authentication&lt;/li&gt;
&lt;li&gt;Automated image builds and work-flow tools such as build triggers and web hooks&lt;/li&gt;
&lt;li&gt;Integration with GitHub and BitBucket&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;dockerfile&#34;&gt;Dockerfile&lt;/h2&gt;
&lt;p&gt;A Dockerfile is a text document that contains all the commands you would
normally execute manually in order to build a Docker image. Docker can
build images automatically by reading the instructions from a Dockerfile.&lt;/p&gt;
&lt;h2 id=&#34;filesystem&#34;&gt;filesystem&lt;/h2&gt;
&lt;p&gt;A file system is the method an operating system uses to name files
and assign them locations for efficient storage and retrieval.&lt;/p&gt;
&lt;p&gt;Examples :&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Linux : ext4, aufs, btrfs, zfs&lt;/li&gt;
&lt;li&gt;Windows : NTFS&lt;/li&gt;
&lt;li&gt;OS X : HFS+&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;image&#34;&gt;image&lt;/h2&gt;
&lt;p&gt;Docker images are the basis of &lt;a href=&#34;#container&#34;&gt;containers&lt;/a&gt;. An Image is an
ordered collection of root filesystem changes and the corresponding
execution parameters for use within a container runtime. An image typically
contains a union of layered filesystems stacked on top of each other. An image
does not have state and it never changes.&lt;/p&gt;
&lt;h2 id=&#34;libcontainer&#34;&gt;libcontainer&lt;/h2&gt;
&lt;p&gt;libcontainer provides a native Go implementation for creating containers with
namespaces, cgroups, capabilities, and filesystem access controls. It allows
you to manage the lifecycle of the container performing additional operations
after the container is created.&lt;/p&gt;
&lt;h2 id=&#34;link&#34;&gt;link&lt;/h2&gt;
&lt;p&gt;links provide an interface to connect Docker containers running on the same host
to each other without exposing the hosts&amp;rsquo; network ports. When you set up a link,
you create a conduit between a source container and a recipient container.
The recipient can then access select data about the source. To create a link,
you can use the &lt;code&gt;--link&lt;/code&gt; flag.&lt;/p&gt;
&lt;h2 id=&#34;machine&#34;&gt;Machine&lt;/h2&gt;
&lt;p&gt;&lt;a href=&#34;https://github.com/docker/machine&#34;&gt;Machine&lt;/a&gt; is a Docker tool which
makes it really easy to create Docker hosts on your computer, on
cloud providers and inside your own data center. It creates servers,
installs Docker on them, then configures the Docker client to talk to them.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Also known as : docker-machine&lt;/em&gt;&lt;/p&gt;
&lt;h2 id=&#34;overlay&#34;&gt;overlay&lt;/h2&gt;
&lt;p&gt;OverlayFS is a &lt;a href=&#34;#filesystem&#34;&gt;filesystem&lt;/a&gt; service for Linux which implements a
&lt;a href=&#34;http://en.wikipedia.org/wiki/Union_mount&#34;&gt;union mount&lt;/a&gt; for other file systems.
It is supported by the Docker daemon as a storage driver.&lt;/p&gt;
&lt;h2 id=&#34;registry&#34;&gt;registry&lt;/h2&gt;
&lt;p&gt;A Registry is a hosted service containing &lt;a href=&#34;#repository&#34;&gt;repositories&lt;/a&gt; of &lt;a href=&#34;#image&#34;&gt;images&lt;/a&gt;
which responds to the Registry API.&lt;/p&gt;
&lt;p&gt;The default registry can be accessed using a browser at &lt;a href=&#34;#docker-hub&#34;&gt;Docker Hub&lt;/a&gt;
or using the &lt;code&gt;docker search&lt;/code&gt; command.&lt;/p&gt;
&lt;h2 id=&#34;repository&#34;&gt;repository&lt;/h2&gt;
&lt;p&gt;A repository is a set of Docker images. A repository can be shared by pushing it
to a &lt;a href=&#34;#registry&#34;&gt;registry&lt;/a&gt; server. The different images in the repository can be
labeled using &lt;a href=&#34;#tag&#34;&gt;tags&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Here is an example of the shared &lt;a href=&#34;https://registry.hub.docker.com/_/nginx/&#34;&gt;nginx repository&lt;/a&gt;
and its &lt;a href=&#34;https://registry.hub.docker.com/_/nginx/tags/manage/&#34;&gt;tags&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&#34;swarm&#34;&gt;Swarm&lt;/h2&gt;
&lt;p&gt;&lt;a href=&#34;https://github.com/docker/swarm&#34;&gt;Swarm&lt;/a&gt; is a native clustering tool for Docker.
Swarm pools together several Docker hosts and exposes them as a single virtual
Docker host. It serves the standard Docker API, so any tool that already works
with Docker can now transparently scale up to multiple hosts.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Also known as : docker-swarm&lt;/em&gt;&lt;/p&gt;
&lt;h2 id=&#34;tag&#34;&gt;tag&lt;/h2&gt;
&lt;p&gt;A tag is a label applied to a Docker image in a &lt;a href=&#34;#repository&#34;&gt;repository&lt;/a&gt;.
tags are how various images in a repository are distinguished from each other.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Note : This label is not related to the key=value labels set for docker daemon&lt;/em&gt;&lt;/p&gt;
&lt;h2 id=&#34;union-file-system&#34;&gt;Union file system&lt;/h2&gt;
&lt;p&gt;Union file systems, or UnionFS, are file systems that operate by creating layers, making them
very lightweight and fast. Docker uses union file systems to provide the building
blocks for containers.&lt;/p&gt;
&lt;h2 id=&#34;virtual-machine&#34;&gt;Virtual Machine&lt;/h2&gt;
&lt;p&gt;A Virtual Machine is a program that emulates a complete computer and imitates dedicated hardware.
It shares physical hardware resources with other users but isolates the operating system. The
end user has the same experience on a Virtual Machine as they would have on dedicated hardware.&lt;/p&gt;
&lt;p&gt;Compared to to containers, a Virtual Machine is heavier to run, provides more isolation,
gets its own set of resources and does minimal sharing.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Also known as : VM&lt;/em&gt;&lt;/p&gt;
</description>
</item>
<item>
<title>Docker Hub API</title>
<link>http://localhost/reference/api/docker-io_api/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>http://localhost/reference/api/docker-io_api/</guid>
<description>
&lt;h1 id=&#34;docker-hub-api&#34;&gt;Docker Hub API&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;This is the REST API for &lt;a href=&#34;https://hub.docker.com&#34;&gt;Docker Hub&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Authorization is done with basic auth over SSL&lt;/li&gt;
&lt;li&gt;Not all commands require authentication, only those noted as such.&lt;/li&gt;
&lt;/ul&gt;
&lt;h1 id=&#34;repositories&#34;&gt;Repositories&lt;/h1&gt;
&lt;h2 id=&#34;user-repository&#34;&gt;User repository&lt;/h2&gt;
&lt;h3 id=&#34;create-a-user-repository&#34;&gt;Create a user repository&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;PUT /v1/repositories/(namespace)/(repo_name)/&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Create a user repository with the given &lt;code&gt;namespace&lt;/code&gt; and &lt;code&gt;repo_name&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example Request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; PUT /v1/repositories/foo/bar/ HTTP/1.1
Host: index.docker.io
Accept: application/json
Content-Type: application/json
Authorization: Basic akmklmasadalkm==
X-Docker-Token: true
[{&amp;quot;id&amp;quot;: &amp;quot;9e89cc6f0bc3c38722009fe6857087b486531f9a779a0c17e3ed29dae8f12c4f&amp;quot;}]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;namespace&lt;/strong&gt; the namespace for the repo&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;repo_name&lt;/strong&gt; the name for the repo&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Example Response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200
Vary: Accept
Content-Type: application/json
WWW-Authenticate: Token signature=123abc,repository=&amp;quot;foo/bar&amp;quot;,access=write
X-Docker-Token: signature=123abc,repository=&amp;quot;foo/bar&amp;quot;,access=write
X-Docker-Endpoints: registry-1.docker.io [, registry-2.docker.io]
&amp;quot;&amp;quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; Created&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;400&lt;/strong&gt; Errors (invalid json, missing or invalid fields, etc)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;401&lt;/strong&gt; Unauthorized&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;403&lt;/strong&gt; Account is not Active&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;delete-a-user-repository&#34;&gt;Delete a user repository&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;DELETE /v1/repositories/(namespace)/(repo_name)/&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Delete a user repository with the given &lt;code&gt;namespace&lt;/code&gt; and &lt;code&gt;repo_name&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example Request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; DELETE /v1/repositories/foo/bar/ HTTP/1.1
Host: index.docker.io
Accept: application/json
Content-Type: application/json
Authorization: Basic akmklmasadalkm==
X-Docker-Token: true
&amp;quot;&amp;quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;namespace&lt;/strong&gt; the namespace for the repo&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;repo_name&lt;/strong&gt; the name for the repo&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Example Response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 202
Vary: Accept
Content-Type: application/json
WWW-Authenticate: Token signature=123abc,repository=&amp;quot;foo/bar&amp;quot;,access=delete
X-Docker-Token: signature=123abc,repository=&amp;quot;foo/bar&amp;quot;,access=delete
X-Docker-Endpoints: registry-1.docker.io [, registry-2.docker.io]
&amp;quot;&amp;quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; Deleted&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;202&lt;/strong&gt; Accepted&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;400&lt;/strong&gt; Errors (invalid json, missing or invalid fields, etc)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;401&lt;/strong&gt; Unauthorized&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;403&lt;/strong&gt; Account is not Active&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;library-repository&#34;&gt;Library repository&lt;/h2&gt;
&lt;h3 id=&#34;create-a-library-repository&#34;&gt;Create a library repository&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;PUT /v1/repositories/(repo_name)/&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Create a library repository with the given &lt;code&gt;repo_name&lt;/code&gt;.
This is a restricted feature only available to docker admins.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;When namespace is missing, it is assumed to be &lt;code&gt;library&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;strong&gt;Example Request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; PUT /v1/repositories/foobar/ HTTP/1.1
Host: index.docker.io
Accept: application/json
Content-Type: application/json
Authorization: Basic akmklmasadalkm==
X-Docker-Token: true
[{&amp;quot;id&amp;quot;: &amp;quot;9e89cc6f0bc3c38722009fe6857087b486531f9a779a0c17e3ed29dae8f12c4f&amp;quot;}]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;repo_name&lt;/strong&gt; the library name for the repo&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Example Response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200
Vary: Accept
Content-Type: application/json
WWW-Authenticate: Token signature=123abc,repository=&amp;quot;library/foobar&amp;quot;,access=write
X-Docker-Token: signature=123abc,repository=&amp;quot;foo/bar&amp;quot;,access=write
X-Docker-Endpoints: registry-1.docker.io [, registry-2.docker.io]
&amp;quot;&amp;quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; Created&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;400&lt;/strong&gt; Errors (invalid json, missing or invalid fields, etc)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;401&lt;/strong&gt; Unauthorized&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;403&lt;/strong&gt; Account is not Active&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;delete-a-library-repository&#34;&gt;Delete a library repository&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;DELETE /v1/repositories/(repo_name)/&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Delete a library repository with the given &lt;code&gt;repo_name&lt;/code&gt;.
This is a restricted feature only available to docker admins.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;When namespace is missing, it is assumed to be &lt;code&gt;library&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;strong&gt;Example Request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; DELETE /v1/repositories/foobar/ HTTP/1.1
Host: index.docker.io
Accept: application/json
Content-Type: application/json
Authorization: Basic akmklmasadalkm==
X-Docker-Token: true
&amp;quot;&amp;quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;repo_name&lt;/strong&gt; the library name for the repo&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Example Response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 202
Vary: Accept
Content-Type: application/json
WWW-Authenticate: Token signature=123abc,repository=&amp;quot;library/foobar&amp;quot;,access=delete
X-Docker-Token: signature=123abc,repository=&amp;quot;foo/bar&amp;quot;,access=delete
X-Docker-Endpoints: registry-1.docker.io [, registry-2.docker.io]
&amp;quot;&amp;quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; Deleted&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;202&lt;/strong&gt; Accepted&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;400&lt;/strong&gt; Errors (invalid json, missing or invalid fields, etc)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;401&lt;/strong&gt; Unauthorized&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;403&lt;/strong&gt; Account is not Active&lt;/li&gt;
&lt;/ul&gt;
&lt;h1 id=&#34;repository-images&#34;&gt;Repository images&lt;/h1&gt;
&lt;h2 id=&#34;user-repository-images&#34;&gt;User repository images&lt;/h2&gt;
&lt;h3 id=&#34;update-user-repository-images&#34;&gt;Update user repository images&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;PUT /v1/repositories/(namespace)/(repo_name)/images&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Update the images for a user repo.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example Request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; PUT /v1/repositories/foo/bar/images HTTP/1.1
Host: index.docker.io
Accept: application/json
Content-Type: application/json
Authorization: Basic akmklmasadalkm==
[{&amp;quot;id&amp;quot;: &amp;quot;9e89cc6f0bc3c38722009fe6857087b486531f9a779a0c17e3ed29dae8f12c4f&amp;quot;,
&amp;quot;checksum&amp;quot;: &amp;quot;b486531f9a779a0c17e3ed29dae8f12c4f9e89cc6f0bc3c38722009fe6857087&amp;quot;}]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;namespace&lt;/strong&gt; the namespace for the repo&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;repo_name&lt;/strong&gt; the name for the repo&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Example Response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 204
Vary: Accept
Content-Type: application/json
&amp;quot;&amp;quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;204&lt;/strong&gt; Created&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;400&lt;/strong&gt; Errors (invalid json, missing or invalid fields, etc)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;401&lt;/strong&gt; Unauthorized&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;403&lt;/strong&gt; Account is not Active or permission denied&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;list-user-repository-images&#34;&gt;List user repository images&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /v1/repositories/(namespace)/(repo_name)/images&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Get the images for a user repo.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example Request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /v1/repositories/foo/bar/images HTTP/1.1
Host: index.docker.io
Accept: application/json
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;namespace&lt;/strong&gt; the namespace for the repo&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;repo_name&lt;/strong&gt; the name for the repo&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Example Response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200
Vary: Accept
Content-Type: application/json
[{&amp;quot;id&amp;quot;: &amp;quot;9e89cc6f0bc3c38722009fe6857087b486531f9a779a0c17e3ed29dae8f12c4f&amp;quot;,
&amp;quot;checksum&amp;quot;: &amp;quot;b486531f9a779a0c17e3ed29dae8f12c4f9e89cc6f0bc3c38722009fe6857087&amp;quot;},
{&amp;quot;id&amp;quot;: &amp;quot;ertwetewtwe38722009fe6857087b486531f9a779a0c1dfddgfgsdgdsgds&amp;quot;,
&amp;quot;checksum&amp;quot;: &amp;quot;34t23f23fc17e3ed29dae8f12c4f9e89cc6f0bsdfgfsdgdsgdsgerwgew&amp;quot;}]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; OK&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; Not found&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;library-repository-images&#34;&gt;Library repository images&lt;/h2&gt;
&lt;h3 id=&#34;update-library-repository-images&#34;&gt;Update library repository images&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;PUT /v1/repositories/(repo_name)/images&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Update the images for a library repo.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example Request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; PUT /v1/repositories/foobar/images HTTP/1.1
Host: index.docker.io
Accept: application/json
Content-Type: application/json
Authorization: Basic akmklmasadalkm==
[{&amp;quot;id&amp;quot;: &amp;quot;9e89cc6f0bc3c38722009fe6857087b486531f9a779a0c17e3ed29dae8f12c4f&amp;quot;,
&amp;quot;checksum&amp;quot;: &amp;quot;b486531f9a779a0c17e3ed29dae8f12c4f9e89cc6f0bc3c38722009fe6857087&amp;quot;}]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;repo_name&lt;/strong&gt; the library name for the repo&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Example Response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 204
Vary: Accept
Content-Type: application/json
&amp;quot;&amp;quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;204&lt;/strong&gt; Created&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;400&lt;/strong&gt; Errors (invalid json, missing or invalid fields, etc)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;401&lt;/strong&gt; Unauthorized&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;403&lt;/strong&gt; Account is not Active or permission denied&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;list-library-repository-images&#34;&gt;List library repository images&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /v1/repositories/(repo_name)/images&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Get the images for a library repo.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example Request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /v1/repositories/foobar/images HTTP/1.1
Host: index.docker.io
Accept: application/json
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;repo_name&lt;/strong&gt; the library name for the repo&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Example Response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200
Vary: Accept
Content-Type: application/json
[{&amp;quot;id&amp;quot;: &amp;quot;9e89cc6f0bc3c38722009fe6857087b486531f9a779a0c17e3ed29dae8f12c4f&amp;quot;,
&amp;quot;checksum&amp;quot;: &amp;quot;b486531f9a779a0c17e3ed29dae8f12c4f9e89cc6f0bc3c38722009fe6857087&amp;quot;},
{&amp;quot;id&amp;quot;: &amp;quot;ertwetewtwe38722009fe6857087b486531f9a779a0c1dfddgfgsdgdsgds&amp;quot;,
&amp;quot;checksum&amp;quot;: &amp;quot;34t23f23fc17e3ed29dae8f12c4f9e89cc6f0bsdfgfsdgdsgdsgerwgew&amp;quot;}]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; OK&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; Not found&lt;/li&gt;
&lt;/ul&gt;
&lt;h1 id=&#34;repository-authorization&#34;&gt;Repository authorization&lt;/h1&gt;
&lt;h2 id=&#34;library-repository-1&#34;&gt;Library repository&lt;/h2&gt;
&lt;h3 id=&#34;authorize-a-token-for-a-library&#34;&gt;Authorize a token for a library&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;PUT /v1/repositories/(repo_name)/auth&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Authorize a token for a library repo&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example Request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; PUT /v1/repositories/foobar/auth HTTP/1.1
Host: index.docker.io
Accept: application/json
Authorization: Token signature=123abc,repository=&amp;quot;library/foobar&amp;quot;,access=write
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;repo_name&lt;/strong&gt; the library name for the repo&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Example Response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200
Vary: Accept
Content-Type: application/json
&amp;quot;OK&amp;quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; OK&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;403&lt;/strong&gt; Permission denied&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; Not found&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;user-repository-1&#34;&gt;User repository&lt;/h2&gt;
&lt;h3 id=&#34;authorize-a-token-for-a-user-repository&#34;&gt;Authorize a token for a user repository&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;PUT /v1/repositories/(namespace)/(repo_name)/auth&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Authorize a token for a user repo&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example Request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; PUT /v1/repositories/foo/bar/auth HTTP/1.1
Host: index.docker.io
Accept: application/json
Authorization: Token signature=123abc,repository=&amp;quot;foo/bar&amp;quot;,access=write
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;namespace&lt;/strong&gt; the namespace for the repo&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;repo_name&lt;/strong&gt; the name for the repo&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Example Response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200
Vary: Accept
Content-Type: application/json
&amp;quot;OK&amp;quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; OK&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;403&lt;/strong&gt; Permission denied&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; Not found&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;users&#34;&gt;Users&lt;/h2&gt;
&lt;h3 id=&#34;user-login&#34;&gt;User login&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /v1/users/&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;If you want to check your login, you can try this endpoint&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example Request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /v1/users/ HTTP/1.1
Host: index.docker.io
Accept: application/json
Authorization: Basic akmklmasadalkm==
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example Response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Vary: Accept
Content-Type: application/json
OK
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;401&lt;/strong&gt; Unauthorized&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;403&lt;/strong&gt; Account is not Active&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;user-register&#34;&gt;User register&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /v1/users/&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Registering a new account.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /v1/users/ HTTP/1.1
Host: index.docker.io
Accept: application/json
Content-Type: application/json
{&amp;quot;email&amp;quot;: &amp;quot;sam@docker.com&amp;quot;,
&amp;quot;password&amp;quot;: &amp;quot;toto42&amp;quot;,
&amp;quot;username&amp;quot;: &amp;quot;foobar&amp;quot;}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Json Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;email&lt;/strong&gt; valid email address, that needs to be confirmed&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;username&lt;/strong&gt; min 4 character, max 30 characters, must match
the regular expression [a-z0-9_].&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;password&lt;/strong&gt; min 5 characters&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Example Response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 201 OK
Vary: Accept
Content-Type: application/json
&amp;quot;User Created&amp;quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;201&lt;/strong&gt; User Created&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;400&lt;/strong&gt; Errors (invalid json, missing or invalid fields, etc)&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;update-user&#34;&gt;Update user&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;PUT /v1/users/(username)/&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Change a password or email address for given user. If you pass in an
email, it will add it to your account, it will not remove the old
one. Passwords will be updated.&lt;/p&gt;
&lt;p&gt;It is up to the client to verify that that password that is sent is
the one that they want. Common approach is to have them type it
twice.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example Request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; PUT /v1/users/fakeuser/ HTTP/1.1
Host: index.docker.io
Accept: application/json
Content-Type: application/json
Authorization: Basic akmklmasadalkm==
{&amp;quot;email&amp;quot;: &amp;quot;sam@docker.com&amp;quot;,
&amp;quot;password&amp;quot;: &amp;quot;toto42&amp;quot;}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;username&lt;/strong&gt; username for the person you want to update&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Example Response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 204
Vary: Accept
Content-Type: application/json
&amp;quot;&amp;quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;204&lt;/strong&gt; User Updated&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;400&lt;/strong&gt; Errors (invalid json, missing or invalid fields, etc)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;401&lt;/strong&gt; Unauthorized&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;403&lt;/strong&gt; Account is not Active&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; User not found&lt;/li&gt;
&lt;/ul&gt;
</description>
</item>
<item>
<title>Docker run reference</title>
<link>http://localhost/reference/run/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>http://localhost/reference/run/</guid>
<description>
&lt;!-- TODO (@thaJeztah) define more flexible table/td classes --&gt;
&lt;p&gt;&lt;style&gt;
.content-body table .no-wrap {
white-space: nowrap;
}
&lt;/style&gt;&lt;/p&gt;
&lt;h1 id=&#34;docker-run-reference&#34;&gt;Docker run reference&lt;/h1&gt;
&lt;p&gt;&lt;strong&gt;Docker runs processes in isolated containers&lt;/strong&gt;. When an operator
executes &lt;code&gt;docker run&lt;/code&gt;, she starts a process with its own file system,
its own networking, and its own isolated process tree. The
&lt;a href=&#34;http://localhost/docker/reference/glossary/#image&#34;&gt;&lt;em&gt;Image&lt;/em&gt;&lt;/a&gt; which starts the process may define
defaults related to the binary to run, the networking to expose, and
more, but &lt;code&gt;docker run&lt;/code&gt; gives final control to the operator who starts
the container from the image. That&amp;rsquo;s the main reason
&lt;a href=&#34;http://localhost/docker/reference/commandline/cli/#run&#34;&gt;&lt;em&gt;run&lt;/em&gt;&lt;/a&gt; has more options than any
other &lt;code&gt;docker&lt;/code&gt; command.&lt;/p&gt;
&lt;h2 id=&#34;general-form&#34;&gt;General form&lt;/h2&gt;
&lt;p&gt;The basic &lt;code&gt;docker run&lt;/code&gt; command takes this form:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ docker run [OPTIONS] IMAGE[:TAG|@DIGEST] [COMMAND] [ARG...]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To learn how to interpret the types of &lt;code&gt;[OPTIONS]&lt;/code&gt;,
see &lt;a href=&#34;http://localhost/docker/reference/commandline/cli/#option-types&#34;&gt;&lt;em&gt;Option types&lt;/em&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;run&lt;/code&gt; options control the image&amp;rsquo;s runtime behavior in a container. These
settings affect:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;detached or foreground running&lt;/li&gt;
&lt;li&gt;container identification&lt;/li&gt;
&lt;li&gt;network settings&lt;/li&gt;
&lt;li&gt;runtime constraints on CPU and memory&lt;/li&gt;
&lt;li&gt;privileges and LXC configuration&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;An image developer may set defaults for these same settings when they create the
image using the &lt;code&gt;docker build&lt;/code&gt; command. Operators, however, can override all
defaults set by the developer using the &lt;code&gt;run&lt;/code&gt; options. And, operators can also
override nearly all the defaults set by the Docker runtime itself.&lt;/p&gt;
&lt;p&gt;Finally, depending on your Docker system configuration, you may be required to
preface each &lt;code&gt;docker&lt;/code&gt; command with &lt;code&gt;sudo&lt;/code&gt;. To avoid having to use &lt;code&gt;sudo&lt;/code&gt; with
the &lt;code&gt;docker&lt;/code&gt; command, your system administrator can create a Unix group called
&lt;code&gt;docker&lt;/code&gt; and add users to it. For more information about this configuration,
refer to the Docker installation documentation for your operating system.&lt;/p&gt;
&lt;h2 id=&#34;operator-exclusive-options&#34;&gt;Operator exclusive options&lt;/h2&gt;
&lt;p&gt;Only the operator (the person executing &lt;code&gt;docker run&lt;/code&gt;) can set the
following options.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#detached-vs-foreground&#34;&gt;Detached vs Foreground&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#detached-d&#34;&gt;Detached (-d)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#foreground&#34;&gt;Foreground&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#container-identification&#34;&gt;Container Identification&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#name-name&#34;&gt;Name (&amp;ndash;name)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#pid-equivalent&#34;&gt;PID Equivalent&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#ipc-settings-ipc&#34;&gt;IPC Settings (&amp;ndash;ipc)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#network-settings&#34;&gt;Network Settings&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#restart-policies-restart&#34;&gt;Restart Policies (&amp;ndash;restart)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#clean-up-rm&#34;&gt;Clean Up (&amp;ndash;rm)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#runtime-constraints-on-cpu-and-memory&#34;&gt;Runtime Constraints on CPU and Memory&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#runtime-privilege-linux-capabilities-and-lxc-configuration&#34;&gt;Runtime Privilege, Linux Capabilities, and LXC Configuration&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;detached-vs-foreground&#34;&gt;Detached vs foreground&lt;/h2&gt;
&lt;p&gt;When starting a Docker container, you must first decide if you want to
run the container in the background in a &amp;ldquo;detached&amp;rdquo; mode or in the
default foreground mode:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;-d=false: Detached mode: Run container in the background, print new container id
&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&#34;detached-d&#34;&gt;Detached (-d)&lt;/h3&gt;
&lt;p&gt;In detached mode (&lt;code&gt;-d=true&lt;/code&gt; or just &lt;code&gt;-d&lt;/code&gt;), all I/O should be done
through network connections or shared volumes because the container is
no longer listening to the command line where you executed &lt;code&gt;docker run&lt;/code&gt;.
You can reattach to a detached container with &lt;code&gt;docker&lt;/code&gt;
&lt;a href=&#34;http://localhost/docker/reference/commandline/cli/#attach&#34;&gt;&lt;em&gt;attach&lt;/em&gt;&lt;/a&gt;. If you choose to run a
container in the detached mode, then you cannot use the &lt;code&gt;--rm&lt;/code&gt; option.&lt;/p&gt;
&lt;h3 id=&#34;foreground&#34;&gt;Foreground&lt;/h3&gt;
&lt;p&gt;In foreground mode (the default when &lt;code&gt;-d&lt;/code&gt; is not specified), &lt;code&gt;docker
run&lt;/code&gt; can start the process in the container and attach the console to
the process&amp;rsquo;s standard input, output, and standard error. It can even
pretend to be a TTY (this is what most command line executables expect)
and pass along signals. All of that is configurable:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;-a=[] : Attach to `STDIN`, `STDOUT` and/or `STDERR`
-t=false : Allocate a pseudo-tty
--sig-proxy=true: Proxify all received signal to the process (non-TTY mode only)
-i=false : Keep STDIN open even if not attached
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If you do not specify &lt;code&gt;-a&lt;/code&gt; then Docker will &lt;a href=&#34;https://github.com/docker/docker/blob/
75a7f4d90cde0295bcfb7213004abce8d4779b75/commands.go#L1797&#34;&gt;attach all standard
streams&lt;/a&gt;. You can
specify to which of the three standard streams (&lt;code&gt;STDIN&lt;/code&gt;, &lt;code&gt;STDOUT&lt;/code&gt;,
&lt;code&gt;STDERR&lt;/code&gt;) you&amp;rsquo;d like to connect instead, as in:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ docker run -a stdin -a stdout -i -t ubuntu /bin/bash
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;For interactive processes (like a shell), you must use &lt;code&gt;-i -t&lt;/code&gt; together in
order to allocate a tty for the container process. &lt;code&gt;-i -t&lt;/code&gt; is often written &lt;code&gt;-it&lt;/code&gt;
as you&amp;rsquo;ll see in later examples. Specifying &lt;code&gt;-t&lt;/code&gt; is forbidden when the client
standard output is redirected or piped, such as in:
&lt;code&gt;echo test | docker run -i busybox cat&lt;/code&gt;.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: A process running as PID 1 inside a container is treated
specially by Linux: it ignores any signal with the default action.
So, the process will not terminate on &lt;code&gt;SIGINT&lt;/code&gt; or &lt;code&gt;SIGTERM&lt;/code&gt; unless it is
coded to do so.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id=&#34;container-identification&#34;&gt;Container identification&lt;/h2&gt;
&lt;h3 id=&#34;name-name&#34;&gt;Name (&amp;ndash;name)&lt;/h3&gt;
&lt;p&gt;The operator can identify a container in three ways:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;UUID long identifier
(&amp;ldquo;f78375b1c487e03c9438c729345e54db9d20cfa2ac1fc3494b6eb60872e74778&amp;rdquo;)&lt;/li&gt;
&lt;li&gt;UUID short identifier (&amp;ldquo;f78375b1c487&amp;rdquo;)&lt;/li&gt;
&lt;li&gt;Name (&amp;ldquo;evil_ptolemy&amp;rdquo;)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The UUID identifiers come from the Docker daemon, and if you do not
assign a name to the container with &lt;code&gt;--name&lt;/code&gt; then the daemon will also
generate a random string name too. The name can become a handy way to
add meaning to a container since you can use this name when defining
&lt;a href=&#34;http://localhost/userguide/dockerlinks&#34;&gt;&lt;em&gt;links&lt;/em&gt;&lt;/a&gt; (or any
other place you need to identify a container). This works for both
background and foreground Docker containers.&lt;/p&gt;
&lt;h3 id=&#34;pid-equivalent&#34;&gt;PID equivalent&lt;/h3&gt;
&lt;p&gt;Finally, to help with automation, you can have Docker write the
container ID out to a file of your choosing. This is similar to how some
programs might write out their process ID to a file (you&amp;rsquo;ve seen them as
PID files):&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;--cidfile=&amp;quot;&amp;quot;: Write the container ID to the file
&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&#34;image-tag&#34;&gt;Image[:tag]&lt;/h3&gt;
&lt;p&gt;While not strictly a means of identifying a container, you can specify a version of an
image you&amp;rsquo;d like to run the container with by adding &lt;code&gt;image[:tag]&lt;/code&gt; to the command. For
example, &lt;code&gt;docker run ubuntu:14.04&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id=&#34;image-digest&#34;&gt;Image[@digest]&lt;/h3&gt;
&lt;p&gt;Images using the v2 or later image format have a content-addressable identifier
called a digest. As long as the input used to generate the image is unchanged,
the digest value is predictable and referenceable.&lt;/p&gt;
&lt;h2 id=&#34;pid-settings-pid&#34;&gt;PID settings (&amp;ndash;pid)&lt;/h2&gt;
&lt;pre&gt;&lt;code&gt;--pid=&amp;quot;&amp;quot; : Set the PID (Process) Namespace mode for the container,
&#39;host&#39;: use the host&#39;s PID namespace inside the container
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;By default, all containers have the PID namespace enabled.&lt;/p&gt;
&lt;p&gt;PID namespace provides separation of processes. The PID Namespace removes the
view of the system processes, and allows process ids to be reused including
pid 1.&lt;/p&gt;
&lt;p&gt;In certain cases you want your container to share the host&amp;rsquo;s process namespace,
basically allowing processes within the container to see all of the processes
on the system. For example, you could build a container with debugging tools
like &lt;code&gt;strace&lt;/code&gt; or &lt;code&gt;gdb&lt;/code&gt;, but want to use these tools when debugging processes
within the container.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ docker run --pid=host rhel7 strace -p 1234
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This command would allow you to use &lt;code&gt;strace&lt;/code&gt; inside the container on pid 1234 on
the host.&lt;/p&gt;
&lt;h2 id=&#34;uts-settings-uts&#34;&gt;UTS settings (&amp;ndash;uts)&lt;/h2&gt;
&lt;pre&gt;&lt;code&gt;--uts=&amp;quot;&amp;quot; : Set the UTS namespace mode for the container,
&#39;host&#39;: use the host&#39;s UTS namespace inside the container
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The UTS namespace is for setting the hostname and the domain that is visible
to running processes in that namespace. By default, all containers, including
those with &lt;code&gt;--net=host&lt;/code&gt;, have their own UTS namespace. The &lt;code&gt;host&lt;/code&gt; setting will
result in the container using the same UTS namespace as the host.&lt;/p&gt;
&lt;p&gt;You may wish to share the UTS namespace with the host if you would like the
hostname of the container to change as the hostname of the host changes. A
more advanced use case would be changing the host&amp;rsquo;s hostname from a container.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: &lt;code&gt;--uts=&amp;quot;host&amp;quot;&lt;/code&gt; gives the container full access to change the
hostname of the host and is therefore considered insecure.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id=&#34;ipc-settings-ipc&#34;&gt;IPC settings (&amp;ndash;ipc)&lt;/h2&gt;
&lt;pre&gt;&lt;code&gt;--ipc=&amp;quot;&amp;quot; : Set the IPC mode for the container,
&#39;container:&amp;lt;name|id&amp;gt;&#39;: reuses another container&#39;s IPC namespace
&#39;host&#39;: use the host&#39;s IPC namespace inside the container
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;By default, all containers have the IPC namespace enabled.&lt;/p&gt;
&lt;p&gt;IPC (POSIX/SysV IPC) namespace provides separation of named shared memory
segments, semaphores and message queues.&lt;/p&gt;
&lt;p&gt;Shared memory segments are used to accelerate inter-process communication at
memory speed, rather than through pipes or through the network stack. Shared
memory is commonly used by databases and custom-built (typically C/OpenMPI,
C++/using boost libraries) high performance applications for scientific
computing and financial services industries. If these types of applications
are broken into multiple containers, you might need to share the IPC mechanisms
of the containers.&lt;/p&gt;
&lt;h2 id=&#34;network-settings&#34;&gt;Network settings&lt;/h2&gt;
&lt;pre&gt;&lt;code&gt;--dns=[] : Set custom dns servers for the container
--net=&amp;quot;bridge&amp;quot; : Set the Network mode for the container
&#39;bridge&#39;: creates a new network stack for the container on the docker bridge
&#39;none&#39;: no networking for this container
&#39;container:&amp;lt;name|id&amp;gt;&#39;: reuses another container network stack
&#39;host&#39;: use the host network stack inside the container
--add-host=&amp;quot;&amp;quot; : Add a line to /etc/hosts (host:IP)
--mac-address=&amp;quot;&amp;quot; : Sets the container&#39;s Ethernet device&#39;s MAC address
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;By default, all containers have networking enabled and they can make any
outgoing connections. The operator can completely disable networking
with &lt;code&gt;docker run --net none&lt;/code&gt; which disables all incoming and outgoing
networking. In cases like this, you would perform I/O through files or
&lt;code&gt;STDIN&lt;/code&gt; and &lt;code&gt;STDOUT&lt;/code&gt; only.&lt;/p&gt;
&lt;p&gt;Your container will use the same DNS servers as the host by default, but
you can override this with &lt;code&gt;--dns&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;By default, the MAC address is generated using the IP address allocated to the
container. You can set the container&amp;rsquo;s MAC address explicitly by providing a
MAC address via the &lt;code&gt;--mac-address&lt;/code&gt; parameter (format:&lt;code&gt;12:34:56:78:9a:bc&lt;/code&gt;).&lt;/p&gt;
&lt;p&gt;Supported networking modes are:&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th class=&#34;no-wrap&#34;&gt;Mode&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td class=&#34;no-wrap&#34;&gt;&lt;strong&gt;none&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;
No networking in the container.
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class=&#34;no-wrap&#34;&gt;&lt;strong&gt;bridge&lt;/strong&gt; (default)&lt;/td&gt;
&lt;td&gt;
Connect the container to the bridge via veth interfaces.
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class=&#34;no-wrap&#34;&gt;&lt;strong&gt;host&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;
Use the host&#39;s network stack inside the container.
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class=&#34;no-wrap&#34;&gt;&lt;strong&gt;container&lt;/strong&gt;:&amp;lt;name|id&amp;gt;&lt;/td&gt;
&lt;td&gt;
Use the network stack of another container, specified via
its *name* or *id*.
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h4 id=&#34;mode-none&#34;&gt;Mode: none&lt;/h4&gt;
&lt;p&gt;With the networking mode set to &lt;code&gt;none&lt;/code&gt; a container will not have a
access to any external routes. The container will still have a
&lt;code&gt;loopback&lt;/code&gt; interface enabled in the container but it does not have any
routes to external traffic.&lt;/p&gt;
&lt;h4 id=&#34;mode-bridge&#34;&gt;Mode: bridge&lt;/h4&gt;
&lt;p&gt;With the networking mode set to &lt;code&gt;bridge&lt;/code&gt; a container will use docker&amp;rsquo;s
default networking setup. A bridge is setup on the host, commonly named
&lt;code&gt;docker0&lt;/code&gt;, and a pair of &lt;code&gt;veth&lt;/code&gt; interfaces will be created for the
container. One side of the &lt;code&gt;veth&lt;/code&gt; pair will remain on the host attached
to the bridge while the other side of the pair will be placed inside the
container&amp;rsquo;s namespaces in addition to the &lt;code&gt;loopback&lt;/code&gt; interface. An IP
address will be allocated for containers on the bridge&amp;rsquo;s network and
traffic will be routed though this bridge to the container.&lt;/p&gt;
&lt;h4 id=&#34;mode-host&#34;&gt;Mode: host&lt;/h4&gt;
&lt;p&gt;With the networking mode set to &lt;code&gt;host&lt;/code&gt; a container will share the host&amp;rsquo;s
network stack and all interfaces from the host will be available to the
container. The container&amp;rsquo;s hostname will match the hostname on the host
system. Publishing ports and linking to other containers will not work
when sharing the host&amp;rsquo;s network stack. Note that &lt;code&gt;--add-host&lt;/code&gt; &lt;code&gt;--hostname&lt;/code&gt;
&lt;code&gt;--dns&lt;/code&gt; &lt;code&gt;--dns-search&lt;/code&gt; and &lt;code&gt;--mac-address&lt;/code&gt; is invalid in &lt;code&gt;host&lt;/code&gt; netmode.&lt;/p&gt;
&lt;p&gt;Compared to the default &lt;code&gt;bridge&lt;/code&gt; mode, the &lt;code&gt;host&lt;/code&gt; mode gives &lt;em&gt;significantly&lt;/em&gt;
better networking performance since it uses the host&amp;rsquo;s native networking stack
whereas the bridge has to go through one level of virtualization through the
docker daemon. It is recommended to run containers in this mode when their
networking performance is critical, for example, a production Load Balancer
or a High Performance Web Server.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: &lt;code&gt;--net=&amp;quot;host&amp;quot;&lt;/code&gt; gives the container full access to local system
services such as D-bus and is therefore considered insecure.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h4 id=&#34;mode-container&#34;&gt;Mode: container&lt;/h4&gt;
&lt;p&gt;With the networking mode set to &lt;code&gt;container&lt;/code&gt; a container will share the
network stack of another container. The other container&amp;rsquo;s name must be
provided in the format of &lt;code&gt;--net container:&amp;lt;name|id&amp;gt;&lt;/code&gt;. Note that &lt;code&gt;--add-host&lt;/code&gt;
&lt;code&gt;--hostname&lt;/code&gt; &lt;code&gt;--dns&lt;/code&gt; &lt;code&gt;--dns-search&lt;/code&gt; and &lt;code&gt;--mac-address&lt;/code&gt; is invalid
in &lt;code&gt;container&lt;/code&gt; netmode.&lt;/p&gt;
&lt;p&gt;Example running a Redis container with Redis binding to &lt;code&gt;localhost&lt;/code&gt; then
running the &lt;code&gt;redis-cli&lt;/code&gt; command and connecting to the Redis server over the
&lt;code&gt;localhost&lt;/code&gt; interface.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ docker run -d --name redis example/redis --bind 127.0.0.1
$ # use the redis container&#39;s network stack to access localhost
$ docker run --rm -it --net container:redis example/redis-cli -h 127.0.0.1
&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&#34;managing-etc-hosts&#34;&gt;Managing /etc/hosts&lt;/h3&gt;
&lt;p&gt;Your container will have lines in &lt;code&gt;/etc/hosts&lt;/code&gt; which define the hostname of the
container itself as well as &lt;code&gt;localhost&lt;/code&gt; and a few other common things. The
&lt;code&gt;--add-host&lt;/code&gt; flag can be used to add additional lines to &lt;code&gt;/etc/hosts&lt;/code&gt;.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ docker run -it --add-host db-static:86.75.30.9 ubuntu cat /etc/hosts
172.17.0.22 09d03f76bf2c
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
86.75.30.9 db-static
&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&#34;restart-policies-restart&#34;&gt;Restart policies (&amp;ndash;restart)&lt;/h2&gt;
&lt;p&gt;Using the &lt;code&gt;--restart&lt;/code&gt; flag on Docker run you can specify a restart policy for
how a container should or should not be restarted on exit.&lt;/p&gt;
&lt;p&gt;When a restart policy is active on a container, it will be shown as either &lt;code&gt;Up&lt;/code&gt;
or &lt;code&gt;Restarting&lt;/code&gt; in &lt;a href=&#34;http://localhost/docker/reference/commandline/cli/#ps&#34;&gt;&lt;code&gt;docker ps&lt;/code&gt;&lt;/a&gt;. It can also be
useful to use &lt;a href=&#34;http://localhost/docker/reference/commandline/cli/#events&#34;&gt;&lt;code&gt;docker events&lt;/code&gt;&lt;/a&gt; to see the
restart policy in effect.&lt;/p&gt;
&lt;p&gt;Docker supports the following restart policies:&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Policy&lt;/th&gt;
&lt;th&gt;Result&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;no&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;
Do not automatically restart the container when it exits. This is the
default.
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;span style=&#34;white-space: nowrap&#34;&gt;
&lt;strong&gt;on-failure&lt;/strong&gt;[:max-retries]
&lt;/span&gt;
&lt;/td&gt;
&lt;td&gt;
Restart only if the container exits with a non-zero exit status.
Optionally, limit the number of restart retries the Docker
daemon attempts.
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;always&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;
Always restart the container regardless of the exit status.
When you specify always, the Docker daemon will try to restart
the container indefinitely.
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;An ever increasing delay (double the previous delay, starting at 100
milliseconds) is added before each restart to prevent flooding the server.
This means the daemon will wait for 100 ms, then 200 ms, 400, 800, 1600,
and so on until either the &lt;code&gt;on-failure&lt;/code&gt; limit is hit, or when you &lt;code&gt;docker stop&lt;/code&gt;
or &lt;code&gt;docker rm -f&lt;/code&gt; the container.&lt;/p&gt;
&lt;p&gt;If a container is successfully restarted (the container is started and runs
for at least 10 seconds), the delay is reset to its default value of 100 ms.&lt;/p&gt;
&lt;p&gt;You can specify the maximum amount of times Docker will try to restart the
container when using the &lt;strong&gt;on-failure&lt;/strong&gt; policy. The default is that Docker
will try forever to restart the container. The number of (attempted) restarts
for a container can be obtained via &lt;a href=&#34;http://localhost/reference/commandline/cli/#inspect&#34;&gt;&lt;code&gt;docker inspect&lt;/code&gt;&lt;/a&gt;. For example, to get the number of restarts
for container &amp;ldquo;my-container&amp;rdquo;;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ docker inspect -f &amp;quot;{{ .RestartCount }}&amp;quot; my-container
# 2
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Or, to get the last time the container was (re)started;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ docker inspect -f &amp;quot;{{ .State.StartedAt }}&amp;quot; my-container
# 2015-03-04T23:47:07.691840179Z
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You cannot set any restart policy in combination with
&lt;a href=&#34;#clean-up-rm&#34;&gt;&amp;ldquo;clean up (&amp;ndash;rm)&amp;rdquo;&lt;/a&gt;. Setting both &lt;code&gt;--restart&lt;/code&gt; and &lt;code&gt;--rm&lt;/code&gt;
results in an error.&lt;/p&gt;
&lt;p&gt;###Examples&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ docker run --restart=always redis
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This will run the &lt;code&gt;redis&lt;/code&gt; container with a restart policy of &lt;strong&gt;always&lt;/strong&gt;
so that if the container exits, Docker will restart it.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ docker run --restart=on-failure:10 redis
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This will run the &lt;code&gt;redis&lt;/code&gt; container with a restart policy of &lt;strong&gt;on-failure&lt;/strong&gt;
and a maximum restart count of 10. If the &lt;code&gt;redis&lt;/code&gt; container exits with a
non-zero exit status more than 10 times in a row Docker will abort trying to
restart the container. Providing a maximum restart limit is only valid for the
&lt;strong&gt;on-failure&lt;/strong&gt; policy.&lt;/p&gt;
&lt;h2 id=&#34;clean-up-rm&#34;&gt;Clean up (&amp;ndash;rm)&lt;/h2&gt;
&lt;p&gt;By default a container&amp;rsquo;s file system persists even after the container
exits. This makes debugging a lot easier (since you can inspect the
final state) and you retain all your data by default. But if you are
running short-term &lt;strong&gt;foreground&lt;/strong&gt; processes, these container file
systems can really pile up. If instead you&amp;rsquo;d like Docker to
&lt;strong&gt;automatically clean up the container and remove the file system when
the container exits&lt;/strong&gt;, you can add the &lt;code&gt;--rm&lt;/code&gt; flag:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;--rm=false: Automatically remove the container when it exits (incompatible with -d)
&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&#34;security-configuration&#34;&gt;Security configuration&lt;/h2&gt;
&lt;pre&gt;&lt;code&gt;--security-opt=&amp;quot;label:user:USER&amp;quot; : Set the label user for the container
--security-opt=&amp;quot;label:role:ROLE&amp;quot; : Set the label role for the container
--security-opt=&amp;quot;label:type:TYPE&amp;quot; : Set the label type for the container
--security-opt=&amp;quot;label:level:LEVEL&amp;quot; : Set the label level for the container
--security-opt=&amp;quot;label:disable&amp;quot; : Turn off label confinement for the container
--security-opt=&amp;quot;apparmor:PROFILE&amp;quot; : Set the apparmor profile to be applied
to the container
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You can override the default labeling scheme for each container by specifying
the &lt;code&gt;--security-opt&lt;/code&gt; flag. For example, you can specify the MCS/MLS level, a
requirement for MLS systems. Specifying the level in the following command
allows you to share the same content between containers.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ docker run --security-opt label:level:s0:c100,c200 -i -t fedora bash
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;An MLS example might be:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ docker run --security-opt label:level:TopSecret -i -t rhel7 bash
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To disable the security labeling for this container versus running with the
&lt;code&gt;--permissive&lt;/code&gt; flag, use the following command:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ docker run --security-opt label:disable -i -t fedora bash
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If you want a tighter security policy on the processes within a container,
you can specify an alternate type for the container. You could run a container
that is only allowed to listen on Apache ports by executing the following
command:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ docker run --security-opt label:type:svirt_apache_t -i -t centos bash
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Note:&lt;/p&gt;
&lt;p&gt;You would have to write policy defining a &lt;code&gt;svirt_apache_t&lt;/code&gt; type.&lt;/p&gt;
&lt;h2 id=&#34;specifying-custom-cgroups&#34;&gt;Specifying custom cgroups&lt;/h2&gt;
&lt;p&gt;Using the &lt;code&gt;--cgroup-parent&lt;/code&gt; flag, you can pass a specific cgroup to run a
container in. This allows you to create and manage cgroups on their own. You can
define custom resources for those cgroups and put containers under a common
parent group.&lt;/p&gt;
&lt;h2 id=&#34;runtime-constraints-on-resources&#34;&gt;Runtime constraints on resources&lt;/h2&gt;
&lt;p&gt;The operator can also adjust the performance parameters of the
container:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;-m, --memory=&amp;quot;&amp;quot;: Memory limit (format: &amp;lt;number&amp;gt;&amp;lt;optional unit&amp;gt;, where unit = b, k, m or g)
--memory-swap=&amp;quot;&amp;quot;: Total memory limit (memory + swap, format: &amp;lt;number&amp;gt;&amp;lt;optional unit&amp;gt;, where unit = b, k, m or g)
-c, --cpu-shares=0: CPU shares (relative weight)
--cpu-period=0: Limit the CPU CFS (Completely Fair Scheduler) period
--cpuset-cpus=&amp;quot;&amp;quot;: CPUs in which to allow execution (0-3, 0,1)
--cpuset-mems=&amp;quot;&amp;quot;: Memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only effective on NUMA systems.
--cpu-quota=0: Limit the CPU CFS (Completely Fair Scheduler) quota
--blkio-weight=0: Block IO weight (relative weight) accepts a weight value between 10 and 1000.
--oom-kill-disable=true|false: Whether to disable OOM Killer for the container or not.
&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&#34;memory-constraints&#34;&gt;Memory constraints&lt;/h3&gt;
&lt;p&gt;We have four ways to set memory usage:&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Option&lt;/th&gt;
&lt;th&gt;Result&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td class=&#34;no-wrap&#34;&gt;
&lt;strong&gt;memory=inf, memory-swap=inf&lt;/strong&gt; (default)
&lt;/td&gt;
&lt;td&gt;
There is no memory limit for the container. The container can use
as much memory as needed.
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class=&#34;no-wrap&#34;&gt;&lt;strong&gt;memory=L&amp;lt;inf, memory-swap=inf&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;
(specify memory and set memory-swap as &lt;code&gt;-1&lt;/code&gt;) The container is
not allowed to use more than L bytes of memory, but can use as much swap
as is needed (if the host supports swap memory).
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class=&#34;no-wrap&#34;&gt;&lt;strong&gt;memory=L&amp;lt;inf, memory-swap=2*L&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;
(specify memory without memory-swap) The container is not allowed to
use more than L bytes of memory, swap *plus* memory usage is double
of that.
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class=&#34;no-wrap&#34;&gt;
&lt;strong&gt;memory=L&amp;lt;inf, memory-swap=S&amp;lt;inf, L&amp;lt;=S&lt;/strong&gt;
&lt;/td&gt;
&lt;td&gt;
(specify both memory and memory-swap) The container is not allowed to
use more than L bytes of memory, swap *plus* memory usage is limited
by S.
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Examples:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ docker run -ti ubuntu:14.04 /bin/bash
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;We set nothing about memory, this means the processes in the container can use
as much memory and swap memory as they need.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ docker run -ti -m 300M --memory-swap -1 ubuntu:14.04 /bin/bash
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;We set memory limit and disabled swap memory limit, this means the processes in
the container can use 300M memory and as much swap memory as they need (if the
host supports swap memory).&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ docker run -ti -m 300M ubuntu:14.04 /bin/bash
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;We set memory limit only, this means the processes in the container can use
300M memory and 300M swap memory, by default, the total virtual memory size
(&amp;ndash;memory-swap) will be set as double of memory, in this case, memory + swap
would be 2*300M, so processes can use 300M swap memory as well.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ docker run -ti -m 300M --memory-swap 1G ubuntu:14.04 /bin/bash
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;We set both memory and swap memory, so the processes in the container can use
300M memory and 700M swap memory.&lt;/p&gt;
&lt;p&gt;By default, Docker kills processes in a container if an out-of-memory (OOM)
error occurs. To change this behaviour, use the &lt;code&gt;--oom-kill-disable&lt;/code&gt; option.
Only disable the OOM killer on containers where you have also set the
&lt;code&gt;-m/--memory&lt;/code&gt; option. If the &lt;code&gt;-m&lt;/code&gt; flag is not set, this can result in the host
running out of memory and require killing the host&amp;rsquo;s system processes to free
memory.&lt;/p&gt;
&lt;p&gt;Examples:&lt;/p&gt;
&lt;p&gt;The following example limits the memory to 100M and disables the OOM killer for
this container:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ docker run -ti -m 100M --oom-kill-disable ubuntu:14.04 /bin/bash
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The following example, illustrates a dangerous way to use the flag:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ docker run -ti --oom-kill-disable ubuntu:14.04 /bin/bash
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The container has unlimited memory which can cause the host to run out memory
and require killing system processes to free memory.&lt;/p&gt;
&lt;h3 id=&#34;cpu-share-constraint&#34;&gt;CPU share constraint&lt;/h3&gt;
&lt;p&gt;By default, all containers get the same proportion of CPU cycles. This proportion
can be modified by changing the container&amp;rsquo;s CPU share weighting relative
to the weighting of all other running containers.&lt;/p&gt;
&lt;p&gt;To modify the proportion from the default of 1024, use the &lt;code&gt;-c&lt;/code&gt; or &lt;code&gt;--cpu-shares&lt;/code&gt;
flag to set the weighting to 2 or higher.&lt;/p&gt;
&lt;p&gt;The proportion will only apply when CPU-intensive processes are running.
When tasks in one container are idle, other containers can use the
left-over CPU time. The actual amount of CPU time will vary depending on
the number of containers running on the system.&lt;/p&gt;
&lt;p&gt;For example, consider three containers, one has a cpu-share of 1024 and
two others have a cpu-share setting of 512. When processes in all three
containers attempt to use 100% of CPU, the first container would receive
50% of the total CPU time. If you add a fourth container with a cpu-share
of 1024, the first container only gets 33% of the CPU. The remaining containers
receive 16.5%, 16.5% and 33% of the CPU.&lt;/p&gt;
&lt;p&gt;On a multi-core system, the shares of CPU time are distributed over all CPU
cores. Even if a container is limited to less than 100% of CPU time, it can
use 100% of each individual CPU core.&lt;/p&gt;
&lt;p&gt;For example, consider a system with more than three cores. If you start one
container &lt;code&gt;{C0}&lt;/code&gt; with &lt;code&gt;-c=512&lt;/code&gt; running one process, and another container
&lt;code&gt;{C1}&lt;/code&gt; with &lt;code&gt;-c=1024&lt;/code&gt; running two processes, this can result in the following
division of CPU shares:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;PID container CPU CPU share
100 {C0} 0 100% of CPU0
101 {C1} 1 100% of CPU1
102 {C1} 2 100% of CPU2
&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&#34;cpu-period-constraint&#34;&gt;CPU period constraint&lt;/h3&gt;
&lt;p&gt;The default CPU CFS (Completely Fair Scheduler) period is 100ms. We can use
&lt;code&gt;--cpu-period&lt;/code&gt; to set the period of CPUs to limit the container&amp;rsquo;s CPU usage.
And usually &lt;code&gt;--cpu-period&lt;/code&gt; should work with &lt;code&gt;--cpu-quota&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Examples:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ docker run -ti --cpu-period=50000 --cpu-quota=25000 ubuntu:14.04 /bin/bash
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If there is 1 CPU, this means the container can get 50% CPU worth of run-time every 50ms.&lt;/p&gt;
&lt;p&gt;For more information, see the &lt;a href=&#34;https://www.kernel.org/doc/Documentation/scheduler/sched-bwc.txt&#34;&gt;CFS documentation on bandwidth limiting&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&#34;cpuset-constraint&#34;&gt;Cpuset constraint&lt;/h3&gt;
&lt;p&gt;We can set cpus in which to allow execution for containers.&lt;/p&gt;
&lt;p&gt;Examples:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ docker run -ti --cpuset-cpus=&amp;quot;1,3&amp;quot; ubuntu:14.04 /bin/bash
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This means processes in container can be executed on cpu 1 and cpu 3.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ docker run -ti --cpuset-cpus=&amp;quot;0-2&amp;quot; ubuntu:14.04 /bin/bash
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This means processes in container can be executed on cpu 0, cpu 1 and cpu 2.&lt;/p&gt;
&lt;p&gt;We can set mems in which to allow execution for containers. Only effective
on NUMA systems.&lt;/p&gt;
&lt;p&gt;Examples:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ docker run -ti --cpuset-mems=&amp;quot;1,3&amp;quot; ubuntu:14.04 /bin/bash
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This example restricts the processes in the container to only use memory from
memory nodes 1 and 3.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ docker run -ti --cpuset-mems=&amp;quot;0-2&amp;quot; ubuntu:14.04 /bin/bash
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This example restricts the processes in the container to only use memory from
memory nodes 0, 1 and 2.&lt;/p&gt;
&lt;h3 id=&#34;cpu-quota-constraint&#34;&gt;CPU quota constraint&lt;/h3&gt;
&lt;p&gt;The &lt;code&gt;--cpu-quota&lt;/code&gt; flag limits the container&amp;rsquo;s CPU usage. The default 0 value
allows the container to take 100% of a CPU resource (1 CPU). The CFS (Completely Fair
Scheduler) handles resource allocation for executing processes and is default
Linux Scheduler used by the kernel. Set this value to 50000 to limit the container
to 50% of a CPU resource. For multiple CPUs, adjust the &lt;code&gt;--cpu-quota&lt;/code&gt; as necessary.
For more information, see the &lt;a href=&#34;https://www.kernel.org/doc/Documentation/scheduler/sched-bwc.txt&#34;&gt;CFS documentation on bandwidth limiting&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&#34;block-io-bandwidth-blkio-constraint&#34;&gt;Block IO bandwidth (Blkio) constraint&lt;/h3&gt;
&lt;p&gt;By default, all containers get the same proportion of block IO bandwidth
(blkio). This proportion is 500. To modify this proportion, change the
container&amp;rsquo;s blkio weight relative to the weighting of all other running
containers using the &lt;code&gt;--blkio-weight&lt;/code&gt; flag.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;--blkio-weight&lt;/code&gt; flag can set the weighting to a value between 10 to 1000.
For example, the commands below create two containers with different blkio
weight:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ docker run -ti --name c1 --blkio-weight 300 ubuntu:14.04 /bin/bash
$ docker run -ti --name c2 --blkio-weight 600 ubuntu:14.04 /bin/bash
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If you do block IO in the two containers at the same time, by, for example:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ time dd if=/mnt/zerofile of=test.out bs=1M count=1024 oflag=direct
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You&amp;rsquo;ll find that the proportion of time is the same as the proportion of blkio
weights of the two containers.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; The blkio weight setting is only available for direct IO. Buffered IO
is not currently supported.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id=&#34;runtime-privilege-linux-capabilities-and-lxc-configuration&#34;&gt;Runtime privilege, Linux capabilities, and LXC configuration&lt;/h2&gt;
&lt;pre&gt;&lt;code&gt;--cap-add: Add Linux capabilities
--cap-drop: Drop Linux capabilities
--privileged=false: Give extended privileges to this container
--device=[]: Allows you to run devices inside the container without the --privileged flag.
--lxc-conf=[]: Add custom lxc options
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;By default, Docker containers are &amp;ldquo;unprivileged&amp;rdquo; and cannot, for
example, run a Docker daemon inside a Docker container. This is because
by default a container is not allowed to access any devices, but a
&amp;ldquo;privileged&amp;rdquo; container is given access to all devices (see &lt;a href=&#34;https://github.com/docker/docker/blob/master/daemon/execdriver/lxc/lxc_template.go&#34;&gt;lxc-template.go&lt;/a&gt;
and documentation on &lt;a href=&#34;https://www.kernel.org/doc/Documentation/cgroups/devices.txt&#34;&gt;cgroups devices&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;When the operator executes &lt;code&gt;docker run --privileged&lt;/code&gt;, Docker will enable
to access to all devices on the host as well as set some configuration
in AppArmor or SELinux to allow the container nearly all the same access to the
host as processes running outside containers on the host. Additional
information about running with &lt;code&gt;--privileged&lt;/code&gt; is available on the
&lt;a href=&#34;http://blog.docker.com/2013/09/docker-can-now-run-within-docker/&#34;&gt;Docker Blog&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;If you want to limit access to a specific device or devices you can use
the &lt;code&gt;--device&lt;/code&gt; flag. It allows you to specify one or more devices that
will be accessible within the container.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ docker run --device=/dev/snd:/dev/snd ...
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;By default, the container will be able to &lt;code&gt;read&lt;/code&gt;, &lt;code&gt;write&lt;/code&gt;, and &lt;code&gt;mknod&lt;/code&gt; these devices.
This can be overridden using a third &lt;code&gt;:rwm&lt;/code&gt; set of options to each &lt;code&gt;--device&lt;/code&gt; flag:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ docker run --device=/dev/sda:/dev/xvdc --rm -it ubuntu fdisk /dev/xvdc
Command (m for help): q
$ docker run --device=/dev/sda:/dev/xvdc:r --rm -it ubuntu fdisk /dev/xvdc
You will not be able to write the partition table.
Command (m for help): q
$ docker run --device=/dev/sda:/dev/xvdc:w --rm -it ubuntu fdisk /dev/xvdc
crash....
$ docker run --device=/dev/sda:/dev/xvdc:m --rm -it ubuntu fdisk /dev/xvdc
fdisk: unable to open /dev/xvdc: Operation not permitted
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In addition to &lt;code&gt;--privileged&lt;/code&gt;, the operator can have fine grain control over the
capabilities using &lt;code&gt;--cap-add&lt;/code&gt; and &lt;code&gt;--cap-drop&lt;/code&gt;. By default, Docker has a default
list of capabilities that are kept. The following table lists the Linux capability options which can be added or dropped.&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Capability Key&lt;/th&gt;
&lt;th&gt;Capability Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;SETPCAP&lt;/td&gt;
&lt;td&gt;Modify process capabilities.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SYS_MODULE&lt;/td&gt;
&lt;td&gt;Load and unload kernel modules.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SYS_RAWIO&lt;/td&gt;
&lt;td&gt;Perform I/O port operations (iopl(2) and ioperm(2)).&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SYS_PACCT&lt;/td&gt;
&lt;td&gt;Use acct(2), switch process accounting on or off.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SYS_ADMIN&lt;/td&gt;
&lt;td&gt;Perform a range of system administration operations.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SYS_NICE&lt;/td&gt;
&lt;td&gt;Raise process nice value (nice(2), setpriority(2)) and change the nice value for arbitrary processes.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SYS_RESOURCE&lt;/td&gt;
&lt;td&gt;Override resource Limits.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SYS_TIME&lt;/td&gt;
&lt;td&gt;Set system clock (settimeofday(2), stime(2), adjtimex(2)); set real-time (hardware) clock.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SYS_TTY_CONFIG&lt;/td&gt;
&lt;td&gt;Use vhangup(2); employ various privileged ioctl(2) operations on virtual terminals.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;MKNOD&lt;/td&gt;
&lt;td&gt;Create special files using mknod(2).&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;AUDIT_WRITE&lt;/td&gt;
&lt;td&gt;Write records to kernel auditing log.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;AUDIT_CONTROL&lt;/td&gt;
&lt;td&gt;Enable and disable kernel auditing; change auditing filter rules; retrieve auditing status and filtering rules.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;MAC_OVERRIDE&lt;/td&gt;
&lt;td&gt;Allow MAC configuration or state changes. Implemented for the Smack LSM.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;MAC_ADMIN&lt;/td&gt;
&lt;td&gt;Override Mandatory Access Control (MAC). Implemented for the Smack Linux Security Module (LSM).&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;NET_ADMIN&lt;/td&gt;
&lt;td&gt;Perform various network-related operations.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SYSLOG&lt;/td&gt;
&lt;td&gt;Perform privileged syslog(2) operations.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;CHOWN&lt;/td&gt;
&lt;td&gt;Make arbitrary changes to file UIDs and GIDs (see chown(2)).&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;NET_RAW&lt;/td&gt;
&lt;td&gt;Use RAW and PACKET sockets.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;DAC_OVERRIDE&lt;/td&gt;
&lt;td&gt;Bypass file read, write, and execute permission checks.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;FOWNER&lt;/td&gt;
&lt;td&gt;Bypass permission checks on operations that normally require the file system UID of the process to match the UID of the file.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;DAC_READ_SEARCH&lt;/td&gt;
&lt;td&gt;Bypass file read permission checks and directory read and execute permission checks.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;FSETID&lt;/td&gt;
&lt;td&gt;Don&amp;rsquo;t clear set-user-ID and set-group-ID permission bits when a file is modified.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;KILL&lt;/td&gt;
&lt;td&gt;Bypass permission checks for sending signals.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SETGID&lt;/td&gt;
&lt;td&gt;Make arbitrary manipulations of process GIDs and supplementary GID list.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SETUID&lt;/td&gt;
&lt;td&gt;Make arbitrary manipulations of process UIDs.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;LINUX_IMMUTABLE&lt;/td&gt;
&lt;td&gt;Set the FS_APPEND_FL and FS_IMMUTABLE_FL i-node flags.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;NET_BIND_SERVICE&lt;/td&gt;
&lt;td&gt;Bind a socket to internet domain privileged ports (port numbers less than 1024).&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;NET_BROADCAST&lt;/td&gt;
&lt;td&gt;Make socket broadcasts, and listen to multicasts.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;IPC_LOCK&lt;/td&gt;
&lt;td&gt;Lock memory (mlock(2), mlockall(2), mmap(2), shmctl(2)).&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;IPC_OWNER&lt;/td&gt;
&lt;td&gt;Bypass permission checks for operations on System V IPC objects.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SYS_CHROOT&lt;/td&gt;
&lt;td&gt;Use chroot(2), change root directory.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SYS_PTRACE&lt;/td&gt;
&lt;td&gt;Trace arbitrary processes using ptrace(2).&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SYS_BOOT&lt;/td&gt;
&lt;td&gt;Use reboot(2) and kexec_load(2), reboot and load a new kernel for later execution.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;LEASE&lt;/td&gt;
&lt;td&gt;Establish leases on arbitrary files (see fcntl(2)).&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SETFCAP&lt;/td&gt;
&lt;td&gt;Set file capabilities.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;WAKE_ALARM&lt;/td&gt;
&lt;td&gt;Trigger something that will wake up the system.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;BLOCK_SUSPEND&lt;/td&gt;
&lt;td&gt;Employ features that can block system suspend.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Further reference information is available on the &lt;a href=&#34;http://linux.die.net/man/7/capabilities&#34;&gt;capabilities(7) - Linux man page&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Both flags support the value &lt;code&gt;all&lt;/code&gt;, so if the
operator wants to have all capabilities but &lt;code&gt;MKNOD&lt;/code&gt; they could use:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ docker run --cap-add=ALL --cap-drop=MKNOD ...
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;For interacting with the network stack, instead of using &lt;code&gt;--privileged&lt;/code&gt; they
should use &lt;code&gt;--cap-add=NET_ADMIN&lt;/code&gt; to modify the network interfaces.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ docker run -t -i --rm ubuntu:14.04 ip link add dummy0 type dummy
RTNETLINK answers: Operation not permitted
$ docker run -t -i --rm --cap-add=NET_ADMIN ubuntu:14.04 ip link add dummy0 type dummy
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To mount a FUSE based filesystem, you need to combine both &lt;code&gt;--cap-add&lt;/code&gt; and
&lt;code&gt;--device&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ docker run --rm -it --cap-add SYS_ADMIN sshfs sshfs sven@10.10.10.20:/home/sven /mnt
fuse: failed to open /dev/fuse: Operation not permitted
$ docker run --rm -it --device /dev/fuse sshfs sshfs sven@10.10.10.20:/home/sven /mnt
fusermount: mount failed: Operation not permitted
$ docker run --rm -it --cap-add SYS_ADMIN --device /dev/fuse sshfs
# sshfs sven@10.10.10.20:/home/sven /mnt
The authenticity of host &#39;10.10.10.20 (10.10.10.20)&#39; can&#39;t be established.
ECDSA key fingerprint is 25:34:85:75:25:b0:17:46:05:19:04:93:b5:dd:5f:c6.
Are you sure you want to continue connecting (yes/no)? yes
sven@10.10.10.20&#39;s password:
root@30aa0cfaf1b5:/# ls -la /mnt/src/docker
total 1516
drwxrwxr-x 1 1000 1000 4096 Dec 4 06:08 .
drwxrwxr-x 1 1000 1000 4096 Dec 4 11:46 ..
-rw-rw-r-- 1 1000 1000 16 Oct 8 00:09 .dockerignore
-rwxrwxr-x 1 1000 1000 464 Oct 8 00:09 .drone.yml
drwxrwxr-x 1 1000 1000 4096 Dec 4 06:11 .git
-rw-rw-r-- 1 1000 1000 461 Dec 4 06:08 .gitignore
....
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If the Docker daemon was started using the &lt;code&gt;lxc&lt;/code&gt; exec-driver
(&lt;code&gt;docker -d --exec-driver=lxc&lt;/code&gt;) then the operator can also specify LXC options
using one or more &lt;code&gt;--lxc-conf&lt;/code&gt; parameters. These can be new parameters or
override existing parameters from the &lt;a href=&#34;https://github.com/docker/docker/blob/master/daemon/execdriver/lxc/lxc_template.go&#34;&gt;lxc-template.go&lt;/a&gt;.
Note that in the future, a given host&amp;rsquo;s docker daemon may not use LXC, so this
is an implementation-specific configuration meant for operators already
familiar with using LXC directly.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt;
If you use &lt;code&gt;--lxc-conf&lt;/code&gt; to modify a container&amp;rsquo;s configuration which is also
managed by the Docker daemon, then the Docker daemon will not know about this
modification, and you will need to manage any conflicts yourself. For example,
you can use &lt;code&gt;--lxc-conf&lt;/code&gt; to set a container&amp;rsquo;s IP address, but this will not be
reflected in the &lt;code&gt;/etc/hosts&lt;/code&gt; file.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id=&#34;logging-drivers-log-driver&#34;&gt;Logging drivers (&amp;ndash;log-driver)&lt;/h2&gt;
&lt;p&gt;You can specify a different logging driver for the container than for the daemon.&lt;/p&gt;
&lt;h4 id=&#34;logging-driver-none&#34;&gt;Logging driver: none&lt;/h4&gt;
&lt;p&gt;Disables any logging for the container. &lt;code&gt;docker logs&lt;/code&gt; won&amp;rsquo;t be available with
this driver.&lt;/p&gt;
&lt;h4 id=&#34;logging-driver-json-file&#34;&gt;Logging driver: json-file&lt;/h4&gt;
&lt;p&gt;Default logging driver for Docker. Writes JSON messages to file. &lt;code&gt;docker logs&lt;/code&gt;
command is available only for this logging driver&lt;/p&gt;
&lt;p&gt;The following logging options are supported for this logging driver: [none]&lt;/p&gt;
&lt;h4 id=&#34;logging-driver-syslog&#34;&gt;Logging driver: syslog&lt;/h4&gt;
&lt;p&gt;Syslog logging driver for Docker. Writes log messages to syslog. &lt;code&gt;docker logs&lt;/code&gt;
command is not available for this logging driver&lt;/p&gt;
&lt;p&gt;The following logging options are supported for this logging driver:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;--log-opt address=[tcp|udp]://host:port
--log-opt address=unix://path
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;address&lt;/code&gt; specifies the remote syslog server address where the driver connects to.
If not specified it defaults to the local unix socket of the running system.
If transport is either &lt;code&gt;tcp&lt;/code&gt; or &lt;code&gt;udp&lt;/code&gt; and &lt;code&gt;port&lt;/code&gt; is not specified it defaults to &lt;code&gt;514&lt;/code&gt;
The following example shows how to have the &lt;code&gt;syslog&lt;/code&gt; driver connect to a &lt;code&gt;syslog&lt;/code&gt;
remote server at &lt;code&gt;192.168.0.42&lt;/code&gt; on port &lt;code&gt;123&lt;/code&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ docker run --log-driver=syslog --log-opt address=tcp://192.168.0.42:123
&lt;/code&gt;&lt;/pre&gt;
&lt;h4 id=&#34;logging-driver-journald&#34;&gt;Logging driver: journald&lt;/h4&gt;
&lt;p&gt;Journald logging driver for Docker. Writes log messages to journald; the container id will be stored in the journal&amp;rsquo;s &lt;code&gt;CONTAINER_ID&lt;/code&gt; field. &lt;code&gt;docker logs&lt;/code&gt; command is not available for this logging driver. For detailed information on working with this logging driver, see &lt;a href=&#34;reference/logging/journald&#34;&gt;the journald logging driver&lt;/a&gt; reference documentation.&lt;/p&gt;
&lt;p&gt;The following logging options are supported for this logging driver: [none]&lt;/p&gt;
&lt;h2 id=&#34;overriding-dockerfile-image-defaults&#34;&gt;Overriding Dockerfile image defaults&lt;/h2&gt;
&lt;p&gt;When a developer builds an image from a &lt;a href=&#34;http://localhost/docker/reference/builder&#34;&gt;&lt;em&gt;Dockerfile&lt;/em&gt;&lt;/a&gt;
or when she commits it, the developer can set a number of default parameters
that take effect when the image starts up as a container.&lt;/p&gt;
&lt;p&gt;Four of the Dockerfile commands cannot be overridden at runtime: &lt;code&gt;FROM&lt;/code&gt;,
&lt;code&gt;MAINTAINER&lt;/code&gt;, &lt;code&gt;RUN&lt;/code&gt;, and &lt;code&gt;ADD&lt;/code&gt;. Everything else has a corresponding override
in &lt;code&gt;docker run&lt;/code&gt;. We&amp;rsquo;ll go through what the developer might have set in each
Dockerfile instruction and how the operator can override that setting.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#cmd-default-command-or-options&#34;&gt;CMD (Default Command or Options)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#entrypoint-default-command-to-execute-at-runtime&#34;&gt;ENTRYPOINT (Default Command to Execute at Runtime)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#expose-incoming-ports&#34;&gt;EXPOSE (Incoming Ports)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#env-environment-variables&#34;&gt;ENV (Environment Variables)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#volume-shared-filesystems&#34;&gt;VOLUME (Shared Filesystems)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#user&#34;&gt;USER&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#workdir&#34;&gt;WORKDIR&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;cmd-default-command-or-options&#34;&gt;CMD (default command or options)&lt;/h2&gt;
&lt;p&gt;Recall the optional &lt;code&gt;COMMAND&lt;/code&gt; in the Docker
commandline:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ docker run [OPTIONS] IMAGE[:TAG|@DIGEST] [COMMAND] [ARG...]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This command is optional because the person who created the &lt;code&gt;IMAGE&lt;/code&gt; may
have already provided a default &lt;code&gt;COMMAND&lt;/code&gt; using the Dockerfile &lt;code&gt;CMD&lt;/code&gt;
instruction. As the operator (the person running a container from the
image), you can override that &lt;code&gt;CMD&lt;/code&gt; instruction just by specifying a new
&lt;code&gt;COMMAND&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;If the image also specifies an &lt;code&gt;ENTRYPOINT&lt;/code&gt; then the &lt;code&gt;CMD&lt;/code&gt; or &lt;code&gt;COMMAND&lt;/code&gt;
get appended as arguments to the &lt;code&gt;ENTRYPOINT&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id=&#34;entrypoint-default-command-to-execute-at-runtime&#34;&gt;ENTRYPOINT (default command to execute at runtime)&lt;/h2&gt;
&lt;pre&gt;&lt;code&gt;--entrypoint=&amp;quot;&amp;quot;: Overwrite the default entrypoint set by the image
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The &lt;code&gt;ENTRYPOINT&lt;/code&gt; of an image is similar to a &lt;code&gt;COMMAND&lt;/code&gt; because it
specifies what executable to run when the container starts, but it is
(purposely) more difficult to override. The &lt;code&gt;ENTRYPOINT&lt;/code&gt; gives a
container its default nature or behavior, so that when you set an
&lt;code&gt;ENTRYPOINT&lt;/code&gt; you can run the container &lt;em&gt;as if it were that binary&lt;/em&gt;,
complete with default options, and you can pass in more options via the
&lt;code&gt;COMMAND&lt;/code&gt;. But, sometimes an operator may want to run something else
inside the container, so you can override the default &lt;code&gt;ENTRYPOINT&lt;/code&gt; at
runtime by using a string to specify the new &lt;code&gt;ENTRYPOINT&lt;/code&gt;. Here is an
example of how to run a shell in a container that has been set up to
automatically run something else (like &lt;code&gt;/usr/bin/redis-server&lt;/code&gt;):&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ docker run -i -t --entrypoint /bin/bash example/redis
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;or two examples of how to pass more parameters to that ENTRYPOINT:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ docker run -i -t --entrypoint /bin/bash example/redis -c ls -l
$ docker run -i -t --entrypoint /usr/bin/redis-cli example/redis --help
&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&#34;expose-incoming-ports&#34;&gt;EXPOSE (incoming ports)&lt;/h2&gt;
&lt;p&gt;The Dockerfile doesn&amp;rsquo;t give much control over networking, only providing
the &lt;code&gt;EXPOSE&lt;/code&gt; instruction to give a hint to the operator about what
incoming ports might provide services. The following options work with
or override the Dockerfile&amp;rsquo;s exposed defaults:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;--expose=[]: Expose a port or a range of ports from the container
without publishing it to your host
-P=false : Publish all exposed ports to the host interfaces
-p=[] : Publish a container᾿s port or a range of ports to the host
format: ip:hostPort:containerPort | ip::containerPort | hostPort:containerPort | containerPort
Both hostPort and containerPort can be specified as a range of ports.
When specifying ranges for both, the number of container ports in the range must match the number of host ports in the range. (e.g., `-p 1234-1236:1234-1236/tcp`)
(use &#39;docker port&#39; to see the actual mapping)
--link=&amp;quot;&amp;quot; : Add link to another container (&amp;lt;name or id&amp;gt;:alias or &amp;lt;name or id&amp;gt;)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;As mentioned previously, &lt;code&gt;EXPOSE&lt;/code&gt; (and &lt;code&gt;--expose&lt;/code&gt;) makes ports available
&lt;strong&gt;in&lt;/strong&gt; a container for incoming connections. The port number on the
inside of the container (where the service listens) does not need to be
the same number as the port exposed on the outside of the container
(where clients connect), so inside the container you might have an HTTP
service listening on port 80 (and so you &lt;code&gt;EXPOSE 80&lt;/code&gt; in the Dockerfile),
but outside the container the port might be 42800.&lt;/p&gt;
&lt;p&gt;To help a new client container reach the server container&amp;rsquo;s internal
port operator &lt;code&gt;--expose&lt;/code&gt;&amp;rsquo;d by the operator or &lt;code&gt;EXPOSE&lt;/code&gt;&amp;rsquo;d by the
developer, the operator has three choices: start the server container
with &lt;code&gt;-P&lt;/code&gt; or &lt;code&gt;-p,&lt;/code&gt; or start the client container with &lt;code&gt;--link&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;If the operator uses &lt;code&gt;-P&lt;/code&gt; or &lt;code&gt;-p&lt;/code&gt; then Docker will make the exposed port
accessible on the host and the ports will be available to any client that can
reach the host. When using &lt;code&gt;-P&lt;/code&gt;, Docker will bind the exposed port to a random
port on the host within an &lt;em&gt;ephemeral port range&lt;/em&gt; defined by
&lt;code&gt;/proc/sys/net/ipv4/ip_local_port_range&lt;/code&gt;. To find the mapping between the host
ports and the exposed ports, use &lt;code&gt;docker port&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;If the operator uses &lt;code&gt;--link&lt;/code&gt; when starting the new client container,
then the client container can access the exposed port via a private
networking interface. Docker will set some environment variables in the
client container to help indicate which interface and port to use.&lt;/p&gt;
&lt;h2 id=&#34;env-environment-variables&#34;&gt;ENV (environment variables)&lt;/h2&gt;
&lt;p&gt;When a new container is created, Docker will set the following environment
variables automatically:&lt;/p&gt;
&lt;table&gt;
&lt;tr&gt;
&lt;th&gt;Variable&lt;/th&gt;
&lt;th&gt;Value&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;HOME&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
Set based on the value of &lt;code&gt;USER&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;HOSTNAME&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
The hostname associated with the container
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;PATH&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
Includes popular directories, such as :&lt;br&gt;
&lt;code&gt;/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin&lt;/code&gt;
&lt;/td&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;TERM&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;xterm&lt;/code&gt; if the container is allocated a psuedo-TTY&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;p&gt;The container may also include environment variables defined
as a result of the container being linked with another container. See
the &lt;a href=&#34;http://localhost/userguide/dockerlinks/#container-linking&#34;&gt;&lt;em&gt;Container Links&lt;/em&gt;&lt;/a&gt;
section for more details.&lt;/p&gt;
&lt;p&gt;Additionally, the operator can &lt;strong&gt;set any environment variable&lt;/strong&gt; in the
container by using one or more &lt;code&gt;-e&lt;/code&gt; flags, even overriding those mentioned
above, or already defined by the developer with a Dockerfile &lt;code&gt;ENV&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ docker run -e &amp;quot;deep=purple&amp;quot; --rm ubuntu /bin/bash -c export
declare -x HOME=&amp;quot;/&amp;quot;
declare -x HOSTNAME=&amp;quot;85bc26a0e200&amp;quot;
declare -x OLDPWD
declare -x PATH=&amp;quot;/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin&amp;quot;
declare -x PWD=&amp;quot;/&amp;quot;
declare -x SHLVL=&amp;quot;1&amp;quot;
declare -x container=&amp;quot;lxc&amp;quot;
declare -x deep=&amp;quot;purple&amp;quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Similarly the operator can set the &lt;strong&gt;hostname&lt;/strong&gt; with &lt;code&gt;-h&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;--link &amp;lt;name or id&amp;gt;:alias&lt;/code&gt; also sets environment variables, using the &lt;em&gt;alias&lt;/em&gt; string to
define environment variables within the container that give the IP and PORT
information for connecting to the service container. Let&amp;rsquo;s imagine we have a
container running Redis:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;# Start the service container, named redis-name
$ docker run -d --name redis-name dockerfiles/redis
4241164edf6f5aca5b0e9e4c9eccd899b0b8080c64c0cd26efe02166c73208f3
# The redis-name container exposed port 6379
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
4241164edf6f $ dockerfiles/redis:latest /redis-stable/src/re 5 seconds ago Up 4 seconds 6379/tcp redis-name
# Note that there are no public ports exposed since we didn᾿t use -p or -P
$ docker port 4241164edf6f 6379
2014/01/25 00:55:38 Error: No public port &#39;6379&#39; published for 4241164edf6f
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Yet we can get information about the Redis container&amp;rsquo;s exposed ports
with &lt;code&gt;--link&lt;/code&gt;. Choose an alias that will form a
valid environment variable!&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ docker run --rm --link redis-name:redis_alias --entrypoint /bin/bash dockerfiles/redis -c export
declare -x HOME=&amp;quot;/&amp;quot;
declare -x HOSTNAME=&amp;quot;acda7f7b1cdc&amp;quot;
declare -x OLDPWD
declare -x PATH=&amp;quot;/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin&amp;quot;
declare -x PWD=&amp;quot;/&amp;quot;
declare -x REDIS_ALIAS_NAME=&amp;quot;/distracted_wright/redis&amp;quot;
declare -x REDIS_ALIAS_PORT=&amp;quot;tcp://172.17.0.32:6379&amp;quot;
declare -x REDIS_ALIAS_PORT_6379_TCP=&amp;quot;tcp://172.17.0.32:6379&amp;quot;
declare -x REDIS_ALIAS_PORT_6379_TCP_ADDR=&amp;quot;172.17.0.32&amp;quot;
declare -x REDIS_ALIAS_PORT_6379_TCP_PORT=&amp;quot;6379&amp;quot;
declare -x REDIS_ALIAS_PORT_6379_TCP_PROTO=&amp;quot;tcp&amp;quot;
declare -x SHLVL=&amp;quot;1&amp;quot;
declare -x container=&amp;quot;lxc&amp;quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And we can use that information to connect from another container as a client:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ docker run -i -t --rm --link redis-name:redis_alias --entrypoint /bin/bash dockerfiles/redis -c &#39;/redis-stable/src/redis-cli -h $REDIS_ALIAS_PORT_6379_TCP_ADDR -p $REDIS_ALIAS_PORT_6379_TCP_PORT&#39;
172.17.0.32:6379&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Docker will also map the private IP address to the alias of a linked
container by inserting an entry into &lt;code&gt;/etc/hosts&lt;/code&gt;. You can use this
mechanism to communicate with a linked container by its alias:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ docker run -d --name servicename busybox sleep 30
$ docker run -i -t --link servicename:servicealias busybox ping -c 1 servicealias
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If you restart the source container (&lt;code&gt;servicename&lt;/code&gt; in this case), the recipient
container&amp;rsquo;s &lt;code&gt;/etc/hosts&lt;/code&gt; entry will be automatically updated.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;:
Unlike host entries in the &lt;code&gt;/etc/hosts&lt;/code&gt; file, IP addresses stored in the
environment variables are not automatically updated if the source container is
restarted. We recommend using the host entries in &lt;code&gt;/etc/hosts&lt;/code&gt; to resolve the
IP address of linked containers.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id=&#34;volume-shared-filesystems&#34;&gt;VOLUME (shared filesystems)&lt;/h2&gt;
&lt;pre&gt;&lt;code&gt;-v=[]: Create a bind mount with: [host-dir:]container-dir[:rw|ro].
If &#39;host-dir&#39; is missing, then docker creates a new volume.
If neither &#39;rw&#39; or &#39;ro&#39; is specified then the volume is mounted
in read-write mode.
--volumes-from=&amp;quot;&amp;quot;: Mount all volumes from the given container(s)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The volumes commands are complex enough to have their own documentation
in section &lt;a href=&#34;http://localhost/userguide/dockervolumes&#34;&gt;&lt;em&gt;Managing data in
containers&lt;/em&gt;&lt;/a&gt;. A developer can define
one or more &lt;code&gt;VOLUME&lt;/code&gt;&amp;rsquo;s associated with an image, but only the operator
can give access from one container to another (or from a container to a
volume mounted on the host).&lt;/p&gt;
&lt;h2 id=&#34;user&#34;&gt;USER&lt;/h2&gt;
&lt;p&gt;The default user within a container is &lt;code&gt;root&lt;/code&gt; (id = 0), but if the
developer created additional users, those are accessible too. The
developer can set a default user to run the first process with the
Dockerfile &lt;code&gt;USER&lt;/code&gt; instruction, but the operator can override it:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;-u=&amp;quot;&amp;quot;: Username or UID
&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; if you pass numeric uid, it must be in range 0-2147483647.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id=&#34;workdir&#34;&gt;WORKDIR&lt;/h2&gt;
&lt;p&gt;The default working directory for running binaries within a container is the
root directory (&lt;code&gt;/&lt;/code&gt;), but the developer can set a different default with the
Dockerfile &lt;code&gt;WORKDIR&lt;/code&gt; command. The operator can override this with:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;-w=&amp;quot;&amp;quot;: Working directory inside the container
&lt;/code&gt;&lt;/pre&gt;
</description>
</item>
<item>
<title>Dockerfile reference</title>
<link>http://localhost/reference/builder/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>http://localhost/reference/builder/</guid>
<description>
&lt;h1 id=&#34;dockerfile-reference&#34;&gt;Dockerfile reference&lt;/h1&gt;
&lt;p&gt;&lt;strong&gt;Docker can build images automatically&lt;/strong&gt; by reading the instructions
from a &lt;code&gt;Dockerfile&lt;/code&gt;. A &lt;code&gt;Dockerfile&lt;/code&gt; is a text document that contains all
the commands you would normally execute manually in order to build a
Docker image. By calling &lt;code&gt;docker build&lt;/code&gt; from your terminal, you can have
Docker build your image step by step, executing the instructions
successively.&lt;/p&gt;
&lt;p&gt;This page discusses the specifics of all the instructions you can use in your
&lt;code&gt;Dockerfile&lt;/code&gt;. To further help you write a clear, readable, maintainable
&lt;code&gt;Dockerfile&lt;/code&gt;, we&amp;rsquo;ve also written a &lt;a href=&#34;http://localhost/articles/dockerfile_best-practices&#34;&gt;&lt;code&gt;Dockerfile&lt;/code&gt; Best Practices
guide&lt;/a&gt;. Lastly, you can test your
Dockerfile knowledge with the &lt;a href=&#34;http://localhost/userguide/level1&#34;&gt;Dockerfile tutorial&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;usage&#34;&gt;Usage&lt;/h2&gt;
&lt;p&gt;To &lt;a href=&#34;http://localhost/docker/reference/commandline/cli/#build&#34;&gt;&lt;em&gt;build&lt;/em&gt;&lt;/a&gt; an image from a source repository,
create a description file called &lt;code&gt;Dockerfile&lt;/code&gt; at the root of your repository.
This file will describe the steps to assemble the image.&lt;/p&gt;
&lt;p&gt;Then call &lt;code&gt;docker build&lt;/code&gt; with the path of your source repository as the argument
(for example, &lt;code&gt;.&lt;/code&gt;):&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ docker build .
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The path to the source repository defines where to find the &lt;em&gt;context&lt;/em&gt; of
the build. The build is run by the Docker daemon, not by the CLI, so the
whole context must be transferred to the daemon. The Docker CLI reports
&amp;ldquo;Sending build context to Docker daemon&amp;rdquo; when the context is sent to the daemon.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Warning&lt;/strong&gt;
Avoid using your root directory, &lt;code&gt;/&lt;/code&gt;, as the root of the source repository. The
&lt;code&gt;docker build&lt;/code&gt; command will use whatever directory contains the Dockerfile as the build
context (including all of its subdirectories). The build context will be sent to the
Docker daemon before building the image, which means if you use &lt;code&gt;/&lt;/code&gt; as the source
repository, the entire contents of your hard drive will get sent to the daemon (and
thus to the machine running the daemon). You probably don&amp;rsquo;t want that.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;In most cases, it&amp;rsquo;s best to put each Dockerfile in an empty directory. Then,
only add the files needed for building the Dockerfile to the directory. To
increase the build&amp;rsquo;s performance, you can exclude files and directories by
adding a &lt;code&gt;.dockerignore&lt;/code&gt; file to the directory. For information about how to
&lt;a href=&#34;#dockerignore-file&#34;&gt;create a &lt;code&gt;.dockerignore&lt;/code&gt; file&lt;/a&gt; on this page.&lt;/p&gt;
&lt;p&gt;You can specify a repository and tag at which to save the new image if
the build succeeds:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ docker build -t shykes/myapp .
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The Docker daemon will run your steps one-by-one, committing the result
to a new image if necessary, before finally outputting the ID of your
new image. The Docker daemon will automatically clean up the context you
sent.&lt;/p&gt;
&lt;p&gt;Note that each instruction is run independently, and causes a new image
to be created - so &lt;code&gt;RUN cd /tmp&lt;/code&gt; will not have any effect on the next
instructions.&lt;/p&gt;
&lt;p&gt;Whenever possible, Docker will re-use the intermediate images,
accelerating &lt;code&gt;docker build&lt;/code&gt; significantly (indicated by &lt;code&gt;Using cache&lt;/code&gt; -
see the &lt;a href=&#34;http://localhost/articles/dockerfile_best-practices/#build-cache&#34;&gt;&lt;code&gt;Dockerfile&lt;/code&gt; Best Practices
guide&lt;/a&gt; for more information):&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ docker build -t SvenDowideit/ambassador .
Uploading context 10.24 kB
Uploading context
Step 1 : FROM docker-ut
---&amp;gt; cbba202fe96b
Step 2 : MAINTAINER SvenDowideit@home.org.au
---&amp;gt; Using cache
---&amp;gt; 51182097be13
Step 3 : CMD env | grep _TCP= | sed &#39;s/.*_PORT_\([0-9]*\)_TCP=tcp:\/\/\(.*\):\(.*\)/socat TCP4-LISTEN:\1,fork,reuseaddr TCP4:\2:\3 \&amp;amp;/&#39; | sh &amp;amp;&amp;amp; top
---&amp;gt; Using cache
---&amp;gt; 1a5ffc17324d
Successfully built 1a5ffc17324d
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;When you&amp;rsquo;re done with your build, you&amp;rsquo;re ready to look into &lt;a href=&#34;http://localhost/userguide/dockerrepos/#contributing-to-docker-hub&#34;&gt;&lt;em&gt;Pushing a
repository to its registry&lt;/em&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;format&#34;&gt;Format&lt;/h2&gt;
&lt;p&gt;Here is the format of the &lt;code&gt;Dockerfile&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;# Comment
INSTRUCTION arguments
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The Instruction is not case-sensitive, however convention is for them to
be UPPERCASE in order to distinguish them from arguments more easily.&lt;/p&gt;
&lt;p&gt;Docker runs the instructions in a &lt;code&gt;Dockerfile&lt;/code&gt; in order. &lt;strong&gt;The
first instruction must be `FROM`&lt;/strong&gt; in order to specify the &lt;a href=&#34;http://localhost/docker/reference/glossary/#base-image&#34;&gt;&lt;em&gt;Base
Image&lt;/em&gt;&lt;/a&gt; from which you are building.&lt;/p&gt;
&lt;p&gt;Docker will treat lines that &lt;em&gt;begin&lt;/em&gt; with &lt;code&gt;#&lt;/code&gt; as a
comment. A &lt;code&gt;#&lt;/code&gt; marker anywhere else in the line will
be treated as an argument. This allows statements like:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;# Comment
RUN echo &#39;we are running some # of cool things&#39;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Here is the set of instructions you can use in a &lt;code&gt;Dockerfile&lt;/code&gt; for building
images.&lt;/p&gt;
&lt;h3 id=&#34;environment-replacement&#34;&gt;Environment replacement&lt;/h3&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: prior to 1.3, &lt;code&gt;Dockerfile&lt;/code&gt; environment variables were handled
similarly, in that they would be replaced as described below. However, there
was no formal definition on as to which instructions handled environment
replacement at the time. After 1.3 this behavior will be preserved and
canonical.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Environment variables (declared with &lt;a href=&#34;#env&#34;&gt;the &lt;code&gt;ENV&lt;/code&gt; statement&lt;/a&gt;) can also be
used in certain instructions as variables to be interpreted by the
&lt;code&gt;Dockerfile&lt;/code&gt;. Escapes are also handled for including variable-like syntax
into a statement literally.&lt;/p&gt;
&lt;p&gt;Environment variables are notated in the &lt;code&gt;Dockerfile&lt;/code&gt; either with
&lt;code&gt;$variable_name&lt;/code&gt; or &lt;code&gt;${variable_name}&lt;/code&gt;. They are treated equivalently and the
brace syntax is typically used to address issues with variable names with no
whitespace, like &lt;code&gt;${foo}_bar&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;${variable_name}&lt;/code&gt; syntax also supports a few of the standard &lt;code&gt;bash&lt;/code&gt;
modifiers as specified below:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;${variable:-word}&lt;/code&gt; indicates that if &lt;code&gt;variable&lt;/code&gt; is set then the result
will be that value. If &lt;code&gt;variable&lt;/code&gt; is not set then &lt;code&gt;word&lt;/code&gt; will be the result.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;${variable:+word}&lt;/code&gt; indicates that if &lt;code&gt;variable&lt;/code&gt; is set then &lt;code&gt;word&lt;/code&gt; will be
the result, otherwise the result is the empty string.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In all cases, &lt;code&gt;word&lt;/code&gt; can be any string, including additional environment
variables.&lt;/p&gt;
&lt;p&gt;Escaping is possible by adding a &lt;code&gt;\&lt;/code&gt; before the variable: &lt;code&gt;\$foo&lt;/code&gt; or &lt;code&gt;\${foo}&lt;/code&gt;,
for example, will translate to &lt;code&gt;$foo&lt;/code&gt; and &lt;code&gt;${foo}&lt;/code&gt; literals respectively.&lt;/p&gt;
&lt;p&gt;Example (parsed representation is displayed after the &lt;code&gt;#&lt;/code&gt;):&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;FROM busybox
ENV foo /bar
WORKDIR ${foo} # WORKDIR /bar
ADD . $foo # ADD . /bar
COPY \$foo /quux # COPY $foo /quux
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The instructions that handle environment variables in the &lt;code&gt;Dockerfile&lt;/code&gt; are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ENV&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ADD&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;COPY&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;WORKDIR&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;EXPOSE&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;VOLUME&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;USER&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;code&gt;ONBUILD&lt;/code&gt; instructions are &lt;strong&gt;NOT&lt;/strong&gt; supported for environment replacement, even
the instructions above.&lt;/p&gt;
&lt;p&gt;Environment variable substitution will use the same value for each variable
throughout the entire command. In other words, in this example:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;ENV abc=hello
ENV abc=bye def=$abc
ENV ghi=$abc
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;will result in &lt;code&gt;def&lt;/code&gt; having a value of &lt;code&gt;hello&lt;/code&gt;, not &lt;code&gt;bye&lt;/code&gt;. However,
&lt;code&gt;ghi&lt;/code&gt; will have a value of &lt;code&gt;bye&lt;/code&gt; because it is not part of the same command
that set &lt;code&gt;abc&lt;/code&gt; to &lt;code&gt;bye&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id=&#34;dockerignore-file&#34;&gt;.dockerignore file&lt;/h3&gt;
&lt;p&gt;If a file named &lt;code&gt;.dockerignore&lt;/code&gt; exists in the root of &lt;code&gt;PATH&lt;/code&gt;, then Docker
interprets it as a newline-separated list of exclusion patterns. Docker excludes
files or directories relative to &lt;code&gt;PATH&lt;/code&gt; that match these exclusion patterns. If
there are any &lt;code&gt;.dockerignore&lt;/code&gt; files in &lt;code&gt;PATH&lt;/code&gt; subdirectories, Docker treats
them as normal files.&lt;/p&gt;
&lt;p&gt;Filepaths in &lt;code&gt;.dockerignore&lt;/code&gt; are absolute with the current directory as the
root. Wildcards are allowed but the search is not recursive. Globbing (file name
expansion) is done using Go&amp;rsquo;s
&lt;a href=&#34;http://golang.org/pkg/path/filepath#Match&#34;&gt;filepath.Match&lt;/a&gt; rules.&lt;/p&gt;
&lt;p&gt;You can specify exceptions to exclusion rules. To do this, simply prefix a
pattern with an &lt;code&gt;!&lt;/code&gt; (exclamation mark) in the same way you would in a
&lt;code&gt;.gitignore&lt;/code&gt; file. Currently there is no support for regular expressions.
Formats like &lt;code&gt;[^temp*]&lt;/code&gt; are ignored.&lt;/p&gt;
&lt;p&gt;The following is an example &lt;code&gt;.dockerignore&lt;/code&gt; file:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; */temp*
*/*/temp*
temp?
*.md
!LICENCSE.md
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This file causes the following build behavior:&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Rule&lt;/th&gt;
&lt;th&gt;Behavior&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;*/temp*&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Exclude all files with names starting with&lt;code&gt;temp&lt;/code&gt; in any subdirectory below the root directory. For example, a file named&lt;code&gt;/somedir/temporary.txt&lt;/code&gt; is ignored.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;*/*/temp*&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Exclude files starting with name &lt;code&gt;temp&lt;/code&gt; from any subdirectory that is two levels below the root directory. For example, the file &lt;code&gt;/somedir/subdir/temporary.txt&lt;/code&gt; is ignored.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;temp?&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Exclude the files that match the pattern in the root directory. For example, the files &lt;code&gt;tempa&lt;/code&gt;, &lt;code&gt;tempb&lt;/code&gt; in the root directory are ignored.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;*.md&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Exclude all markdown files in the root directory.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;!LICENSE.md&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Exception to the Markdown files exclusion is this file, &lt;code&gt;LICENSE.md&lt;/code&gt;, Include this file in the build.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;The placement of &lt;code&gt;!&lt;/code&gt; exception rules influences the matching algorithm; the
last line of the &lt;code&gt;.dockerignore&lt;/code&gt; that matches a particular file determines
whether it is included or excluded. In the above example, the &lt;code&gt;LICENSE.md&lt;/code&gt; file
matches both the &lt;code&gt;*.md&lt;/code&gt; and &lt;code&gt;!LICENSE.md&lt;/code&gt; rule. If you reverse the lines in the
example:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; */temp*
*/*/temp*
temp?
!LICENCSE.md
*.md
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The build would exclude &lt;code&gt;LICENSE.md&lt;/code&gt; because the last &lt;code&gt;*.md&lt;/code&gt; rule adds all
Markdown files in the root directory back onto the ignore list. The
&lt;code&gt;!LICENSE.md&lt;/code&gt; rule has no effect because the subsequent &lt;code&gt;*.md&lt;/code&gt; rule overrides
it.&lt;/p&gt;
&lt;p&gt;You can even use the &lt;code&gt;.dockerignore&lt;/code&gt; file to ignore the &lt;code&gt;Dockerfile&lt;/code&gt; and
&lt;code&gt;.dockerignore&lt;/code&gt; files. This is useful if you are copying files from the root of
the build context into your new container but do not want to include the
&lt;code&gt;Dockerfile&lt;/code&gt; or &lt;code&gt;.dockerignore&lt;/code&gt; files (e.g. &lt;code&gt;ADD . /someDir/&lt;/code&gt;).&lt;/p&gt;
&lt;h2 id=&#34;from&#34;&gt;FROM&lt;/h2&gt;
&lt;pre&gt;&lt;code&gt;FROM &amp;lt;image&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Or&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;FROM &amp;lt;image&amp;gt;:&amp;lt;tag&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Or&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;FROM &amp;lt;image&amp;gt;@&amp;lt;digest&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The &lt;code&gt;FROM&lt;/code&gt; instruction sets the &lt;a href=&#34;http://localhost/docker/reference/glossary/#base-image&#34;&gt;&lt;em&gt;Base Image&lt;/em&gt;&lt;/a&gt;
for subsequent instructions. As such, a valid &lt;code&gt;Dockerfile&lt;/code&gt; must have &lt;code&gt;FROM&lt;/code&gt; as
its first instruction. The image can be any valid image it is especially easy
to start by &lt;strong&gt;pulling an image&lt;/strong&gt; from the &lt;a href=&#34;http://localhost/userguide/dockerrepos&#34;&gt;&lt;em&gt;Public Repositories&lt;/em&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;FROM&lt;/code&gt; must be the first non-comment instruction in the &lt;code&gt;Dockerfile&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;FROM&lt;/code&gt; can appear multiple times within a single &lt;code&gt;Dockerfile&lt;/code&gt; in order to create
multiple images. Simply make a note of the last image ID output by the commit
before each new &lt;code&gt;FROM&lt;/code&gt; command.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;tag&lt;/code&gt; or &lt;code&gt;digest&lt;/code&gt; values are optional. If you omit either of them, the builder
assumes a &lt;code&gt;latest&lt;/code&gt; by default. The builder returns an error if it cannot match
the &lt;code&gt;tag&lt;/code&gt; value.&lt;/p&gt;
&lt;h2 id=&#34;maintainer&#34;&gt;MAINTAINER&lt;/h2&gt;
&lt;pre&gt;&lt;code&gt;MAINTAINER &amp;lt;name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The &lt;code&gt;MAINTAINER&lt;/code&gt; instruction allows you to set the &lt;em&gt;Author&lt;/em&gt; field of the
generated images.&lt;/p&gt;
&lt;h2 id=&#34;run&#34;&gt;RUN&lt;/h2&gt;
&lt;p&gt;RUN has 2 forms:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;RUN &amp;lt;command&amp;gt;&lt;/code&gt; (the command is run in a shell - &lt;code&gt;/bin/sh -c&lt;/code&gt; - &lt;em&gt;shell&lt;/em&gt; form)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;RUN [&amp;quot;executable&amp;quot;, &amp;quot;param1&amp;quot;, &amp;quot;param2&amp;quot;]&lt;/code&gt; (&lt;em&gt;exec&lt;/em&gt; form)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The &lt;code&gt;RUN&lt;/code&gt; instruction will execute any commands in a new layer on top of the
current image and commit the results. The resulting committed image will be
used for the next step in the &lt;code&gt;Dockerfile&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Layering &lt;code&gt;RUN&lt;/code&gt; instructions and generating commits conforms to the core
concepts of Docker where commits are cheap and containers can be created from
any point in an image&amp;rsquo;s history, much like source control.&lt;/p&gt;
&lt;p&gt;The &lt;em&gt;exec&lt;/em&gt; form makes it possible to avoid shell string munging, and to &lt;code&gt;RUN&lt;/code&gt;
commands using a base image that does not contain &lt;code&gt;/bin/sh&lt;/code&gt;.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;:
To use a different shell, other than &amp;lsquo;/bin/sh&amp;rsquo;, use the &lt;em&gt;exec&lt;/em&gt; form
passing in the desired shell. For example,
&lt;code&gt;RUN [&amp;quot;/bin/bash&amp;quot;, &amp;quot;-c&amp;quot;, &amp;quot;echo hello&amp;quot;]&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;:
The &lt;em&gt;exec&lt;/em&gt; form is parsed as a JSON array, which means that
you must use double-quotes (&amp;ldquo;) around words not single-quotes (&amp;lsquo;).&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;:
Unlike the &lt;em&gt;shell&lt;/em&gt; form, the &lt;em&gt;exec&lt;/em&gt; form does not invoke a command shell.
This means that normal shell processing does not happen. For example,
&lt;code&gt;RUN [ &amp;quot;echo&amp;quot;, &amp;quot;$HOME&amp;quot; ]&lt;/code&gt; will not do variable substitution on &lt;code&gt;$HOME&lt;/code&gt;.
If you want shell processing then either use the &lt;em&gt;shell&lt;/em&gt; form or execute
a shell directly, for example: &lt;code&gt;RUN [ &amp;quot;sh&amp;quot;, &amp;quot;-c&amp;quot;, &amp;quot;echo&amp;quot;, &amp;quot;$HOME&amp;quot; ]&lt;/code&gt;.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The cache for &lt;code&gt;RUN&lt;/code&gt; instructions isn&amp;rsquo;t invalidated automatically during
the next build. The cache for an instruction like
&lt;code&gt;RUN apt-get dist-upgrade -y&lt;/code&gt; will be reused during the next build. The
cache for &lt;code&gt;RUN&lt;/code&gt; instructions can be invalidated by using the &lt;code&gt;--no-cache&lt;/code&gt;
flag, for example &lt;code&gt;docker build --no-cache&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;See the &lt;a href=&#34;http://localhost/articles/dockerfile_best-practices/#build-cache&#34;&gt;&lt;code&gt;Dockerfile&lt;/code&gt; Best Practices
guide&lt;/a&gt; for more information.&lt;/p&gt;
&lt;p&gt;The cache for &lt;code&gt;RUN&lt;/code&gt; instructions can be invalidated by &lt;code&gt;ADD&lt;/code&gt; instructions. See
&lt;a href=&#34;#add&#34;&gt;below&lt;/a&gt; for details.&lt;/p&gt;
&lt;h3 id=&#34;known-issues-run&#34;&gt;Known issues (RUN)&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/docker/docker/issues/783&#34;&gt;Issue 783&lt;/a&gt; is about file
permissions problems that can occur when using the AUFS file system. You
might notice it during an attempt to &lt;code&gt;rm&lt;/code&gt; a file, for example.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For systems that have recent aufs version (i.e., &lt;code&gt;dirperm1&lt;/code&gt; mount option can
be set), docker will attempt to fix the issue automatically by mounting
the layers with &lt;code&gt;dirperm1&lt;/code&gt; option. More details on &lt;code&gt;dirperm1&lt;/code&gt; option can be
found at &lt;a href=&#34;http://aufs.sourceforge.net/aufs3/man.html&#34;&gt;&lt;code&gt;aufs&lt;/code&gt; man page&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;If your system doesn&amp;rsquo;t have support for &lt;code&gt;dirperm1&lt;/code&gt;, the issue describes a workaround.&lt;/p&gt;
&lt;h2 id=&#34;cmd&#34;&gt;CMD&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;CMD&lt;/code&gt; instruction has three forms:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;CMD [&amp;quot;executable&amp;quot;,&amp;quot;param1&amp;quot;,&amp;quot;param2&amp;quot;]&lt;/code&gt; (&lt;em&gt;exec&lt;/em&gt; form, this is the preferred form)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;CMD [&amp;quot;param1&amp;quot;,&amp;quot;param2&amp;quot;]&lt;/code&gt; (as &lt;em&gt;default parameters to ENTRYPOINT&lt;/em&gt;)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;CMD command param1 param2&lt;/code&gt; (&lt;em&gt;shell&lt;/em&gt; form)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;There can only be one &lt;code&gt;CMD&lt;/code&gt; instruction in a &lt;code&gt;Dockerfile&lt;/code&gt;. If you list more than one &lt;code&gt;CMD&lt;/code&gt;
then only the last &lt;code&gt;CMD&lt;/code&gt; will take effect.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The main purpose of a &lt;code&gt;CMD&lt;/code&gt; is to provide defaults for an executing
container.&lt;/strong&gt; These defaults can include an executable, or they can omit
the executable, in which case you must specify an &lt;code&gt;ENTRYPOINT&lt;/code&gt;
instruction as well.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;:
If &lt;code&gt;CMD&lt;/code&gt; is used to provide default arguments for the &lt;code&gt;ENTRYPOINT&lt;/code&gt;
instruction, both the &lt;code&gt;CMD&lt;/code&gt; and &lt;code&gt;ENTRYPOINT&lt;/code&gt; instructions should be specified
with the JSON array format.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;:
The &lt;em&gt;exec&lt;/em&gt; form is parsed as a JSON array, which means that
you must use double-quotes (&amp;ldquo;) around words not single-quotes (&amp;lsquo;).&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;:
Unlike the &lt;em&gt;shell&lt;/em&gt; form, the &lt;em&gt;exec&lt;/em&gt; form does not invoke a command shell.
This means that normal shell processing does not happen. For example,
&lt;code&gt;CMD [ &amp;quot;echo&amp;quot;, &amp;quot;$HOME&amp;quot; ]&lt;/code&gt; will not do variable substitution on &lt;code&gt;$HOME&lt;/code&gt;.
If you want shell processing then either use the &lt;em&gt;shell&lt;/em&gt; form or execute
a shell directly, for example: &lt;code&gt;CMD [ &amp;quot;sh&amp;quot;, &amp;quot;-c&amp;quot;, &amp;quot;echo&amp;quot;, &amp;quot;$HOME&amp;quot; ]&lt;/code&gt;.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;When used in the shell or exec formats, the &lt;code&gt;CMD&lt;/code&gt; instruction sets the command
to be executed when running the image.&lt;/p&gt;
&lt;p&gt;If you use the &lt;em&gt;shell&lt;/em&gt; form of the &lt;code&gt;CMD&lt;/code&gt;, then the &lt;code&gt;&amp;lt;command&amp;gt;&lt;/code&gt; will execute in
&lt;code&gt;/bin/sh -c&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;FROM ubuntu
CMD echo &amp;quot;This is a test.&amp;quot; | wc -
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If you want to &lt;strong&gt;run your&lt;/strong&gt; &lt;code&gt;&amp;lt;command&amp;gt;&lt;/code&gt; &lt;strong&gt;without a shell&lt;/strong&gt; then you must
express the command as a JSON array and give the full path to the executable.
&lt;strong&gt;This array form is the preferred format of &lt;code&gt;CMD&lt;/code&gt;.&lt;/strong&gt; Any additional parameters
must be individually expressed as strings in the array:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;FROM ubuntu
CMD [&amp;quot;/usr/bin/wc&amp;quot;,&amp;quot;--help&amp;quot;]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If you would like your container to run the same executable every time, then
you should consider using &lt;code&gt;ENTRYPOINT&lt;/code&gt; in combination with &lt;code&gt;CMD&lt;/code&gt;. See
&lt;a href=&#34;#entrypoint&#34;&gt;&lt;em&gt;ENTRYPOINT&lt;/em&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;If the user specifies arguments to &lt;code&gt;docker run&lt;/code&gt; then they will override the
default specified in &lt;code&gt;CMD&lt;/code&gt;.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;:
don&amp;rsquo;t confuse &lt;code&gt;RUN&lt;/code&gt; with &lt;code&gt;CMD&lt;/code&gt;. &lt;code&gt;RUN&lt;/code&gt; actually runs a command and commits
the result; &lt;code&gt;CMD&lt;/code&gt; does not execute anything at build time, but specifies
the intended command for the image.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id=&#34;label&#34;&gt;LABEL&lt;/h2&gt;
&lt;pre&gt;&lt;code&gt;LABEL &amp;lt;key&amp;gt;=&amp;lt;value&amp;gt; &amp;lt;key&amp;gt;=&amp;lt;value&amp;gt; &amp;lt;key&amp;gt;=&amp;lt;value&amp;gt; ...
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The &lt;code&gt;LABEL&lt;/code&gt; instruction adds metadata to an image. A &lt;code&gt;LABEL&lt;/code&gt; is a
key-value pair. To include spaces within a &lt;code&gt;LABEL&lt;/code&gt; value, use quotes and
backslashes as you would in command-line parsing.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;LABEL &amp;quot;com.example.vendor&amp;quot;=&amp;quot;ACME Incorporated&amp;quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;An image can have more than one label. To specify multiple labels, separate each
key-value pair with whitespace.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;LABEL com.example.label-with-value=&amp;quot;foo&amp;quot;
LABEL version=&amp;quot;1.0&amp;quot;
LABEL description=&amp;quot;This text illustrates \
that label-values can span multiple lines.&amp;quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Docker recommends combining labels in a single &lt;code&gt;LABEL&lt;/code&gt; instruction where
possible. Each &lt;code&gt;LABEL&lt;/code&gt; instruction produces a new layer which can result in an
inefficient image if you use many labels. This example results in four image
layers.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;LABEL multi.label1=&amp;quot;value1&amp;quot; multi.label2=&amp;quot;value2&amp;quot; other=&amp;quot;value3&amp;quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Labels are additive including &lt;code&gt;LABEL&lt;/code&gt;s in &lt;code&gt;FROM&lt;/code&gt; images. As the system
encounters and then applies a new label, new &lt;code&gt;key&lt;/code&gt;s override any previous labels
with identical keys.&lt;/p&gt;
&lt;p&gt;To view an image&amp;rsquo;s labels, use the &lt;code&gt;docker inspect&lt;/code&gt; command.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;quot;Labels&amp;quot;: {
&amp;quot;com.example.vendor&amp;quot;: &amp;quot;ACME Incorporated&amp;quot;
&amp;quot;com.example.label-with-value&amp;quot;: &amp;quot;foo&amp;quot;,
&amp;quot;version&amp;quot;: &amp;quot;1.0&amp;quot;,
&amp;quot;description&amp;quot;: &amp;quot;This text illustrates that label-values can span multiple lines.&amp;quot;,
&amp;quot;multi.label1&amp;quot;: &amp;quot;value1&amp;quot;,
&amp;quot;multi.label2&amp;quot;: &amp;quot;value2&amp;quot;,
&amp;quot;other&amp;quot;: &amp;quot;value3&amp;quot;
},
&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&#34;expose&#34;&gt;EXPOSE&lt;/h2&gt;
&lt;pre&gt;&lt;code&gt;EXPOSE &amp;lt;port&amp;gt; [&amp;lt;port&amp;gt;...]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The &lt;code&gt;EXPOSE&lt;/code&gt; instructions informs Docker that the container will listen on the
specified network ports at runtime. Docker uses this information to interconnect
containers using links (see the &lt;a href=&#34;http://localhost/userguide/dockerlinks&#34;&gt;Docker User
Guide&lt;/a&gt;) and to determine which ports to expose to the
host when &lt;a href=&#34;http://localhost/docker/reference/run/#expose-incoming-ports&#34;&gt;using the -P flag&lt;/a&gt;.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;:
&lt;code&gt;EXPOSE&lt;/code&gt; doesn&amp;rsquo;t define which ports can be exposed to the host or make ports
accessible from the host by default. To expose ports to the host, at runtime,
&lt;a href=&#34;http://localhost/userguide/dockerlinks&#34;&gt;use the &lt;code&gt;-p&lt;/code&gt; flag&lt;/a&gt; or
&lt;a href=&#34;http://localhost/docker/reference/run/#expose-incoming-ports&#34;&gt;the -P flag&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id=&#34;env&#34;&gt;ENV&lt;/h2&gt;
&lt;pre&gt;&lt;code&gt;ENV &amp;lt;key&amp;gt; &amp;lt;value&amp;gt;
ENV &amp;lt;key&amp;gt;=&amp;lt;value&amp;gt; ...
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The &lt;code&gt;ENV&lt;/code&gt; instruction sets the environment variable &lt;code&gt;&amp;lt;key&amp;gt;&lt;/code&gt; to the value
&lt;code&gt;&amp;lt;value&amp;gt;&lt;/code&gt;. This value will be in the environment of all &amp;ldquo;descendent&amp;rdquo; &lt;code&gt;Dockerfile&lt;/code&gt;
commands and can be &lt;a href=&#34;#environment-replacement&#34;&gt;replaced inline&lt;/a&gt; in many as well.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;ENV&lt;/code&gt; instruction has two forms. The first form, &lt;code&gt;ENV &amp;lt;key&amp;gt; &amp;lt;value&amp;gt;&lt;/code&gt;,
will set a single variable to a value. The entire string after the first
space will be treated as the &lt;code&gt;&amp;lt;value&amp;gt;&lt;/code&gt; - including characters such as
spaces and quotes.&lt;/p&gt;
&lt;p&gt;The second form, &lt;code&gt;ENV &amp;lt;key&amp;gt;=&amp;lt;value&amp;gt; ...&lt;/code&gt;, allows for multiple variables to
be set at one time. Notice that the second form uses the equals sign (=)
in the syntax, while the first form does not. Like command line parsing,
quotes and backslashes can be used to include spaces within values.&lt;/p&gt;
&lt;p&gt;For example:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;ENV myName=&amp;quot;John Doe&amp;quot; myDog=Rex\ The\ Dog \
myCat=fluffy
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;and&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;ENV myName John Doe
ENV myDog Rex The Dog
ENV myCat fluffy
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;will yield the same net results in the final container, but the first form
does it all in one layer.&lt;/p&gt;
&lt;p&gt;The environment variables set using &lt;code&gt;ENV&lt;/code&gt; will persist when a container is run
from the resulting image. You can view the values using &lt;code&gt;docker inspect&lt;/code&gt;, and
change them using &lt;code&gt;docker run --env &amp;lt;key&amp;gt;=&amp;lt;value&amp;gt;&lt;/code&gt;.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;:
Environment persistence can cause unexpected effects. For example,
setting &lt;code&gt;ENV DEBIAN_FRONTEND noninteractive&lt;/code&gt; may confuse apt-get
users on a Debian-based image. To set a value for a single command, use
&lt;code&gt;RUN &amp;lt;key&amp;gt;=&amp;lt;value&amp;gt; &amp;lt;command&amp;gt;&lt;/code&gt;.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id=&#34;add&#34;&gt;ADD&lt;/h2&gt;
&lt;p&gt;ADD has two forms:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ADD &amp;lt;src&amp;gt;... &amp;lt;dest&amp;gt;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ADD [&amp;quot;&amp;lt;src&amp;gt;&amp;quot;,... &amp;quot;&amp;lt;dest&amp;gt;&amp;quot;]&lt;/code&gt; (this form is required for paths containing
whitespace)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The &lt;code&gt;ADD&lt;/code&gt; instruction copies new files, directories or remote file URLs from &lt;code&gt;&amp;lt;src&amp;gt;&lt;/code&gt;
and adds them to the filesystem of the container at the path &lt;code&gt;&amp;lt;dest&amp;gt;&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Multiple &lt;code&gt;&amp;lt;src&amp;gt;&lt;/code&gt; resource may be specified but if they are files or
directories then they must be relative to the source directory that is
being built (the context of the build).&lt;/p&gt;
&lt;p&gt;Each &lt;code&gt;&amp;lt;src&amp;gt;&lt;/code&gt; may contain wildcards and matching will be done using Go&amp;rsquo;s
&lt;a href=&#34;http://golang.org/pkg/path/filepath#Match&#34;&gt;filepath.Match&lt;/a&gt; rules.
For most command line uses this should act as expected, for example:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;ADD hom* /mydir/ # adds all files starting with &amp;quot;hom&amp;quot;
ADD hom?.txt /mydir/ # ? is replaced with any single character
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The &lt;code&gt;&amp;lt;dest&amp;gt;&lt;/code&gt; is an absolute path, or a path relative to &lt;code&gt;WORKDIR&lt;/code&gt;, into which
the source will be copied inside the destination container.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;ADD test aDir/ # adds &amp;quot;test&amp;quot; to `WORKDIR`/aDir/
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;All new files and directories are created with a UID and GID of 0.&lt;/p&gt;
&lt;p&gt;In the case where &lt;code&gt;&amp;lt;src&amp;gt;&lt;/code&gt; is a remote file URL, the destination will
have permissions of 600. If the remote file being retrieved has an HTTP
&lt;code&gt;Last-Modified&lt;/code&gt; header, the timestamp from that header will be used
to set the &lt;code&gt;mtime&lt;/code&gt; on the destination file. Then, like any other file
processed during an &lt;code&gt;ADD&lt;/code&gt;, &lt;code&gt;mtime&lt;/code&gt; will be included in the determination
of whether or not the file has changed and the cache should be updated.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;:
If you build by passing a &lt;code&gt;Dockerfile&lt;/code&gt; through STDIN (&lt;code&gt;docker
build - &amp;lt; somefile&lt;/code&gt;), there is no build context, so the &lt;code&gt;Dockerfile&lt;/code&gt;
can only contain a URL based &lt;code&gt;ADD&lt;/code&gt; instruction. You can also pass a
compressed archive through STDIN: (&lt;code&gt;docker build - &amp;lt; archive.tar.gz&lt;/code&gt;),
the &lt;code&gt;Dockerfile&lt;/code&gt; at the root of the archive and the rest of the
archive will get used at the context of the build.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;:
If your URL files are protected using authentication, you
will need to use &lt;code&gt;RUN wget&lt;/code&gt;, &lt;code&gt;RUN curl&lt;/code&gt; or use another tool from
within the container as the &lt;code&gt;ADD&lt;/code&gt; instruction does not support
authentication.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;:
The first encountered &lt;code&gt;ADD&lt;/code&gt; instruction will invalidate the cache for all
following instructions from the Dockerfile if the contents of &lt;code&gt;&amp;lt;src&amp;gt;&lt;/code&gt; have
changed. This includes invalidating the cache for &lt;code&gt;RUN&lt;/code&gt; instructions.
See the &lt;a href=&#34;http://localhost/articles/dockerfile_best-practices/#build-cache&#34;&gt;&lt;code&gt;Dockerfile&lt;/code&gt; Best Practices
guide&lt;/a&gt; for more information.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The copy obeys the following rules:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The &lt;code&gt;&amp;lt;src&amp;gt;&lt;/code&gt; path must be inside the &lt;em&gt;context&lt;/em&gt; of the build;
you cannot &lt;code&gt;ADD ../something /something&lt;/code&gt;, because the first step of a
&lt;code&gt;docker build&lt;/code&gt; is to send the context directory (and subdirectories) to the
docker daemon.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If &lt;code&gt;&amp;lt;src&amp;gt;&lt;/code&gt; is a URL and &lt;code&gt;&amp;lt;dest&amp;gt;&lt;/code&gt; does not end with a trailing slash, then a
file is downloaded from the URL and copied to &lt;code&gt;&amp;lt;dest&amp;gt;&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If &lt;code&gt;&amp;lt;src&amp;gt;&lt;/code&gt; is a URL and &lt;code&gt;&amp;lt;dest&amp;gt;&lt;/code&gt; does end with a trailing slash, then the
filename is inferred from the URL and the file is downloaded to
&lt;code&gt;&amp;lt;dest&amp;gt;/&amp;lt;filename&amp;gt;&lt;/code&gt;. For instance, &lt;code&gt;ADD http://example.com/foobar /&lt;/code&gt; would
create the file &lt;code&gt;/foobar&lt;/code&gt;. The URL must have a nontrivial path so that an
appropriate filename can be discovered in this case (&lt;code&gt;http://example.com&lt;/code&gt;
will not work).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If &lt;code&gt;&amp;lt;src&amp;gt;&lt;/code&gt; is a directory, the entire contents of the directory are copied,
including filesystem metadata.
&amp;gt; &lt;strong&gt;Note&lt;/strong&gt;:
&amp;gt; The directory itself is not copied, just its contents.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If &lt;code&gt;&amp;lt;src&amp;gt;&lt;/code&gt; is a &lt;em&gt;local&lt;/em&gt; tar archive in a recognized compression format
(identity, gzip, bzip2 or xz) then it is unpacked as a directory. Resources
from &lt;em&gt;remote&lt;/em&gt; URLs are &lt;strong&gt;not&lt;/strong&gt; decompressed. When a directory is copied or
unpacked, it has the same behavior as &lt;code&gt;tar -x&lt;/code&gt;: the result is the union of:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Whatever existed at the destination path and&lt;/li&gt;
&lt;li&gt;The contents of the source tree, with conflicts resolved in favor
of &amp;ldquo;2.&amp;rdquo; on a file-by-file basis.&lt;/li&gt;
&lt;/ol&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If &lt;code&gt;&amp;lt;src&amp;gt;&lt;/code&gt; is any other kind of file, it is copied individually along with
its metadata. In this case, if &lt;code&gt;&amp;lt;dest&amp;gt;&lt;/code&gt; ends with a trailing slash &lt;code&gt;/&lt;/code&gt;, it
will be considered a directory and the contents of &lt;code&gt;&amp;lt;src&amp;gt;&lt;/code&gt; will be written
at &lt;code&gt;&amp;lt;dest&amp;gt;/base(&amp;lt;src&amp;gt;)&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If multiple &lt;code&gt;&amp;lt;src&amp;gt;&lt;/code&gt; resources are specified, either directly or due to the
use of a wildcard, then &lt;code&gt;&amp;lt;dest&amp;gt;&lt;/code&gt; must be a directory, and it must end with
a slash &lt;code&gt;/&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If &lt;code&gt;&amp;lt;dest&amp;gt;&lt;/code&gt; does not end with a trailing slash, it will be considered a
regular file and the contents of &lt;code&gt;&amp;lt;src&amp;gt;&lt;/code&gt; will be written at &lt;code&gt;&amp;lt;dest&amp;gt;&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If &lt;code&gt;&amp;lt;dest&amp;gt;&lt;/code&gt; doesn&amp;rsquo;t exist, it is created along with all missing directories
in its path.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;copy&#34;&gt;COPY&lt;/h2&gt;
&lt;p&gt;COPY has two forms:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;COPY &amp;lt;src&amp;gt;... &amp;lt;dest&amp;gt;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;COPY [&amp;quot;&amp;lt;src&amp;gt;&amp;quot;,... &amp;quot;&amp;lt;dest&amp;gt;&amp;quot;]&lt;/code&gt; (this form is required for paths containing
whitespace)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The &lt;code&gt;COPY&lt;/code&gt; instruction copies new files or directories from &lt;code&gt;&amp;lt;src&amp;gt;&lt;/code&gt;
and adds them to the filesystem of the container at the path &lt;code&gt;&amp;lt;dest&amp;gt;&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Multiple &lt;code&gt;&amp;lt;src&amp;gt;&lt;/code&gt; resource may be specified but they must be relative
to the source directory that is being built (the context of the build).&lt;/p&gt;
&lt;p&gt;Each &lt;code&gt;&amp;lt;src&amp;gt;&lt;/code&gt; may contain wildcards and matching will be done using Go&amp;rsquo;s
&lt;a href=&#34;http://golang.org/pkg/path/filepath#Match&#34;&gt;filepath.Match&lt;/a&gt; rules.
For most command line uses this should act as expected, for example:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;COPY hom* /mydir/ # adds all files starting with &amp;quot;hom&amp;quot;
COPY hom?.txt /mydir/ # ? is replaced with any single character
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The &lt;code&gt;&amp;lt;dest&amp;gt;&lt;/code&gt; is an absolute path, or a path relative to &lt;code&gt;WORKDIR&lt;/code&gt;, into which
the source will be copied inside the destination container.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;COPY test aDir/ # adds &amp;quot;test&amp;quot; to `WORKDIR`/aDir/
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;All new files and directories are created with a UID and GID of 0.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;:
If you build using STDIN (&lt;code&gt;docker build - &amp;lt; somefile&lt;/code&gt;), there is no
build context, so &lt;code&gt;COPY&lt;/code&gt; can&amp;rsquo;t be used.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The copy obeys the following rules:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The &lt;code&gt;&amp;lt;src&amp;gt;&lt;/code&gt; path must be inside the &lt;em&gt;context&lt;/em&gt; of the build;
you cannot &lt;code&gt;COPY ../something /something&lt;/code&gt;, because the first step of a
&lt;code&gt;docker build&lt;/code&gt; is to send the context directory (and subdirectories) to the
docker daemon.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If &lt;code&gt;&amp;lt;src&amp;gt;&lt;/code&gt; is a directory, the entire contents of the directory are copied,
including filesystem metadata.
&amp;gt; &lt;strong&gt;Note&lt;/strong&gt;:
&amp;gt; The directory itself is not copied, just its contents.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If &lt;code&gt;&amp;lt;src&amp;gt;&lt;/code&gt; is any other kind of file, it is copied individually along with
its metadata. In this case, if &lt;code&gt;&amp;lt;dest&amp;gt;&lt;/code&gt; ends with a trailing slash &lt;code&gt;/&lt;/code&gt;, it
will be considered a directory and the contents of &lt;code&gt;&amp;lt;src&amp;gt;&lt;/code&gt; will be written
at &lt;code&gt;&amp;lt;dest&amp;gt;/base(&amp;lt;src&amp;gt;)&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If multiple &lt;code&gt;&amp;lt;src&amp;gt;&lt;/code&gt; resources are specified, either directly or due to the
use of a wildcard, then &lt;code&gt;&amp;lt;dest&amp;gt;&lt;/code&gt; must be a directory, and it must end with
a slash &lt;code&gt;/&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If &lt;code&gt;&amp;lt;dest&amp;gt;&lt;/code&gt; does not end with a trailing slash, it will be considered a
regular file and the contents of &lt;code&gt;&amp;lt;src&amp;gt;&lt;/code&gt; will be written at &lt;code&gt;&amp;lt;dest&amp;gt;&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If &lt;code&gt;&amp;lt;dest&amp;gt;&lt;/code&gt; doesn&amp;rsquo;t exist, it is created along with all missing directories
in its path.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;entrypoint&#34;&gt;ENTRYPOINT&lt;/h2&gt;
&lt;p&gt;ENTRYPOINT has two forms:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ENTRYPOINT [&amp;quot;executable&amp;quot;, &amp;quot;param1&amp;quot;, &amp;quot;param2&amp;quot;]&lt;/code&gt;
(the preferred &lt;em&gt;exec&lt;/em&gt; form)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ENTRYPOINT command param1 param2&lt;/code&gt;
(&lt;em&gt;shell&lt;/em&gt; form)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;An &lt;code&gt;ENTRYPOINT&lt;/code&gt; allows you to configure a container that will run as an executable.&lt;/p&gt;
&lt;p&gt;For example, the following will start nginx with its default content, listening
on port 80:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;docker run -i -t --rm -p 80:80 nginx
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Command line arguments to &lt;code&gt;docker run &amp;lt;image&amp;gt;&lt;/code&gt; will be appended after all
elements in an &lt;em&gt;exec&lt;/em&gt; form &lt;code&gt;ENTRYPOINT&lt;/code&gt;, and will override all elements specified
using &lt;code&gt;CMD&lt;/code&gt;.
This allows arguments to be passed to the entry point, i.e., &lt;code&gt;docker run &amp;lt;image&amp;gt; -d&lt;/code&gt;
will pass the &lt;code&gt;-d&lt;/code&gt; argument to the entry point.
You can override the &lt;code&gt;ENTRYPOINT&lt;/code&gt; instruction using the &lt;code&gt;docker run --entrypoint&lt;/code&gt;
flag.&lt;/p&gt;
&lt;p&gt;The &lt;em&gt;shell&lt;/em&gt; form prevents any &lt;code&gt;CMD&lt;/code&gt; or &lt;code&gt;run&lt;/code&gt; command line arguments from being
used, but has the disadvantage that your &lt;code&gt;ENTRYPOINT&lt;/code&gt; will be started as a
subcommand of &lt;code&gt;/bin/sh -c&lt;/code&gt;, which does not pass signals.
This means that the executable will not be the container&amp;rsquo;s &lt;code&gt;PID 1&lt;/code&gt; - and
will &lt;em&gt;not&lt;/em&gt; receive Unix signals - so your executable will not receive a
&lt;code&gt;SIGTERM&lt;/code&gt; from &lt;code&gt;docker stop &amp;lt;container&amp;gt;&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Only the last &lt;code&gt;ENTRYPOINT&lt;/code&gt; instruction in the &lt;code&gt;Dockerfile&lt;/code&gt; will have an effect.&lt;/p&gt;
&lt;h3 id=&#34;exec-form-entrypoint-example&#34;&gt;Exec form ENTRYPOINT example&lt;/h3&gt;
&lt;p&gt;You can use the &lt;em&gt;exec&lt;/em&gt; form of &lt;code&gt;ENTRYPOINT&lt;/code&gt; to set fairly stable default commands
and arguments and then use either form of &lt;code&gt;CMD&lt;/code&gt; to set additional defaults that
are more likely to be changed.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;FROM ubuntu
ENTRYPOINT [&amp;quot;top&amp;quot;, &amp;quot;-b&amp;quot;]
CMD [&amp;quot;-c&amp;quot;]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;When you run the container, you can see that &lt;code&gt;top&lt;/code&gt; is the only process:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ docker run -it --rm --name test top -H
top - 08:25:00 up 7:27, 0 users, load average: 0.00, 0.01, 0.05
Threads: 1 total, 1 running, 0 sleeping, 0 stopped, 0 zombie
%Cpu(s): 0.1 us, 0.1 sy, 0.0 ni, 99.7 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
KiB Mem: 2056668 total, 1616832 used, 439836 free, 99352 buffers
KiB Swap: 1441840 total, 0 used, 1441840 free. 1324440 cached Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1 root 20 0 19744 2336 2080 R 0.0 0.1 0:00.04 top
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To examine the result further, you can use &lt;code&gt;docker exec&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ docker exec -it test ps aux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 2.6 0.1 19752 2352 ? Ss+ 08:24 0:00 top -b -H
root 7 0.0 0.1 15572 2164 ? R+ 08:25 0:00 ps aux
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And you can gracefully request &lt;code&gt;top&lt;/code&gt; to shut down using &lt;code&gt;docker stop test&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The following &lt;code&gt;Dockerfile&lt;/code&gt; shows using the &lt;code&gt;ENTRYPOINT&lt;/code&gt; to run Apache in the
foreground (i.e., as &lt;code&gt;PID 1&lt;/code&gt;):&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;FROM debian:stable
RUN apt-get update &amp;amp;&amp;amp; apt-get install -y --force-yes apache2
EXPOSE 80 443
VOLUME [&amp;quot;/var/www&amp;quot;, &amp;quot;/var/log/apache2&amp;quot;, &amp;quot;/etc/apache2&amp;quot;]
ENTRYPOINT [&amp;quot;/usr/sbin/apache2ctl&amp;quot;, &amp;quot;-D&amp;quot;, &amp;quot;FOREGROUND&amp;quot;]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If you need to write a starter script for a single executable, you can ensure that
the final executable receives the Unix signals by using &lt;code&gt;exec&lt;/code&gt; and &lt;code&gt;gosu&lt;/code&gt;
commands:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&#34;language-bash&#34;&gt;#!/bin/bash
set -e
if [ &amp;quot;$1&amp;quot; = &#39;postgres&#39; ]; then
chown -R postgres &amp;quot;$PGDATA&amp;quot;
if [ -z &amp;quot;$(ls -A &amp;quot;$PGDATA&amp;quot;)&amp;quot; ]; then
gosu postgres initdb
fi
exec gosu postgres &amp;quot;$@&amp;quot;
fi
exec &amp;quot;$@&amp;quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Lastly, if you need to do some extra cleanup (or communicate with other containers)
on shutdown, or are co-ordinating more than one executable, you may need to ensure
that the &lt;code&gt;ENTRYPOINT&lt;/code&gt; script receives the Unix signals, passes them on, and then
does some more work:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#!/bin/sh
# Note: I&#39;ve written this using sh so it works in the busybox container too
# USE the trap if you need to also do manual cleanup after the service is stopped,
# or need to start multiple services in the one container
trap &amp;quot;echo TRAPed signal&amp;quot; HUP INT QUIT KILL TERM
# start service in background here
/usr/sbin/apachectl start
echo &amp;quot;[hit enter key to exit] or run &#39;docker stop &amp;lt;container&amp;gt;&#39;&amp;quot;
read
# stop service and clean up here
echo &amp;quot;stopping apache&amp;quot;
/usr/sbin/apachectl stop
echo &amp;quot;exited $0&amp;quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If you run this image with &lt;code&gt;docker run -it --rm -p 80:80 --name test apache&lt;/code&gt;,
you can then examine the container&amp;rsquo;s processes with &lt;code&gt;docker exec&lt;/code&gt;, or &lt;code&gt;docker top&lt;/code&gt;,
and then ask the script to stop Apache:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&#34;language-bash&#34;&gt;$ docker exec -it test ps aux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.1 0.0 4448 692 ? Ss+ 00:42 0:00 /bin/sh /run.sh 123 cmd cmd2
root 19 0.0 0.2 71304 4440 ? Ss 00:42 0:00 /usr/sbin/apache2 -k start
www-data 20 0.2 0.2 360468 6004 ? Sl 00:42 0:00 /usr/sbin/apache2 -k start
www-data 21 0.2 0.2 360468 6000 ? Sl 00:42 0:00 /usr/sbin/apache2 -k start
root 81 0.0 0.1 15572 2140 ? R+ 00:44 0:00 ps aux
$ docker top test
PID USER COMMAND
10035 root {run.sh} /bin/sh /run.sh 123 cmd cmd2
10054 root /usr/sbin/apache2 -k start
10055 33 /usr/sbin/apache2 -k start
10056 33 /usr/sbin/apache2 -k start
$ /usr/bin/time docker stop test
test
real 0m 0.27s
user 0m 0.03s
sys 0m 0.03s
&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; you can over ride the &lt;code&gt;ENTRYPOINT&lt;/code&gt; setting using &lt;code&gt;--entrypoint&lt;/code&gt;,
but this can only set the binary to &lt;em&gt;exec&lt;/em&gt; (no &lt;code&gt;sh -c&lt;/code&gt; will be used).&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;:
The &lt;em&gt;exec&lt;/em&gt; form is parsed as a JSON array, which means that
you must use double-quotes (&amp;ldquo;) around words not single-quotes (&amp;lsquo;).&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;:
Unlike the &lt;em&gt;shell&lt;/em&gt; form, the &lt;em&gt;exec&lt;/em&gt; form does not invoke a command shell.
This means that normal shell processing does not happen. For example,
&lt;code&gt;ENTRYPOINT [ &amp;quot;echo&amp;quot;, &amp;quot;$HOME&amp;quot; ]&lt;/code&gt; will not do variable substitution on &lt;code&gt;$HOME&lt;/code&gt;.
If you want shell processing then either use the &lt;em&gt;shell&lt;/em&gt; form or execute
a shell directly, for example: &lt;code&gt;ENTRYPOINT [ &amp;quot;sh&amp;quot;, &amp;quot;-c&amp;quot;, &amp;quot;echo&amp;quot;, &amp;quot;$HOME&amp;quot; ]&lt;/code&gt;.
Variables that are defined in the &lt;code&gt;Dockerfile&lt;/code&gt;using &lt;code&gt;ENV&lt;/code&gt;, will be substituted by
the &lt;code&gt;Dockerfile&lt;/code&gt; parser.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3 id=&#34;shell-form-entrypoint-example&#34;&gt;Shell form ENTRYPOINT example&lt;/h3&gt;
&lt;p&gt;You can specify a plain string for the &lt;code&gt;ENTRYPOINT&lt;/code&gt; and it will execute in &lt;code&gt;/bin/sh -c&lt;/code&gt;.
This form will use shell processing to substitute shell environment variables,
and will ignore any &lt;code&gt;CMD&lt;/code&gt; or &lt;code&gt;docker run&lt;/code&gt; command line arguments.
To ensure that &lt;code&gt;docker stop&lt;/code&gt; will signal any long running &lt;code&gt;ENTRYPOINT&lt;/code&gt; executable
correctly, you need to remember to start it with &lt;code&gt;exec&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;FROM ubuntu
ENTRYPOINT exec top -b
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;When you run this image, you&amp;rsquo;ll see the single &lt;code&gt;PID 1&lt;/code&gt; process:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ docker run -it --rm --name test top
Mem: 1704520K used, 352148K free, 0K shrd, 0K buff, 140368121167873K cached
CPU: 5% usr 0% sys 0% nic 94% idle 0% io 0% irq 0% sirq
Load average: 0.08 0.03 0.05 2/98 6
PID PPID USER STAT VSZ %VSZ %CPU COMMAND
1 0 root R 3164 0% 0% top -b
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Which will exit cleanly on &lt;code&gt;docker stop&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ /usr/bin/time docker stop test
test
real 0m 0.20s
user 0m 0.02s
sys 0m 0.04s
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If you forget to add &lt;code&gt;exec&lt;/code&gt; to the beginning of your &lt;code&gt;ENTRYPOINT&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;FROM ubuntu
ENTRYPOINT top -b
CMD --ignored-param1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You can then run it (giving it a name for the next step):&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ docker run -it --name test top --ignored-param2
Mem: 1704184K used, 352484K free, 0K shrd, 0K buff, 140621524238337K cached
CPU: 9% usr 2% sys 0% nic 88% idle 0% io 0% irq 0% sirq
Load average: 0.01 0.02 0.05 2/101 7
PID PPID USER STAT VSZ %VSZ %CPU COMMAND
1 0 root S 3168 0% 0% /bin/sh -c top -b cmd cmd2
7 1 root R 3164 0% 0% top -b
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You can see from the output of &lt;code&gt;top&lt;/code&gt; that the specified &lt;code&gt;ENTRYPOINT&lt;/code&gt; is not &lt;code&gt;PID 1&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;If you then run &lt;code&gt;docker stop test&lt;/code&gt;, the container will not exit cleanly - the
&lt;code&gt;stop&lt;/code&gt; command will be forced to send a &lt;code&gt;SIGKILL&lt;/code&gt; after the timeout:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ docker exec -it test ps aux
PID USER COMMAND
1 root /bin/sh -c top -b cmd cmd2
7 root top -b
8 root ps aux
$ /usr/bin/time docker stop test
test
real 0m 10.19s
user 0m 0.04s
sys 0m 0.03s
&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&#34;volume&#34;&gt;VOLUME&lt;/h2&gt;
&lt;pre&gt;&lt;code&gt;VOLUME [&amp;quot;/data&amp;quot;]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The &lt;code&gt;VOLUME&lt;/code&gt; instruction creates a mount point with the specified name
and marks it as holding externally mounted volumes from native host or other
containers. The value can be a JSON array, &lt;code&gt;VOLUME [&amp;quot;/var/log/&amp;quot;]&lt;/code&gt;, or a plain
string with multiple arguments, such as &lt;code&gt;VOLUME /var/log&lt;/code&gt; or &lt;code&gt;VOLUME /var/log
/var/db&lt;/code&gt;. For more information/examples and mounting instructions via the
Docker client, refer to
&lt;a href=&#34;http://localhost/userguide/dockervolumes/#volume&#34;&gt;&lt;em&gt;Share Directories via Volumes&lt;/em&gt;&lt;/a&gt;
documentation.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;docker run&lt;/code&gt; command initializes the newly created volume with any data
that exists at the specified location within the base image. For example,
consider the following Dockerfile snippet:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;FROM ubuntu
RUN mkdir /myvol
RUN echo &amp;quot;hello world&amp;quot; &amp;gt; /myvol/greeting
VOLUME /myvol
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This Dockerfile results in an image that causes &lt;code&gt;docker run&lt;/code&gt;, to
create a new mount point at &lt;code&gt;/myvol&lt;/code&gt; and copy the &lt;code&gt;greeting&lt;/code&gt; file
into the newly created volume.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;:
The list is parsed as a JSON array, which means that
you must use double-quotes (&amp;ldquo;) around words not single-quotes (&amp;lsquo;).&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id=&#34;user&#34;&gt;USER&lt;/h2&gt;
&lt;pre&gt;&lt;code&gt;USER daemon
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The &lt;code&gt;USER&lt;/code&gt; instruction sets the user name or UID to use when running the image
and for any &lt;code&gt;RUN&lt;/code&gt;, &lt;code&gt;CMD&lt;/code&gt; and &lt;code&gt;ENTRYPOINT&lt;/code&gt; instructions that follow it in the
&lt;code&gt;Dockerfile&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id=&#34;workdir&#34;&gt;WORKDIR&lt;/h2&gt;
&lt;pre&gt;&lt;code&gt;WORKDIR /path/to/workdir
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The &lt;code&gt;WORKDIR&lt;/code&gt; instruction sets the working directory for any &lt;code&gt;RUN&lt;/code&gt;, &lt;code&gt;CMD&lt;/code&gt;,
&lt;code&gt;ENTRYPOINT&lt;/code&gt;, &lt;code&gt;COPY&lt;/code&gt; and &lt;code&gt;ADD&lt;/code&gt; instructions that follow it in the &lt;code&gt;Dockerfile&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;It can be used multiple times in the one &lt;code&gt;Dockerfile&lt;/code&gt;. If a relative path
is provided, it will be relative to the path of the previous &lt;code&gt;WORKDIR&lt;/code&gt;
instruction. For example:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;WORKDIR /a
WORKDIR b
WORKDIR c
RUN pwd
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The output of the final &lt;code&gt;pwd&lt;/code&gt; command in this &lt;code&gt;Dockerfile&lt;/code&gt; would be
&lt;code&gt;/a/b/c&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;WORKDIR&lt;/code&gt; instruction can resolve environment variables previously set using
&lt;code&gt;ENV&lt;/code&gt;. You can only use environment variables explicitly set in the &lt;code&gt;Dockerfile&lt;/code&gt;.
For example:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;ENV DIRPATH /path
WORKDIR $DIRPATH/$DIRNAME
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The output of the final &lt;code&gt;pwd&lt;/code&gt; command in this &lt;code&gt;Dockerfile&lt;/code&gt; would be
&lt;code&gt;/path/$DIRNAME&lt;/code&gt;&lt;/p&gt;
&lt;h2 id=&#34;onbuild&#34;&gt;ONBUILD&lt;/h2&gt;
&lt;pre&gt;&lt;code&gt;ONBUILD [INSTRUCTION]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The &lt;code&gt;ONBUILD&lt;/code&gt; instruction adds to the image a &lt;em&gt;trigger&lt;/em&gt; instruction to
be executed at a later time, when the image is used as the base for
another build. The trigger will be executed in the context of the
downstream build, as if it had been inserted immediately after the
&lt;code&gt;FROM&lt;/code&gt; instruction in the downstream &lt;code&gt;Dockerfile&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Any build instruction can be registered as a trigger.&lt;/p&gt;
&lt;p&gt;This is useful if you are building an image which will be used as a base
to build other images, for example an application build environment or a
daemon which may be customized with user-specific configuration.&lt;/p&gt;
&lt;p&gt;For example, if your image is a reusable Python application builder, it
will require application source code to be added in a particular
directory, and it might require a build script to be called &lt;em&gt;after&lt;/em&gt;
that. You can&amp;rsquo;t just call &lt;code&gt;ADD&lt;/code&gt; and &lt;code&gt;RUN&lt;/code&gt; now, because you don&amp;rsquo;t yet
have access to the application source code, and it will be different for
each application build. You could simply provide application developers
with a boilerplate &lt;code&gt;Dockerfile&lt;/code&gt; to copy-paste into their application, but
that is inefficient, error-prone and difficult to update because it
mixes with application-specific code.&lt;/p&gt;
&lt;p&gt;The solution is to use &lt;code&gt;ONBUILD&lt;/code&gt; to register advance instructions to
run later, during the next build stage.&lt;/p&gt;
&lt;p&gt;Here&amp;rsquo;s how it works:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;When it encounters an &lt;code&gt;ONBUILD&lt;/code&gt; instruction, the builder adds a
trigger to the metadata of the image being built. The instruction
does not otherwise affect the current build.&lt;/li&gt;
&lt;li&gt;At the end of the build, a list of all triggers is stored in the
image manifest, under the key &lt;code&gt;OnBuild&lt;/code&gt;. They can be inspected with
the &lt;code&gt;docker inspect&lt;/code&gt; command.&lt;/li&gt;
&lt;li&gt;Later the image may be used as a base for a new build, using the
&lt;code&gt;FROM&lt;/code&gt; instruction. As part of processing the &lt;code&gt;FROM&lt;/code&gt; instruction,
the downstream builder looks for &lt;code&gt;ONBUILD&lt;/code&gt; triggers, and executes
them in the same order they were registered. If any of the triggers
fail, the &lt;code&gt;FROM&lt;/code&gt; instruction is aborted which in turn causes the
build to fail. If all triggers succeed, the &lt;code&gt;FROM&lt;/code&gt; instruction
completes and the build continues as usual.&lt;/li&gt;
&lt;li&gt;Triggers are cleared from the final image after being executed. In
other words they are not inherited by &amp;ldquo;grand-children&amp;rdquo; builds.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;For example you might add something like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;[...]
ONBUILD ADD . /app/src
ONBUILD RUN /usr/local/bin/python-build --dir /app/src
[...]
&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Warning&lt;/strong&gt;: Chaining &lt;code&gt;ONBUILD&lt;/code&gt; instructions using &lt;code&gt;ONBUILD ONBUILD&lt;/code&gt; isn&amp;rsquo;t allowed.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Warning&lt;/strong&gt;: The &lt;code&gt;ONBUILD&lt;/code&gt; instruction may not trigger &lt;code&gt;FROM&lt;/code&gt; or &lt;code&gt;MAINTAINER&lt;/code&gt; instructions.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id=&#34;dockerfile-examples&#34;&gt;Dockerfile examples&lt;/h2&gt;
&lt;pre&gt;&lt;code&gt;# Nginx
#
# VERSION 0.0.1
FROM ubuntu
MAINTAINER Victor Vieux &amp;lt;victor@docker.com&amp;gt;
LABEL Description=&amp;quot;This image is used to start the foobar executable&amp;quot; Vendor=&amp;quot;ACME Products&amp;quot; Version=&amp;quot;1.0&amp;quot;
RUN apt-get update &amp;amp;&amp;amp; apt-get install -y inotify-tools nginx apache2 openssh-server
# Firefox over VNC
#
# VERSION 0.3
FROM ubuntu
# Install vnc, xvfb in order to create a &#39;fake&#39; display and firefox
RUN apt-get update &amp;amp;&amp;amp; apt-get install -y x11vnc xvfb firefox
RUN mkdir ~/.vnc
# Setup a password
RUN x11vnc -storepasswd 1234 ~/.vnc/passwd
# Autostart firefox (might not be the best way, but it does the trick)
RUN bash -c &#39;echo &amp;quot;firefox&amp;quot; &amp;gt;&amp;gt; /.bashrc&#39;
EXPOSE 5900
CMD [&amp;quot;x11vnc&amp;quot;, &amp;quot;-forever&amp;quot;, &amp;quot;-usepw&amp;quot;, &amp;quot;-create&amp;quot;]
# Multiple images example
#
# VERSION 0.1
FROM ubuntu
RUN echo foo &amp;gt; bar
# Will output something like ===&amp;gt; 907ad6c2736f
FROM ubuntu
RUN echo moo &amp;gt; oink
# Will output something like ===&amp;gt; 695d7793cbe4
# You᾿ll now have two images, 907ad6c2736f with /bar, and 695d7793cbe4 with
# /oink.
&lt;/code&gt;&lt;/pre&gt;
</description>
</item>
<item>
<title>Remote API</title>
<link>http://localhost/reference/api/docker_remote_api/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>http://localhost/reference/api/docker_remote_api/</guid>
<description>
&lt;h1 id=&#34;docker-remote-api&#34;&gt;Docker Remote API&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;By default the Docker daemon listens on &lt;code&gt;unix:///var/run/docker.sock&lt;/code&gt;
and the client must have &lt;code&gt;root&lt;/code&gt; access to interact with the daemon.&lt;/li&gt;
&lt;li&gt;If the Docker daemon is set to use an encrypted TCP socket (&lt;code&gt;--tls&lt;/code&gt;,
or &lt;code&gt;--tlsverify&lt;/code&gt;) as with Boot2Docker 1.3.0, then you need to add extra
parameters to &lt;code&gt;curl&lt;/code&gt; or &lt;code&gt;wget&lt;/code&gt; when making test API requests:
&lt;code&gt;curl --insecure --cert ~/.docker/cert.pem --key ~/.docker/key.pem https://boot2docker:2376/images/json&lt;/code&gt;
or
&lt;code&gt;wget --no-check-certificate --certificate=$DOCKER_CERT_PATH/cert.pem --private-key=$DOCKER_CERT_PATH/key.pem https://boot2docker:2376/images/json -O - -q&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;If a group named &lt;code&gt;docker&lt;/code&gt; exists on your system, docker will apply
ownership of the socket to the group.&lt;/li&gt;
&lt;li&gt;The API tends to be REST, but for some complex commands, like attach
or pull, the HTTP connection is hijacked to transport STDOUT, STDIN,
and STDERR.&lt;/li&gt;
&lt;li&gt;Since API version 1.2, the auth configuration is now handled client
side, so the client has to send the &lt;code&gt;authConfig&lt;/code&gt; as a &lt;code&gt;POST&lt;/code&gt; in &lt;code&gt;/images/(name)/push&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;authConfig, set as the &lt;code&gt;X-Registry-Auth&lt;/code&gt; header, is currently a Base64
encoded (JSON) string with the following structure:
&lt;code&gt;{&amp;quot;username&amp;quot;: &amp;quot;string&amp;quot;, &amp;quot;password&amp;quot;: &amp;quot;string&amp;quot;, &amp;quot;email&amp;quot;: &amp;quot;string&amp;quot;,
&amp;quot;serveraddress&amp;quot; : &amp;quot;string&amp;quot;, &amp;quot;auth&amp;quot;: &amp;quot;&amp;quot;}&lt;/code&gt;. Notice that &lt;code&gt;auth&lt;/code&gt; is to be left
empty, &lt;code&gt;serveraddress&lt;/code&gt; is a domain/ip without protocol, and that double
quotes (instead of single ones) are required.&lt;/li&gt;
&lt;li&gt;The Remote API uses an open schema model. In this model, unknown
properties in incoming messages will be ignored.
Client applications need to take this into account to ensure
they will not break when talking to newer Docker daemons.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The current version of the API is v1.19&lt;/p&gt;
&lt;p&gt;Calling &lt;code&gt;/info&lt;/code&gt; is the same as calling
&lt;code&gt;/v1.19/info&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;You can still call an old version of the API using
&lt;code&gt;/v1.18/info&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id=&#34;docker-events&#34;&gt;Docker Events&lt;/h2&gt;
&lt;p&gt;The following diagram depicts the container states accessible through the API.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;http://localhost/docker/reference/api/images/event_state.png&#34; alt=&#34;States&#34; /&gt;
&lt;/p&gt;
&lt;p&gt;Some container-related events are not affected by container state, so they are not included in this diagram. These events are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;export&lt;/strong&gt; emitted by &lt;code&gt;docker export&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;exec_create&lt;/strong&gt; emitted by &lt;code&gt;docker exec&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;exec_start&lt;/strong&gt; emitted by &lt;code&gt;docker exec&lt;/code&gt; after &lt;strong&gt;exec_create&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Running &lt;code&gt;docker rmi&lt;/code&gt; emits an &lt;strong&gt;untag&lt;/strong&gt; event when removing an image name. The &lt;code&gt;rmi&lt;/code&gt; command may also emit &lt;strong&gt;delete&lt;/strong&gt; events when images are deleted by ID directly or by deleting the last tag referring to the image.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Acknowledgement&lt;/strong&gt;: This diagram and the accompanying text were used with the permission of Matt Good and Gilder Labs. See Matt&amp;rsquo;s original blog post &lt;a href=&#34;http://gliderlabs.com/blog/2015/04/14/docker-events-explained/&#34;&gt;Docker Events Explained&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id=&#34;v1-19&#34;&gt;v1.19&lt;/h2&gt;
&lt;h3 id=&#34;full-documentation&#34;&gt;Full documentation&lt;/h3&gt;
&lt;p&gt;&lt;a href=&#34;http://localhost/docker/reference/api/docker_remote_api_v1.19/&#34;&gt;&lt;em&gt;Docker Remote API v1.19&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&#34;what-s-new&#34;&gt;What&amp;rsquo;s new&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;New!&lt;/strong&gt;
When the daemon detects a version mismatch with the client, usually when
the client is newer than the daemon, an HTTP 400 is now returned instead
of a 404.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;GET /containers/(id)/stats&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;New!&lt;/strong&gt;
You can now supply a &lt;code&gt;stream&lt;/code&gt; bool to get only one set of stats and
disconnect&lt;/p&gt;
&lt;p&gt;&lt;code&gt;GET /containers(id)/logs&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;New!&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;This endpoint now accepts a &lt;code&gt;since&lt;/code&gt; timestamp parameter.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;GET /info&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;New!&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The fields &lt;code&gt;Debug&lt;/code&gt;, &lt;code&gt;IPv4Forwarding&lt;/code&gt;, &lt;code&gt;MemoryLimit&lt;/code&gt;, and &lt;code&gt;SwapLimit&lt;/code&gt;
are now returned as boolean instead of as an int.&lt;/p&gt;
&lt;p&gt;In addition, the end point now returns the new boolean fields
&lt;code&gt;CpuCfsPeriod&lt;/code&gt;, &lt;code&gt;CpuCfsQuota&lt;/code&gt;, and &lt;code&gt;OomKillDisable&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id=&#34;v1-18&#34;&gt;v1.18&lt;/h2&gt;
&lt;h3 id=&#34;full-documentation-1&#34;&gt;Full documentation&lt;/h3&gt;
&lt;p&gt;&lt;a href=&#34;http://localhost/docker/reference/api/docker_remote_api_v1.18/&#34;&gt;&lt;em&gt;Docker Remote API v1.18&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&#34;what-s-new-1&#34;&gt;What&amp;rsquo;s new&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /version&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;New!&lt;/strong&gt;
This endpoint now returns &lt;code&gt;Os&lt;/code&gt;, &lt;code&gt;Arch&lt;/code&gt; and &lt;code&gt;KernelVersion&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;POST /containers/create&lt;/code&gt;
&lt;code&gt;POST /containers/(id)/start&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;New!&lt;/strong&gt;
You can set ulimit settings to be used within the container.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;GET /info&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;New!&lt;/strong&gt;
This endpoint now returns &lt;code&gt;SystemTime&lt;/code&gt;, &lt;code&gt;HttpProxy&lt;/code&gt;,&lt;code&gt;HttpsProxy&lt;/code&gt; and &lt;code&gt;NoProxy&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;GET /images/json&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;New!&lt;/strong&gt;
Added a &lt;code&gt;RepoDigests&lt;/code&gt; field to include image digest information.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;POST /build&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;New!&lt;/strong&gt;
Builds can now set resource constraints for all containers created for the build.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;New!&lt;/strong&gt;
(&lt;code&gt;CgroupParent&lt;/code&gt;) can be passed in the host config to setup container cgroups under a specific cgroup.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;POST /build&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;New!&lt;/strong&gt;
Closing the HTTP request will now cause the build to be canceled.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;POST /containers/(id)/exec&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;New!&lt;/strong&gt;
Add &lt;code&gt;Warnings&lt;/code&gt; field to response.&lt;/p&gt;
&lt;h2 id=&#34;v1-17&#34;&gt;v1.17&lt;/h2&gt;
&lt;h3 id=&#34;full-documentation-2&#34;&gt;Full documentation&lt;/h3&gt;
&lt;p&gt;&lt;a href=&#34;http://localhost/docker/reference/api/docker_remote_api_v1.17/&#34;&gt;&lt;em&gt;Docker Remote API v1.17&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&#34;what-s-new-2&#34;&gt;What&amp;rsquo;s new&lt;/h3&gt;
&lt;p&gt;The build supports &lt;code&gt;LABEL&lt;/code&gt; command. Use this to add metadata
to an image. For example you could add data describing the content of an image.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;LABEL &amp;quot;com.example.vendor&amp;quot;=&amp;quot;ACME Incorporated&amp;quot;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;New!&lt;/strong&gt;
&lt;code&gt;POST /containers/(id)/attach&lt;/code&gt; and &lt;code&gt;POST /exec/(id)/start&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;New!&lt;/strong&gt;
Docker client now hints potential proxies about connection hijacking using HTTP Upgrade headers.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;POST /containers/create&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;New!&lt;/strong&gt;
You can set labels on container create describing the container.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;GET /containers/json&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;New!&lt;/strong&gt;
The endpoint returns the labels associated with the containers (&lt;code&gt;Labels&lt;/code&gt;).&lt;/p&gt;
&lt;p&gt;&lt;code&gt;GET /containers/(id)/json&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;New!&lt;/strong&gt;
This endpoint now returns the list current execs associated with the container (&lt;code&gt;ExecIDs&lt;/code&gt;).
This endpoint now returns the container labels (&lt;code&gt;Config.Labels&lt;/code&gt;).&lt;/p&gt;
&lt;p&gt;&lt;code&gt;POST /containers/(id)/rename&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;New!&lt;/strong&gt;
New endpoint to rename a container &lt;code&gt;id&lt;/code&gt; to a new name.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;POST /containers/create&lt;/code&gt;
&lt;code&gt;POST /containers/(id)/start&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;New!&lt;/strong&gt;
(&lt;code&gt;ReadonlyRootfs&lt;/code&gt;) can be passed in the host config to mount the container&amp;rsquo;s
root filesystem as read only.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;GET /containers/(id)/stats&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;New!&lt;/strong&gt;
This endpoint returns a live stream of a container&amp;rsquo;s resource usage statistics.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;GET /images/json&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;New!&lt;/strong&gt;
This endpoint now returns the labels associated with each image (&lt;code&gt;Labels&lt;/code&gt;).&lt;/p&gt;
&lt;h2 id=&#34;v1-16&#34;&gt;v1.16&lt;/h2&gt;
&lt;h3 id=&#34;full-documentation-3&#34;&gt;Full documentation&lt;/h3&gt;
&lt;p&gt;&lt;a href=&#34;http://localhost/docker/reference/api/docker_remote_api_v1.16/&#34;&gt;&lt;em&gt;Docker Remote API v1.16&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&#34;what-s-new-3&#34;&gt;What&amp;rsquo;s new&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /info&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;New!&lt;/strong&gt;
&lt;code&gt;info&lt;/code&gt; now returns the number of CPUs available on the machine (&lt;code&gt;NCPU&lt;/code&gt;),
total memory available (&lt;code&gt;MemTotal&lt;/code&gt;), a user-friendly name describing the running Docker daemon (&lt;code&gt;Name&lt;/code&gt;), a unique ID identifying the daemon (&lt;code&gt;ID&lt;/code&gt;), and
a list of daemon labels (&lt;code&gt;Labels&lt;/code&gt;).&lt;/p&gt;
&lt;p&gt;&lt;code&gt;POST /containers/create&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;New!&lt;/strong&gt;
You can set the new container&amp;rsquo;s MAC address explicitly.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;New!&lt;/strong&gt;
Volumes are now initialized when the container is created.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;POST /containers/(id)/copy&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;New!&lt;/strong&gt;
You can now copy data which is contained in a volume.&lt;/p&gt;
&lt;h2 id=&#34;v1-15&#34;&gt;v1.15&lt;/h2&gt;
&lt;h3 id=&#34;full-documentation-4&#34;&gt;Full documentation&lt;/h3&gt;
&lt;p&gt;&lt;a href=&#34;http://localhost/docker/reference/api/docker_remote_api_v1.15/&#34;&gt;&lt;em&gt;Docker Remote API v1.15&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&#34;what-s-new-4&#34;&gt;What&amp;rsquo;s new&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /containers/create&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;New!&lt;/strong&gt;
It is now possible to set a container&amp;rsquo;s HostConfig when creating a container.
Previously this was only available when starting a container.&lt;/p&gt;
&lt;h2 id=&#34;v1-14&#34;&gt;v1.14&lt;/h2&gt;
&lt;h3 id=&#34;full-documentation-5&#34;&gt;Full documentation&lt;/h3&gt;
&lt;p&gt;&lt;a href=&#34;http://localhost/docker/reference/api/docker_remote_api_v1.14/&#34;&gt;&lt;em&gt;Docker Remote API v1.14&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&#34;what-s-new-5&#34;&gt;What&amp;rsquo;s new&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;DELETE /containers/(id)&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;New!&lt;/strong&gt;
When using &lt;code&gt;force&lt;/code&gt;, the container will be immediately killed with SIGKILL.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;POST /containers/(id)/start&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;New!&lt;/strong&gt;
The &lt;code&gt;hostConfig&lt;/code&gt; option now accepts the field &lt;code&gt;CapAdd&lt;/code&gt;, which specifies a list of capabilities
to add, and the field &lt;code&gt;CapDrop&lt;/code&gt;, which specifies a list of capabilities to drop.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;POST /images/create&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;New!&lt;/strong&gt;
The &lt;code&gt;fromImage&lt;/code&gt; and &lt;code&gt;repo&lt;/code&gt; parameters now supports the &lt;code&gt;repo:tag&lt;/code&gt; format.
Consequently, the &lt;code&gt;tag&lt;/code&gt; parameter is now obsolete. Using the new format and
the &lt;code&gt;tag&lt;/code&gt; parameter at the same time will return an error.&lt;/p&gt;
&lt;h2 id=&#34;v1-13&#34;&gt;v1.13&lt;/h2&gt;
&lt;h3 id=&#34;full-documentation-6&#34;&gt;Full documentation&lt;/h3&gt;
&lt;p&gt;&lt;a href=&#34;http://localhost/docker/reference/api/docker_remote_api_v1.13/&#34;&gt;&lt;em&gt;Docker Remote API v1.13&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&#34;what-s-new-6&#34;&gt;What&amp;rsquo;s new&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /containers/(name)/json&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;New!&lt;/strong&gt;
The &lt;code&gt;HostConfig.Links&lt;/code&gt; field is now filled correctly&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;New!&lt;/strong&gt;
&lt;code&gt;Sockets&lt;/code&gt; parameter added to the &lt;code&gt;/info&lt;/code&gt; endpoint listing all the sockets the
daemon is configured to listen on.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;POST /containers/(name)/start&lt;/code&gt;
&lt;code&gt;POST /containers/(name)/stop&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;New!&lt;/strong&gt;
&lt;code&gt;start&lt;/code&gt; and &lt;code&gt;stop&lt;/code&gt; will now return 304 if the container&amp;rsquo;s status is not modified&lt;/p&gt;
&lt;p&gt;&lt;code&gt;POST /commit&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;New!&lt;/strong&gt;
Added a &lt;code&gt;pause&lt;/code&gt; parameter (default &lt;code&gt;true&lt;/code&gt;) to pause the container during commit&lt;/p&gt;
&lt;h2 id=&#34;v1-12&#34;&gt;v1.12&lt;/h2&gt;
&lt;h3 id=&#34;full-documentation-7&#34;&gt;Full documentation&lt;/h3&gt;
&lt;p&gt;&lt;a href=&#34;http://localhost/docker/reference/api/docker_remote_api_v1.12/&#34;&gt;&lt;em&gt;Docker Remote API v1.12&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&#34;what-s-new-7&#34;&gt;What&amp;rsquo;s new&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /build&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;New!&lt;/strong&gt;
Build now has support for the &lt;code&gt;forcerm&lt;/code&gt; parameter to always remove containers&lt;/p&gt;
&lt;p&gt;&lt;code&gt;GET /containers/(name)/json&lt;/code&gt;
&lt;code&gt;GET /images/(name)/json&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;New!&lt;/strong&gt;
All the JSON keys are now in CamelCase&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;New!&lt;/strong&gt;
Trusted builds are now Automated Builds - &lt;code&gt;is_trusted&lt;/code&gt; is now &lt;code&gt;is_automated&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Removed Insert Endpoint&lt;/strong&gt;
The &lt;code&gt;insert&lt;/code&gt; endpoint has been removed.&lt;/p&gt;
&lt;h2 id=&#34;v1-11&#34;&gt;v1.11&lt;/h2&gt;
&lt;h3 id=&#34;full-documentation-8&#34;&gt;Full documentation&lt;/h3&gt;
&lt;p&gt;&lt;a href=&#34;http://localhost/docker/reference/api/docker_remote_api_v1.11/&#34;&gt;&lt;em&gt;Docker Remote API v1.11&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&#34;what-s-new-8&#34;&gt;What&amp;rsquo;s new&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /_ping&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;New!&lt;/strong&gt;
You can now ping the server via the &lt;code&gt;_ping&lt;/code&gt; endpoint.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;GET /events&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;New!&lt;/strong&gt;
You can now use the &lt;code&gt;-until&lt;/code&gt; parameter to close connection
after timestamp.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;GET /containers/(id)/logs&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;This url is preferred method for getting container logs now.&lt;/p&gt;
&lt;h2 id=&#34;v1-10&#34;&gt;v1.10&lt;/h2&gt;
&lt;h3 id=&#34;full-documentation-9&#34;&gt;Full documentation&lt;/h3&gt;
&lt;p&gt;&lt;a href=&#34;http://localhost/docker/reference/api/docker_remote_api_v1.10/&#34;&gt;&lt;em&gt;Docker Remote API v1.10&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&#34;what-s-new-9&#34;&gt;What&amp;rsquo;s new&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;DELETE /images/(name)&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;New!&lt;/strong&gt;
You can now use the force parameter to force delete of an
image, even if it&amp;rsquo;s tagged in multiple repositories. &lt;strong&gt;New!&lt;/strong&gt;
You
can now use the noprune parameter to prevent the deletion of parent
images&lt;/p&gt;
&lt;p&gt;&lt;code&gt;DELETE /containers/(id)&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;New!&lt;/strong&gt;
You can now use the force parameter to force delete a
container, even if it is currently running&lt;/p&gt;
&lt;h2 id=&#34;v1-9&#34;&gt;v1.9&lt;/h2&gt;
&lt;h3 id=&#34;full-documentation-10&#34;&gt;Full documentation&lt;/h3&gt;
&lt;p&gt;&lt;a href=&#34;http://localhost/docker/reference/api/docker_remote_api_v1.9/&#34;&gt;&lt;em&gt;Docker Remote API v1.9&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&#34;what-s-new-10&#34;&gt;What&amp;rsquo;s new&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /build&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;New!&lt;/strong&gt;
This endpoint now takes a serialized ConfigFile which it
uses to resolve the proper registry auth credentials for pulling the
base image. Clients which previously implemented the version
accepting an AuthConfig object must be updated.&lt;/p&gt;
&lt;h2 id=&#34;v1-8&#34;&gt;v1.8&lt;/h2&gt;
&lt;h3 id=&#34;full-documentation-11&#34;&gt;Full documentation&lt;/h3&gt;
&lt;p&gt;&lt;a href=&#34;http://localhost/docker/reference/api/docker_remote_api_v1.8/&#34;&gt;&lt;em&gt;Docker Remote API v1.8&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&#34;what-s-new-11&#34;&gt;What&amp;rsquo;s new&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /build&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;New!&lt;/strong&gt;
This endpoint now returns build status as json stream. In
case of a build error, it returns the exit status of the failed
command.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;GET /containers/(id)/json&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;New!&lt;/strong&gt;
This endpoint now returns the host config for the
container.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;POST /images/create&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;POST /images/(name)/insert&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;POST /images/(name)/push&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;New!&lt;/strong&gt;
progressDetail object was added in the JSON. It&amp;rsquo;s now
possible to get the current value and the total of the progress
without having to parse the string.&lt;/p&gt;
&lt;h2 id=&#34;v1-7&#34;&gt;v1.7&lt;/h2&gt;
&lt;h3 id=&#34;full-documentation-12&#34;&gt;Full documentation&lt;/h3&gt;
&lt;p&gt;&lt;a href=&#34;http://localhost/docker/reference/api/docker_remote_api_v1.7/&#34;&gt;&lt;em&gt;Docker Remote API v1.7&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&#34;what-s-new-12&#34;&gt;What&amp;rsquo;s new&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /images/json&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;The format of the json returned from this uri changed. Instead of an
entry for each repo/tag on an image, each image is only represented
once, with a nested attribute indicating the repo/tags that apply to
that image.&lt;/p&gt;
&lt;p&gt;Instead of:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;HTTP/1.1 200 OK
Content-Type: application/json
[
{
&amp;quot;VirtualSize&amp;quot;: 131506275,
&amp;quot;Size&amp;quot;: 131506275,
&amp;quot;Created&amp;quot;: 1365714795,
&amp;quot;Id&amp;quot;: &amp;quot;8dbd9e392a964056420e5d58ca5cc376ef18e2de93b5cc90e868a1bbc8318c1c&amp;quot;,
&amp;quot;Tag&amp;quot;: &amp;quot;12.04&amp;quot;,
&amp;quot;Repository&amp;quot;: &amp;quot;ubuntu&amp;quot;
},
{
&amp;quot;VirtualSize&amp;quot;: 131506275,
&amp;quot;Size&amp;quot;: 131506275,
&amp;quot;Created&amp;quot;: 1365714795,
&amp;quot;Id&amp;quot;: &amp;quot;8dbd9e392a964056420e5d58ca5cc376ef18e2de93b5cc90e868a1bbc8318c1c&amp;quot;,
&amp;quot;Tag&amp;quot;: &amp;quot;latest&amp;quot;,
&amp;quot;Repository&amp;quot;: &amp;quot;ubuntu&amp;quot;
},
{
&amp;quot;VirtualSize&amp;quot;: 131506275,
&amp;quot;Size&amp;quot;: 131506275,
&amp;quot;Created&amp;quot;: 1365714795,
&amp;quot;Id&amp;quot;: &amp;quot;8dbd9e392a964056420e5d58ca5cc376ef18e2de93b5cc90e868a1bbc8318c1c&amp;quot;,
&amp;quot;Tag&amp;quot;: &amp;quot;precise&amp;quot;,
&amp;quot;Repository&amp;quot;: &amp;quot;ubuntu&amp;quot;
},
{
&amp;quot;VirtualSize&amp;quot;: 180116135,
&amp;quot;Size&amp;quot;: 24653,
&amp;quot;Created&amp;quot;: 1364102658,
&amp;quot;Id&amp;quot;: &amp;quot;b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc&amp;quot;,
&amp;quot;Tag&amp;quot;: &amp;quot;12.10&amp;quot;,
&amp;quot;Repository&amp;quot;: &amp;quot;ubuntu&amp;quot;
},
{
&amp;quot;VirtualSize&amp;quot;: 180116135,
&amp;quot;Size&amp;quot;: 24653,
&amp;quot;Created&amp;quot;: 1364102658,
&amp;quot;Id&amp;quot;: &amp;quot;b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc&amp;quot;,
&amp;quot;Tag&amp;quot;: &amp;quot;quantal&amp;quot;,
&amp;quot;Repository&amp;quot;: &amp;quot;ubuntu&amp;quot;
}
]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The returned json looks like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;HTTP/1.1 200 OK
Content-Type: application/json
[
{
&amp;quot;RepoTags&amp;quot;: [
&amp;quot;ubuntu:12.04&amp;quot;,
&amp;quot;ubuntu:precise&amp;quot;,
&amp;quot;ubuntu:latest&amp;quot;
],
&amp;quot;Id&amp;quot;: &amp;quot;8dbd9e392a964056420e5d58ca5cc376ef18e2de93b5cc90e868a1bbc8318c1c&amp;quot;,
&amp;quot;Created&amp;quot;: 1365714795,
&amp;quot;Size&amp;quot;: 131506275,
&amp;quot;VirtualSize&amp;quot;: 131506275
},
{
&amp;quot;RepoTags&amp;quot;: [
&amp;quot;ubuntu:12.10&amp;quot;,
&amp;quot;ubuntu:quantal&amp;quot;
],
&amp;quot;ParentId&amp;quot;: &amp;quot;27cf784147099545&amp;quot;,
&amp;quot;Id&amp;quot;: &amp;quot;b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc&amp;quot;,
&amp;quot;Created&amp;quot;: 1364102658,
&amp;quot;Size&amp;quot;: 24653,
&amp;quot;VirtualSize&amp;quot;: 180116135
}
]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;GET /images/viz&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;This URI no longer exists. The &lt;code&gt;images --viz&lt;/code&gt;
output is now generated in the client, using the
&lt;code&gt;/images/json&lt;/code&gt; data.&lt;/p&gt;
&lt;h2 id=&#34;v1-6&#34;&gt;v1.6&lt;/h2&gt;
&lt;h3 id=&#34;full-documentation-13&#34;&gt;Full documentation&lt;/h3&gt;
&lt;p&gt;&lt;a href=&#34;http://localhost/docker/reference/api/docker_remote_api_v1.6/&#34;&gt;&lt;em&gt;Docker Remote API v1.6&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&#34;what-s-new-13&#34;&gt;What&amp;rsquo;s new&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /containers/(id)/attach&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;New!&lt;/strong&gt;
You can now split stderr from stdout. This is done by
prefixing a header to each transmission. See
&lt;a href=&#34;http://localhost/reference/api/docker_remote_api_v1.9/#attach-to-a-container &amp;quot;POST /containers/(id&#34;&gt;&lt;code&gt;POST /containers/(id)/attach&lt;/code&gt;&lt;/a&gt;/attach&amp;rdquo;).
The WebSocket attach is unchanged. Note that attach calls on the
previous API version didn&amp;rsquo;t change. Stdout and stderr are merged.&lt;/p&gt;
&lt;h2 id=&#34;v1-5&#34;&gt;v1.5&lt;/h2&gt;
&lt;h3 id=&#34;full-documentation-14&#34;&gt;Full documentation&lt;/h3&gt;
&lt;p&gt;&lt;a href=&#34;http://localhost/docker/reference/api/docker_remote_api_v1.5/&#34;&gt;&lt;em&gt;Docker Remote API v1.5&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&#34;what-s-new-14&#34;&gt;What&amp;rsquo;s new&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /images/create&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;New!&lt;/strong&gt;
You can now pass registry credentials (via an AuthConfig
object) through the X-Registry-Auth header&lt;/p&gt;
&lt;p&gt;&lt;code&gt;POST /images/(name)/push&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;New!&lt;/strong&gt;
The AuthConfig object now needs to be passed through the
X-Registry-Auth header&lt;/p&gt;
&lt;p&gt;&lt;code&gt;GET /containers/json&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;New!&lt;/strong&gt;
The format of the Ports entry has been changed to a list of
dicts each containing PublicPort, PrivatePort and Type describing a
port mapping.&lt;/p&gt;
&lt;h2 id=&#34;v1-4&#34;&gt;v1.4&lt;/h2&gt;
&lt;h3 id=&#34;full-documentation-15&#34;&gt;Full documentation&lt;/h3&gt;
&lt;p&gt;&lt;a href=&#34;http://localhost/docker/reference/api/docker_remote_api_v1.4/&#34;&gt;&lt;em&gt;Docker Remote API v1.4&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&#34;what-s-new-15&#34;&gt;What&amp;rsquo;s new&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /images/create&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;New!&lt;/strong&gt;
When pulling a repo, all images are now downloaded in parallel.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;GET /containers/(id)/top&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;New!&lt;/strong&gt;
You can now use ps args with docker top, like docker top
&lt;container_id&gt; aux&lt;/p&gt;
&lt;p&gt;&lt;code&gt;GET /events&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;New!&lt;/strong&gt;
Image&amp;rsquo;s name added in the events&lt;/p&gt;
&lt;h2 id=&#34;v1-3&#34;&gt;v1.3&lt;/h2&gt;
&lt;p&gt;docker v0.5.0
&lt;a href=&#34;https://github.com/docker/docker/commit/51f6c4a7372450d164c61e0054daf0223ddbd909&#34;&gt;51f6c4a&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&#34;full-documentation-16&#34;&gt;Full documentation&lt;/h3&gt;
&lt;p&gt;&lt;a href=&#34;http://localhost/docker/reference/api/docker_remote_api_v1.3/&#34;&gt;&lt;em&gt;Docker Remote API v1.3&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&#34;what-s-new-16&#34;&gt;What&amp;rsquo;s new&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /containers/(id)/top&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;List the processes running inside a container.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;GET /events&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;New!&lt;/strong&gt;
Monitor docker&amp;rsquo;s events via streaming or via polling&lt;/p&gt;
&lt;p&gt;Builder (/build):&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Simplify the upload of the build context&lt;/li&gt;
&lt;li&gt;Simply stream a tarball instead of multipart upload with 4
intermediary buffers&lt;/li&gt;
&lt;li&gt;Simpler, less memory usage, less disk usage and faster&lt;/li&gt;
&lt;/ul&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Warning&lt;/strong&gt;:
The /build improvements are not reverse-compatible. Pre 1.3 clients will
break on /build.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;List containers (/containers/json):&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;You can use size=1 to get the size of the containers&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Start containers (/containers/&lt;id&gt;/start):&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;You can now pass host-specific configuration (e.g., bind mounts) in
the POST body for start calls&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;v1-2&#34;&gt;v1.2&lt;/h2&gt;
&lt;p&gt;docker v0.4.2
&lt;a href=&#34;https://github.com/docker/docker/commit/2e7649beda7c820793bd46766cbc2cfeace7b168&#34;&gt;2e7649b&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&#34;full-documentation-17&#34;&gt;Full documentation&lt;/h3&gt;
&lt;p&gt;&lt;a href=&#34;http://localhost/docker/reference/api/docker_remote_api_v1.2/&#34;&gt;&lt;em&gt;Docker Remote API v1.2&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&#34;what-s-new-17&#34;&gt;What&amp;rsquo;s new&lt;/h3&gt;
&lt;p&gt;The auth configuration is now handled by the client.&lt;/p&gt;
&lt;p&gt;The client should send it&amp;rsquo;s authConfig as POST on each call of
&lt;code&gt;/images/(name)/push&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;GET /auth&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Deprecated.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;POST /auth&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Only checks the configuration but doesn&amp;rsquo;t store it on the server&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Deleting an image is now improved, will only untag the image if it
has children and remove all the untagged parents if has any.
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;POST /images/&amp;lt;name&amp;gt;/delete&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Now returns a JSON structure with the list of images
deleted/untagged.&lt;/p&gt;
&lt;h2 id=&#34;v1-1&#34;&gt;v1.1&lt;/h2&gt;
&lt;p&gt;docker v0.4.0
&lt;a href=&#34;https://github.com/docker/docker/commit/a8ae398bf52e97148ee7bd0d5868de2e15bd297f&#34;&gt;a8ae398&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&#34;full-documentation-18&#34;&gt;Full documentation&lt;/h3&gt;
&lt;p&gt;&lt;a href=&#34;http://localhost/docker/reference/api/docker_remote_api_v1.1/&#34;&gt;&lt;em&gt;Docker Remote API v1.1&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&#34;what-s-new-18&#34;&gt;What&amp;rsquo;s new&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /images/create&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;POST /images/(name)/insert&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;POST /images/(name)/push&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Uses json stream instead of HTML hijack, it looks like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
{&amp;quot;status&amp;quot;:&amp;quot;Pushing...&amp;quot;}
{&amp;quot;status&amp;quot;:&amp;quot;Pushing&amp;quot;, &amp;quot;progress&amp;quot;:&amp;quot;1/? (n/a)&amp;quot;}
{&amp;quot;error&amp;quot;:&amp;quot;Invalid...&amp;quot;}
...
&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&#34;v1-0&#34;&gt;v1.0&lt;/h2&gt;
&lt;p&gt;docker v0.3.4
&lt;a href=&#34;https://github.com/docker/docker/commit/8d73740343778651c09160cde9661f5f387b36f4&#34;&gt;8d73740&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&#34;full-documentation-19&#34;&gt;Full documentation&lt;/h3&gt;
&lt;p&gt;&lt;a href=&#34;http://localhost/docker/reference/api/docker_remote_api_v1.0/&#34;&gt;&lt;em&gt;Docker Remote API v1.0&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&#34;what-s-new-19&#34;&gt;What&amp;rsquo;s new&lt;/h3&gt;
&lt;p&gt;Initial version&lt;/p&gt;
</description>
</item>
<item>
<title>Remote API client libraries</title>
<link>http://localhost/reference/api/remote_api_client_libraries/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>http://localhost/reference/api/remote_api_client_libraries/</guid>
<description>
&lt;h1 id=&#34;docker-remote-api-client-libraries&#34;&gt;Docker Remote API client libraries&lt;/h1&gt;
&lt;p&gt;These libraries have not been tested by the Docker maintainers for
compatibility. Please file issues with the library owners. If you find
more library implementations, please list them in Docker doc bugs and we
will add the libraries here.&lt;/p&gt;
&lt;table border=&#34;1&#34; class=&#34;docutils&#34;&gt;
&lt;colgroup&gt;
&lt;col width=&#34;24%&#34;&gt;
&lt;col width=&#34;17%&#34;&gt;
&lt;col width=&#34;48%&#34;&gt;
&lt;col width=&#34;11%&#34;&gt;
&lt;/colgroup&gt;
&lt;thead valign=&#34;bottom&#34;&gt;
&lt;tr class=&#34;row-odd&#34;&gt;&lt;th class=&#34;head&#34;&gt;Language/Framework&lt;/th&gt;
&lt;th class=&#34;head&#34;&gt;Name&lt;/th&gt;
&lt;th class=&#34;head&#34;&gt;Repository&lt;/th&gt;
&lt;th class=&#34;head&#34;&gt;Status&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody valign = &#34;top&#34;&gt;
&lt;tr class=&#34;row-even&#34;&gt;
&lt;td&gt;C#&lt;/td&gt;
&lt;td&gt;Docker.DotNet&lt;/td&gt;
&lt;td&gt;&lt;a class=&#34;reference external&#34; href=&#34;https://github.com/ahmetalpbalkan/Docker.DotNet&#34;&gt;https://github.com/ahmetalpbalkan/Docker.DotNet&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Active&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;row-even&#34;&gt;
&lt;td&gt;C++&lt;/td&gt;
&lt;td&gt;lasote/docker_client&lt;/td&gt;
&lt;td&gt;&lt;a class=&#34;reference external&#34; href=&#34;http://www.biicode.com/lasote/docker_client&#34;&gt;http://www.biicode.com/lasote/docker_client (Biicode C++ dependency manager)&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Active&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;row-odd&#34;&gt;
&lt;td&gt;Erlang&lt;/td&gt;
&lt;td&gt;erldocker&lt;/td&gt;
&lt;td&gt;&lt;a class=&#34;reference external&#34; href=&#34;https://github.com/proger/erldocker&#34;&gt;https://github.com/proger/erldocker&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Active&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;row-even&#34;&gt;
&lt;td&gt;Dart&lt;/td&gt;
&lt;td&gt;bwu_docker&lt;/td&gt;
&lt;td&gt;&lt;a class=&#34;reference external&#34; href=&#34;https://github.com/bwu-dart/bwu_docker&#34;&gt;https://github.com/bwu-dart/bwu_docker&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Active&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;row-odd&#34;&gt;
&lt;td&gt;Go&lt;/td&gt;
&lt;td&gt;go-dockerclient&lt;/td&gt;
&lt;td&gt;&lt;a class=&#34;reference external&#34; href=&#34;https://github.com/fsouza/go-dockerclient&#34;&gt;https://github.com/fsouza/go-dockerclient&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Active&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;row-even&#34;&gt;
&lt;td&gt;Go&lt;/td&gt;
&lt;td&gt;dockerclient&lt;/td&gt;
&lt;td&gt;&lt;a class=&#34;reference external&#34; href=&#34;https://github.com/samalba/dockerclient&#34;&gt;https://github.com/samalba/dockerclient&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Active&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;row-odd&#34;&gt;
&lt;td&gt;Groovy&lt;/td&gt;
&lt;td&gt;docker-client&lt;/td&gt;
&lt;td&gt;&lt;a class=&#34;reference external&#34; href=&#34;https://github.com/gesellix-docker/docker-client&#34;&gt;https://github.com/gesellix-docker/docker-client&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Active&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;row-even&#34;&gt;
&lt;td&gt;Haskell&lt;/td&gt;
&lt;td&gt;docker-hs&lt;/td&gt;
&lt;td&gt;&lt;a class=&#34;reference external&#34; href=&#34;https://github.com/denibertovic/docker-hs&#34;&gt;https://github.com/denibertovic/docker-hs&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Active&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;row-odd&#34;&gt;
&lt;td&gt;Java&lt;/td&gt;
&lt;td&gt;docker-java&lt;/td&gt;
&lt;td&gt;&lt;a class=&#34;reference external&#34; href=&#34;https://github.com/docker-java/docker-java&#34;&gt;https://github.com/docker-java/docker-java&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Active&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;row-even&#34;&gt;
&lt;td&gt;Java&lt;/td&gt;
&lt;td&gt;docker-client&lt;/td&gt;
&lt;td&gt;&lt;a class=&#34;reference external&#34; href=&#34;https://github.com/spotify/docker-client&#34;&gt;https://github.com/spotify/docker-client&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Active&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;row-odd&#34;&gt;
&lt;td&gt;Java&lt;/td&gt;
&lt;td&gt;jclouds-docker&lt;/td&gt;
&lt;td&gt;&lt;a class=&#34;reference external&#34; href=&#34;https://github.com/jclouds/jclouds-labs/tree/master/docker&#34;&gt;https://github.com/jclouds/jclouds-labs/tree/master/docker&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Active&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;row-even&#34;&gt;
&lt;td&gt;JavaScript (NodeJS)&lt;/td&gt;
&lt;td&gt;dockerode&lt;/td&gt;
&lt;td&gt;&lt;a class=&#34;reference external&#34; href=&#34;https://github.com/apocas/dockerode&#34;&gt;https://github.com/apocas/dockerode&lt;/a&gt;
Install via NPM: &lt;cite&gt;npm install dockerode&lt;/cite&gt;&lt;/td&gt;
&lt;td&gt;Active&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;row-odd&#34;&gt;
&lt;td&gt;JavaScript (NodeJS)&lt;/td&gt;
&lt;td&gt;docker.io&lt;/td&gt;
&lt;td&gt;&lt;a class=&#34;reference external&#34; href=&#34;https://github.com/appersonlabs/docker.io&#34;&gt;https://github.com/appersonlabs/docker.io&lt;/a&gt;
Install via NPM: &lt;cite&gt;npm install docker.io&lt;/cite&gt;&lt;/td&gt;
&lt;td&gt;Active&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;row-even&#34;&gt;
&lt;td&gt;JavaScript&lt;/td&gt;
&lt;td&gt;docker-js&lt;/td&gt;
&lt;td&gt;&lt;a class=&#34;reference external&#34; href=&#34;https://github.com/dgoujard/docker-js&#34;&gt;https://github.com/dgoujard/docker-js&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Outdated&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;row-odd&#34;&gt;
&lt;td&gt;JavaScript (Angular) &lt;strong&gt;WebUI&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;docker-cp&lt;/td&gt;
&lt;td&gt;&lt;a class=&#34;reference external&#34; href=&#34;https://github.com/13W/docker-cp&#34;&gt;https://github.com/13W/docker-cp&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Active&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;row-even&#34;&gt;
&lt;td&gt;JavaScript (Angular) &lt;strong&gt;WebUI&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;dockerui&lt;/td&gt;
&lt;td&gt;&lt;a class=&#34;reference external&#34; href=&#34;https://github.com/crosbymichael/dockerui&#34;&gt;https://github.com/crosbymichael/dockerui&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Active&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;row-odd&#34;&gt;
&lt;td&gt;Perl&lt;/td&gt;
&lt;td&gt;Net::Docker&lt;/td&gt;
&lt;td&gt;&lt;a class=&#34;reference external&#34; href=&#34;https://metacpan.org/pod/Net::Docker&#34;&gt;https://metacpan.org/pod/Net::Docker&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Active&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;row-even&#34;&gt;
&lt;td&gt;Perl&lt;/td&gt;
&lt;td&gt;Eixo::Docker&lt;/td&gt;
&lt;td&gt;&lt;a class=&#34;reference external&#34; href=&#34;https://github.com/alambike/eixo-docker&#34;&gt;https://github.com/alambike/eixo-docker&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Active&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;row-odd&#34;&gt;
&lt;td&gt;PHP&lt;/td&gt;
&lt;td&gt;Alvine&lt;/td&gt;
&lt;td&gt;&lt;a class=&#34;reference external&#34; href=&#34;http://pear.alvine.io/&#34;&gt;http://pear.alvine.io/&lt;/a&gt; (alpha)&lt;/td&gt;
&lt;td&gt;Active&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;row-even&#34;&gt;
&lt;td&gt;PHP&lt;/td&gt;
&lt;td&gt;Docker-PHP&lt;/td&gt;
&lt;td&gt;&lt;a class=&#34;reference external&#34; href=&#34;http://stage1.github.io/docker-php/&#34;&gt;http://stage1.github.io/docker-php/&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Active&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;row-odd&#34;&gt;
&lt;td&gt;Python&lt;/td&gt;
&lt;td&gt;docker-py&lt;/td&gt;
&lt;td&gt;&lt;a class=&#34;reference external&#34; href=&#34;https://github.com/docker/docker-py&#34;&gt;https://github.com/docker/docker-py&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Active&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;row-even&#34;&gt;
&lt;td&gt;Ruby&lt;/td&gt;
&lt;td&gt;docker-api&lt;/td&gt;
&lt;td&gt;&lt;a class=&#34;reference external&#34; href=&#34;https://github.com/swipely/docker-api&#34;&gt;https://github.com/swipely/docker-api&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Active&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;row-odd&#34;&gt;
&lt;td&gt;Ruby&lt;/td&gt;
&lt;td&gt;docker-client&lt;/td&gt;
&lt;td&gt;&lt;a class=&#34;reference external&#34; href=&#34;https://github.com/geku/docker-client&#34;&gt;https://github.com/geku/docker-client&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Outdated&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;row-even&#34;&gt;
&lt;td&gt;Rust&lt;/td&gt;
&lt;td&gt;docker-rust&lt;/td&gt;
&lt;td&gt;&lt;a class=&#34;reference external&#34; href=&#34;https://github.com/abh1nav/docker-rust&#34;&gt;https://github.com/abh1nav/docker-rust&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Active&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;row-odd&#34;&gt;
&lt;td&gt;Scala&lt;/td&gt;
&lt;td&gt;tugboat&lt;/td&gt;
&lt;td&gt;&lt;a class=&#34;reference external&#34; href=&#34;https://github.com/softprops/tugboat&#34;&gt;https://github.com/softprops/tugboat&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Active&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;row-even&#34;&gt;
&lt;td&gt;Scala&lt;/td&gt;
&lt;td&gt;reactive-docker&lt;/td&gt;
&lt;td&gt;&lt;a class=&#34;reference external&#34; href=&#34;https://github.com/almoehi/reactive-docker&#34;&gt;https://github.com/almoehi/reactive-docker&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Active&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
</description>
</item>
<item>
<title>Remote API v1.14</title>
<link>http://localhost/reference/api/docker_remote_api_v1.14/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>http://localhost/reference/api/docker_remote_api_v1.14/</guid>
<description>
&lt;h1 id=&#34;docker-remote-api-v1-14&#34;&gt;Docker Remote API v1.14&lt;/h1&gt;
&lt;h2 id=&#34;1-brief-introduction&#34;&gt;1. Brief introduction&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;The Remote API has replaced &lt;code&gt;rcli&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The daemon listens on &lt;code&gt;unix:///var/run/docker.sock&lt;/code&gt; but you can
&lt;a href=&#34;http://localhost/articles/basics/#bind-docker-to-another-hostport-or-a-unix-socket&#34;&gt;Bind Docker to another host/port or a Unix socket&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;The API tends to be REST, but for some complex commands, like &lt;code&gt;attach&lt;/code&gt;
or &lt;code&gt;pull&lt;/code&gt;, the HTTP connection is hijacked to transport &lt;code&gt;STDOUT&lt;/code&gt;,
&lt;code&gt;STDIN&lt;/code&gt; and &lt;code&gt;STDERR&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;h1 id=&#34;2-endpoints&#34;&gt;2. Endpoints&lt;/h1&gt;
&lt;h2 id=&#34;2-1-containers&#34;&gt;2.1 Containers&lt;/h2&gt;
&lt;h3 id=&#34;list-containers&#34;&gt;List containers&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /containers/json&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;List containers&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /containers/json?all=1&amp;amp;before=8dfafdbc3a40&amp;amp;size=1 HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
[
{
&amp;quot;Id&amp;quot;: &amp;quot;8dfafdbc3a40&amp;quot;,
&amp;quot;Image&amp;quot;: &amp;quot;ubuntu:latest&amp;quot;,
&amp;quot;Command&amp;quot;: &amp;quot;echo 1&amp;quot;,
&amp;quot;Created&amp;quot;: 1367854155,
&amp;quot;Status&amp;quot;: &amp;quot;Exit 0&amp;quot;,
&amp;quot;Ports&amp;quot;: [{&amp;quot;PrivatePort&amp;quot;: 2222, &amp;quot;PublicPort&amp;quot;: 3333, &amp;quot;Type&amp;quot;: &amp;quot;tcp&amp;quot;}],
&amp;quot;SizeRw&amp;quot;: 12288,
&amp;quot;SizeRootFs&amp;quot;: 0
},
{
&amp;quot;Id&amp;quot;: &amp;quot;9cd87474be90&amp;quot;,
&amp;quot;Image&amp;quot;: &amp;quot;ubuntu:latest&amp;quot;,
&amp;quot;Command&amp;quot;: &amp;quot;echo 222222&amp;quot;,
&amp;quot;Created&amp;quot;: 1367854155,
&amp;quot;Status&amp;quot;: &amp;quot;Exit 0&amp;quot;,
&amp;quot;Ports&amp;quot;: [],
&amp;quot;SizeRw&amp;quot;: 12288,
&amp;quot;SizeRootFs&amp;quot;: 0
},
{
&amp;quot;Id&amp;quot;: &amp;quot;3176a2479c92&amp;quot;,
&amp;quot;Image&amp;quot;: &amp;quot;ubuntu:latest&amp;quot;,
&amp;quot;Command&amp;quot;: &amp;quot;echo 3333333333333333&amp;quot;,
&amp;quot;Created&amp;quot;: 1367854154,
&amp;quot;Status&amp;quot;: &amp;quot;Exit 0&amp;quot;,
&amp;quot;Ports&amp;quot;:[],
&amp;quot;SizeRw&amp;quot;:12288,
&amp;quot;SizeRootFs&amp;quot;:0
},
{
&amp;quot;Id&amp;quot;: &amp;quot;4cb07b47f9fb&amp;quot;,
&amp;quot;Image&amp;quot;: &amp;quot;ubuntu:latest&amp;quot;,
&amp;quot;Command&amp;quot;: &amp;quot;echo 444444444444444444444444444444444&amp;quot;,
&amp;quot;Created&amp;quot;: 1367854152,
&amp;quot;Status&amp;quot;: &amp;quot;Exit 0&amp;quot;,
&amp;quot;Ports&amp;quot;: [],
&amp;quot;SizeRw&amp;quot;: 12288,
&amp;quot;SizeRootFs&amp;quot;: 0
}
]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;all&lt;/strong&gt; 1/True/true or 0/False/false, Show all containers.
Only running containers are shown by default (i.e., this defaults to false)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;limit&lt;/strong&gt; Show &lt;code&gt;limit&lt;/code&gt; last created containers, include non-running ones.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;since&lt;/strong&gt; Show only containers created since Id, include non-running ones.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;before&lt;/strong&gt; Show only containers created before Id, include non-running ones.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;size&lt;/strong&gt; 1/True/true or 0/False/false, Show the containers sizes&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;filters&lt;/strong&gt; - a json encoded value of the filters (a map[string][]string) to process on the containers list. Available filters:
&lt;ul&gt;
&lt;li&gt;exited=&amp;lt;int&amp;gt; &amp;ndash; containers with exit code of &amp;lt;int&amp;gt;&lt;/li&gt;
&lt;li&gt;status=(restarting|running|paused|exited)&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;400&lt;/strong&gt; bad parameter&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;create-a-container&#34;&gt;Create a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /containers/create&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Create a container&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /containers/create HTTP/1.1
Content-Type: application/json
{
&amp;quot;Hostname&amp;quot;:&amp;quot;&amp;quot;,
&amp;quot;Domainname&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;User&amp;quot;:&amp;quot;&amp;quot;,
&amp;quot;Memory&amp;quot;:0,
&amp;quot;MemorySwap&amp;quot;:0,
&amp;quot;CpuShares&amp;quot;: 512,
&amp;quot;Cpuset&amp;quot;: &amp;quot;0,1&amp;quot;,
&amp;quot;AttachStdin&amp;quot;:false,
&amp;quot;AttachStdout&amp;quot;:true,
&amp;quot;AttachStderr&amp;quot;:true,
&amp;quot;PortSpecs&amp;quot;:null,
&amp;quot;Tty&amp;quot;:false,
&amp;quot;OpenStdin&amp;quot;:false,
&amp;quot;StdinOnce&amp;quot;:false,
&amp;quot;Env&amp;quot;:null,
&amp;quot;Cmd&amp;quot;:[
&amp;quot;date&amp;quot;
],
&amp;quot;Image&amp;quot;:&amp;quot;ubuntu&amp;quot;,
&amp;quot;Volumes&amp;quot;:{
&amp;quot;/tmp&amp;quot;: {}
},
&amp;quot;WorkingDir&amp;quot;:&amp;quot;&amp;quot;,
&amp;quot;NetworkDisabled&amp;quot;: false,
&amp;quot;ExposedPorts&amp;quot;:{
&amp;quot;22/tcp&amp;quot;: {}
},
&amp;quot;RestartPolicy&amp;quot;: { &amp;quot;Name&amp;quot;: &amp;quot;always&amp;quot; }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 201 Created
Content-Type: application/json
{
&amp;quot;Id&amp;quot;:&amp;quot;e90e34656806&amp;quot;
&amp;quot;Warnings&amp;quot;:[]
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Json Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;RestartPolicy&lt;/strong&gt; The behavior to apply when the container exits. The
value is an object with a &lt;code&gt;Name&lt;/code&gt; property of either &lt;code&gt;&amp;quot;always&amp;quot;&lt;/code&gt; to
always restart or &lt;code&gt;&amp;quot;on-failure&amp;quot;&lt;/code&gt; to restart only when the container
exit code is non-zero. If &lt;code&gt;on-failure&lt;/code&gt; is used, &lt;code&gt;MaximumRetryCount&lt;/code&gt;
controls the number of times to retry before giving up.
The default is not to restart. (optional)
An ever increasing delay (double the previous delay, starting at 100mS)
is added before each restart to prevent flooding the server.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;config&lt;/strong&gt; the container&amp;rsquo;s configuration&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;name&lt;/strong&gt; Assign the specified name to the container. Must match &lt;code&gt;/?[a-zA-Z0-9_-]+&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;201&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;406&lt;/strong&gt; impossible to attach (container not running)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;inspect-a-container&#34;&gt;Inspect a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /containers/(id)/json&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Return low-level information on the container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /containers/4fa6e0f0c678/json HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
{
&amp;quot;Id&amp;quot;: &amp;quot;4fa6e0f0c6786287e131c3852c58a2e01cc697a68231826813597e4994f1d6e2&amp;quot;,
&amp;quot;Created&amp;quot;: &amp;quot;2013-05-07T14:51:42.041847+02:00&amp;quot;,
&amp;quot;Path&amp;quot;: &amp;quot;date&amp;quot;,
&amp;quot;Args&amp;quot;: [],
&amp;quot;Config&amp;quot;: {
&amp;quot;Hostname&amp;quot;: &amp;quot;4fa6e0f0c678&amp;quot;,
&amp;quot;User&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;Memory&amp;quot;: 0,
&amp;quot;MemorySwap&amp;quot;: 0,
&amp;quot;AttachStdin&amp;quot;: false,
&amp;quot;AttachStdout&amp;quot;: true,
&amp;quot;AttachStderr&amp;quot;: true,
&amp;quot;PortSpecs&amp;quot;: null,
&amp;quot;Tty&amp;quot;: false,
&amp;quot;OpenStdin&amp;quot;: false,
&amp;quot;StdinOnce&amp;quot;: false,
&amp;quot;Env&amp;quot;: null,
&amp;quot;Cmd&amp;quot;: [
&amp;quot;date&amp;quot;
],
&amp;quot;Dns&amp;quot;: null,
&amp;quot;Image&amp;quot;: &amp;quot;ubuntu&amp;quot;,
&amp;quot;Volumes&amp;quot;: {},
&amp;quot;VolumesFrom&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;WorkingDir&amp;quot;: &amp;quot;&amp;quot;
},
&amp;quot;State&amp;quot;: {
&amp;quot;Running&amp;quot;: false,
&amp;quot;Pid&amp;quot;: 0,
&amp;quot;ExitCode&amp;quot;: 0,
&amp;quot;StartedAt&amp;quot;: &amp;quot;2013-05-07T14:51:42.087658+02:01360&amp;quot;,
&amp;quot;Ghost&amp;quot;: false
},
&amp;quot;Image&amp;quot;: &amp;quot;b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc&amp;quot;,
&amp;quot;NetworkSettings&amp;quot;: {
&amp;quot;IpAddress&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;IpPrefixLen&amp;quot;: 0,
&amp;quot;Gateway&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;Bridge&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;PortMapping&amp;quot;: null
},
&amp;quot;SysInitPath&amp;quot;: &amp;quot;/home/kitty/go/src/github.com/docker/docker/bin/docker&amp;quot;,
&amp;quot;ResolvConfPath&amp;quot;: &amp;quot;/etc/resolv.conf&amp;quot;,
&amp;quot;Volumes&amp;quot;: {},
&amp;quot;HostConfig&amp;quot;: {
&amp;quot;Binds&amp;quot;: null,
&amp;quot;ContainerIDFile&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;LxcConf&amp;quot;: [],
&amp;quot;Privileged&amp;quot;: false,
&amp;quot;PortBindings&amp;quot;: {
&amp;quot;80/tcp&amp;quot;: [
{
&amp;quot;HostIp&amp;quot;: &amp;quot;0.0.0.0&amp;quot;,
&amp;quot;HostPort&amp;quot;: &amp;quot;49153&amp;quot;
}
]
},
&amp;quot;Links&amp;quot;: [&amp;quot;/name:alias&amp;quot;],
&amp;quot;PublishAllPorts&amp;quot;: false,
&amp;quot;CapAdd&amp;quot;: [&amp;quot;NET_ADMIN&amp;quot;],
&amp;quot;CapDrop&amp;quot;: [&amp;quot;MKNOD&amp;quot;]
}
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;list-processes-running-inside-a-container&#34;&gt;List processes running inside a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /containers/(id)/top&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;List processes running inside the container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /containers/4fa6e0f0c678/top HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
{
&amp;quot;Titles&amp;quot;: [
&amp;quot;USER&amp;quot;,
&amp;quot;PID&amp;quot;,
&amp;quot;%CPU&amp;quot;,
&amp;quot;%MEM&amp;quot;,
&amp;quot;VSZ&amp;quot;,
&amp;quot;RSS&amp;quot;,
&amp;quot;TTY&amp;quot;,
&amp;quot;STAT&amp;quot;,
&amp;quot;START&amp;quot;,
&amp;quot;TIME&amp;quot;,
&amp;quot;COMMAND&amp;quot;
],
&amp;quot;Processes&amp;quot;: [
[&amp;quot;root&amp;quot;,&amp;quot;20147&amp;quot;,&amp;quot;0.0&amp;quot;,&amp;quot;0.1&amp;quot;,&amp;quot;18060&amp;quot;,&amp;quot;1864&amp;quot;,&amp;quot;pts/4&amp;quot;,&amp;quot;S&amp;quot;,&amp;quot;10:06&amp;quot;,&amp;quot;0:00&amp;quot;,&amp;quot;bash&amp;quot;],
[&amp;quot;root&amp;quot;,&amp;quot;20271&amp;quot;,&amp;quot;0.0&amp;quot;,&amp;quot;0.0&amp;quot;,&amp;quot;4312&amp;quot;,&amp;quot;352&amp;quot;,&amp;quot;pts/4&amp;quot;,&amp;quot;S+&amp;quot;,&amp;quot;10:07&amp;quot;,&amp;quot;0:00&amp;quot;,&amp;quot;sleep&amp;quot;,&amp;quot;10&amp;quot;]
]
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;ps_args&lt;/strong&gt; ps arguments to use (e.g., aux)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;get-container-logs&#34;&gt;Get container logs&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /containers/(id)/logs&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Get stdout and stderr logs from the container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /containers/4fa6e0f0c678/logs?stderr=1&amp;amp;stdout=1&amp;amp;timestamps=1&amp;amp;follow=1&amp;amp;tail=10 HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/vnd.docker.raw-stream
{{ STREAM }}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;follow&lt;/strong&gt; 1/True/true or 0/False/false, return stream. Default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;stdout&lt;/strong&gt; 1/True/true or 0/False/false, show stdout log. Default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;stderr&lt;/strong&gt; 1/True/true or 0/False/false, show stderr log. Default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;timestamps&lt;/strong&gt; 1/True/true or 0/False/false, print timestamps for every
log line. Default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;tail&lt;/strong&gt; Output specified number of lines at the end of logs: &lt;code&gt;all&lt;/code&gt; or
&lt;code&gt;&amp;lt;number&amp;gt;&lt;/code&gt;. Default all&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;inspect-changes-on-a-container-s-filesystem&#34;&gt;Inspect changes on a container&amp;rsquo;s filesystem&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /containers/(id)/changes&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Inspect changes on container &lt;code&gt;id&lt;/code&gt;&amp;rsquo;s filesystem&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /containers/4fa6e0f0c678/changes HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
[
{
&amp;quot;Path&amp;quot;: &amp;quot;/dev&amp;quot;,
&amp;quot;Kind&amp;quot;: 0
},
{
&amp;quot;Path&amp;quot;: &amp;quot;/dev/kmsg&amp;quot;,
&amp;quot;Kind&amp;quot;: 1
},
{
&amp;quot;Path&amp;quot;: &amp;quot;/test&amp;quot;,
&amp;quot;Kind&amp;quot;: 1
}
]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;export-a-container&#34;&gt;Export a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /containers/(id)/export&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Export the contents of container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /containers/4fa6e0f0c678/export HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/octet-stream
{{ TAR STREAM }}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;start-a-container&#34;&gt;Start a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /containers/(id)/start&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Start the container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /containers/(id)/start HTTP/1.1
Content-Type: application/json
{
&amp;quot;Binds&amp;quot;:[&amp;quot;/tmp:/tmp&amp;quot;],
&amp;quot;Links&amp;quot;:[&amp;quot;redis3:redis&amp;quot;],
&amp;quot;LxcConf&amp;quot;:[{&amp;quot;Key&amp;quot;:&amp;quot;lxc.utsname&amp;quot;,&amp;quot;Value&amp;quot;:&amp;quot;docker&amp;quot;}],
&amp;quot;PortBindings&amp;quot;:{ &amp;quot;22/tcp&amp;quot;: [{ &amp;quot;HostPort&amp;quot;: &amp;quot;11022&amp;quot; }] },
&amp;quot;PublishAllPorts&amp;quot;:false,
&amp;quot;Privileged&amp;quot;:false,
&amp;quot;Dns&amp;quot;: [&amp;quot;8.8.8.8&amp;quot;],
&amp;quot;VolumesFrom&amp;quot;: [&amp;quot;parent&amp;quot;, &amp;quot;other:ro&amp;quot;],
&amp;quot;CapAdd&amp;quot;: [&amp;quot;NET_ADMIN&amp;quot;],
&amp;quot;CapDrop&amp;quot;: [&amp;quot;MKNOD&amp;quot;]
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 204 No Content
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Json Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;hostConfig&lt;/strong&gt; the container&amp;rsquo;s host configuration (optional)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;204&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;304&lt;/strong&gt; container already started&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;stop-a-container&#34;&gt;Stop a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /containers/(id)/stop&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Stop the container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /containers/e90e34656806/stop?t=5 HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 204 No Content
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;t&lt;/strong&gt; number of seconds to wait before killing the container&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;204&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;304&lt;/strong&gt; container already stopped&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;restart-a-container&#34;&gt;Restart a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /containers/(id)/restart&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Restart the container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /containers/e90e34656806/restart?t=5 HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 204 No Content
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;t&lt;/strong&gt; number of seconds to wait before killing the container&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;204&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;kill-a-container&#34;&gt;Kill a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /containers/(id)/kill&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Kill the container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /containers/e90e34656806/kill HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 204 No Content
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;signal&lt;/strong&gt; - Signal to send to the container: integer or string like &amp;ldquo;SIGINT&amp;rdquo;.
When not set, SIGKILL is assumed and the call will wait for the container to exit.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;204&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;pause-a-container&#34;&gt;Pause a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /containers/(id)/pause&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Pause the container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /containers/e90e34656806/pause HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 204 No Content
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;204&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;unpause-a-container&#34;&gt;Unpause a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /containers/(id)/unpause&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Unpause the container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /containers/e90e34656806/unpause HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 204 No Content
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;204&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;attach-to-a-container&#34;&gt;Attach to a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /containers/(id)/attach&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Attach to the container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /containers/16253994b7c4/attach?logs=1&amp;amp;stream=0&amp;amp;stdout=1 HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/vnd.docker.raw-stream
{{ STREAM }}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;logs&lt;/strong&gt; 1/True/true or 0/False/false, return logs. Default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;stream&lt;/strong&gt; 1/True/true or 0/False/false, return stream. Default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;stdin&lt;/strong&gt; 1/True/true or 0/False/false, if stream=true, attach to stdin.
Default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;stdout&lt;/strong&gt; 1/True/true or 0/False/false, if logs=true, return
stdout log, if stream=true, attach to stdout. Default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;stderr&lt;/strong&gt; 1/True/true or 0/False/false, if logs=true, return
stderr log, if stream=true, attach to stderr. Default false&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;400&lt;/strong&gt; bad parameter&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Stream details&lt;/strong&gt;:&lt;/p&gt;
&lt;p&gt;When using the TTY setting is enabled in
&lt;a href=&#34;http://localhost/docker/reference/api/docker_remote_api_v1.9/#create-a-container&#34; title=&#34;POST /containers/create&#34;&gt;&lt;code&gt;POST /containers/create&lt;/code&gt;
&lt;/a&gt;,
the stream is the raw data from the process PTY and client&amp;rsquo;s stdin.
When the TTY is disabled, then the stream is multiplexed to separate
stdout and stderr.&lt;/p&gt;
&lt;p&gt;The format is a &lt;strong&gt;Header&lt;/strong&gt; and a &lt;strong&gt;Payload&lt;/strong&gt; (frame).&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;HEADER&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The header will contain the information on which stream write the
stream (stdout or stderr). It also contain the size of the
associated frame encoded on the last 4 bytes (uint32).&lt;/p&gt;
&lt;p&gt;It is encoded on the first 8 bytes like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;header := [8]byte{STREAM_TYPE, 0, 0, 0, SIZE1, SIZE2, SIZE3, SIZE4}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;STREAM_TYPE&lt;/code&gt; can be:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;0: stdin (will be written on stdout)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;1: stdout&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;2: stderr&lt;/p&gt;
&lt;p&gt;&lt;code&gt;SIZE1, SIZE2, SIZE3, SIZE4&lt;/code&gt; are the 4 bytes of
the uint32 size encoded as big endian.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;PAYLOAD&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The payload is the raw stream.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;IMPLEMENTATION&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The simplest way to implement the Attach protocol is the following:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Read 8 bytes&lt;/li&gt;
&lt;li&gt;chose stdout or stderr depending on the first byte&lt;/li&gt;
&lt;li&gt;Extract the frame size from the last 4 bytes&lt;/li&gt;
&lt;li&gt;Read the extracted size and output it on the correct output&lt;/li&gt;
&lt;li&gt;Goto 1&lt;/li&gt;
&lt;/ol&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;attach-to-a-container-websocket&#34;&gt;Attach to a container (websocket)&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /containers/(id)/attach/ws&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Attach to the container &lt;code&gt;id&lt;/code&gt; via websocket&lt;/p&gt;
&lt;p&gt;Implements websocket protocol handshake according to &lt;a href=&#34;http://tools.ietf.org/html/rfc6455&#34;&gt;RFC 6455&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /containers/e90e34656806/attach/ws?logs=0&amp;amp;stream=1&amp;amp;stdin=1&amp;amp;stdout=1&amp;amp;stderr=1 HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; {{ STREAM }}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;logs&lt;/strong&gt; 1/True/true or 0/False/false, return logs. Default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;stream&lt;/strong&gt; 1/True/true or 0/False/false, return stream.
Default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;stdin&lt;/strong&gt; 1/True/true or 0/False/false, if stream=true, attach
to stdin. Default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;stdout&lt;/strong&gt; 1/True/true or 0/False/false, if logs=true, return
stdout log, if stream=true, attach to stdout. Default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;stderr&lt;/strong&gt; 1/True/true or 0/False/false, if logs=true, return
stderr log, if stream=true, attach to stderr. Default false&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;400&lt;/strong&gt; bad parameter&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;wait-a-container&#34;&gt;Wait a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /containers/(id)/wait&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Block until container &lt;code&gt;id&lt;/code&gt; stops, then returns the exit code&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /containers/16253994b7c4/wait HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
{&amp;quot;StatusCode&amp;quot;: 0}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;remove-a-container&#34;&gt;Remove a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;DELETE /containers/(id)&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Remove the container &lt;code&gt;id&lt;/code&gt; from the filesystem&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; DELETE /containers/16253994b7c4?v=1 HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 204 No Content
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;v&lt;/strong&gt; 1/True/true or 0/False/false, Remove the volumes
associated to the container. Default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;force&lt;/strong&gt; - 1/True/true or 0/False/false, Kill then remove the container.
Default false&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;204&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;400&lt;/strong&gt; bad parameter&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;copy-files-or-folders-from-a-container&#34;&gt;Copy files or folders from a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /containers/(id)/copy&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Copy files or folders of container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /containers/4fa6e0f0c678/copy HTTP/1.1
Content-Type: application/json
{
&amp;quot;Resource&amp;quot;: &amp;quot;test.txt&amp;quot;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/octet-stream
{{ TAR STREAM }}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;2-2-images&#34;&gt;2.2 Images&lt;/h2&gt;
&lt;h3 id=&#34;list-images&#34;&gt;List Images&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /images/json&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /images/json?all=0 HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
[
{
&amp;quot;RepoTags&amp;quot;: [
&amp;quot;ubuntu:12.04&amp;quot;,
&amp;quot;ubuntu:precise&amp;quot;,
&amp;quot;ubuntu:latest&amp;quot;
],
&amp;quot;Id&amp;quot;: &amp;quot;8dbd9e392a964056420e5d58ca5cc376ef18e2de93b5cc90e868a1bbc8318c1c&amp;quot;,
&amp;quot;Created&amp;quot;: 1365714795,
&amp;quot;Size&amp;quot;: 131506275,
&amp;quot;VirtualSize&amp;quot;: 131506275
},
{
&amp;quot;RepoTags&amp;quot;: [
&amp;quot;ubuntu:12.10&amp;quot;,
&amp;quot;ubuntu:quantal&amp;quot;
],
&amp;quot;ParentId&amp;quot;: &amp;quot;27cf784147099545&amp;quot;,
&amp;quot;Id&amp;quot;: &amp;quot;b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc&amp;quot;,
&amp;quot;Created&amp;quot;: 1364102658,
&amp;quot;Size&amp;quot;: 24653,
&amp;quot;VirtualSize&amp;quot;: 180116135
}
]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;all&lt;/strong&gt; 1/True/true or 0/False/false, default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;filters&lt;/strong&gt; a json encoded value of the filters (a map[string][]string) to process on the images list. Available filters:
&lt;ul&gt;
&lt;li&gt;dangling=true&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;create-an-image&#34;&gt;Create an image&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /images/create&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Create an image, either by pulling it from the registry or by importing it&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /images/create?fromImage=ubuntu HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
{&amp;quot;status&amp;quot;: &amp;quot;Pulling...&amp;quot;}
{&amp;quot;status&amp;quot;: &amp;quot;Pulling&amp;quot;, &amp;quot;progress&amp;quot;: &amp;quot;1 B/ 100 B&amp;quot;, &amp;quot;progressDetail&amp;quot;: {&amp;quot;current&amp;quot;: 1, &amp;quot;total&amp;quot;: 100}}
{&amp;quot;error&amp;quot;: &amp;quot;Invalid...&amp;quot;}
...
When using this endpoint to pull an image from the registry, the
`X-Registry-Auth` header can be used to include
a base64-encoded AuthConfig object.
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;fromImage&lt;/strong&gt; name of the image to pull&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;fromSrc&lt;/strong&gt; source to import, - means stdin&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;repo&lt;/strong&gt; repository&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;tag&lt;/strong&gt; tag&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;registry&lt;/strong&gt; the registry to pull from&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Request Headers:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;X-Registry-Auth&lt;/strong&gt; base64-encoded AuthConfig object&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;inspect-an-image&#34;&gt;Inspect an image&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /images/(name)/json&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Return low-level information on the image &lt;code&gt;name&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /images/ubuntu/json HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
{
&amp;quot;Created&amp;quot;: &amp;quot;2013-03-23T22:24:18.818426-07:00&amp;quot;,
&amp;quot;Container&amp;quot;: &amp;quot;3d67245a8d72ecf13f33dffac9f79dcdf70f75acb84d308770391510e0c23ad0&amp;quot;,
&amp;quot;ContainerConfig&amp;quot;:
{
&amp;quot;Hostname&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;User&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;Memory&amp;quot;: 0,
&amp;quot;MemorySwap&amp;quot;: 0,
&amp;quot;AttachStdin&amp;quot;: false,
&amp;quot;AttachStdout&amp;quot;: false,
&amp;quot;AttachStderr&amp;quot;: false,
&amp;quot;PortSpecs&amp;quot;: null,
&amp;quot;Tty&amp;quot;: true,
&amp;quot;OpenStdin&amp;quot;: true,
&amp;quot;StdinOnce&amp;quot;: false,
&amp;quot;Env&amp;quot;: null,
&amp;quot;Cmd&amp;quot;: [&amp;quot;/bin/bash&amp;quot;],
&amp;quot;Dns&amp;quot;: null,
&amp;quot;Image&amp;quot;: &amp;quot;ubuntu&amp;quot;,
&amp;quot;Volumes&amp;quot;: null,
&amp;quot;VolumesFrom&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;WorkingDir&amp;quot;: &amp;quot;&amp;quot;
},
&amp;quot;Id&amp;quot;: &amp;quot;b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc&amp;quot;,
&amp;quot;Parent&amp;quot;: &amp;quot;27cf784147099545&amp;quot;,
&amp;quot;Size&amp;quot;: 6824592
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such image&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;get-the-history-of-an-image&#34;&gt;Get the history of an image&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /images/(name)/history&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Return the history of the image &lt;code&gt;name&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /images/ubuntu/history HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
[
{
&amp;quot;Id&amp;quot;: &amp;quot;b750fe79269d&amp;quot;,
&amp;quot;Created&amp;quot;: 1364102658,
&amp;quot;CreatedBy&amp;quot;: &amp;quot;/bin/bash&amp;quot;
},
{
&amp;quot;Id&amp;quot;: &amp;quot;27cf78414709&amp;quot;,
&amp;quot;Created&amp;quot;: 1364068391,
&amp;quot;CreatedBy&amp;quot;: &amp;quot;&amp;quot;
}
]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such image&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;push-an-image-on-the-registry&#34;&gt;Push an image on the registry&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /images/(name)/push&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Push the image &lt;code&gt;name&lt;/code&gt; on the registry&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /images/test/push HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
{&amp;quot;status&amp;quot;: &amp;quot;Pushing...&amp;quot;}
{&amp;quot;status&amp;quot;: &amp;quot;Pushing&amp;quot;, &amp;quot;progress&amp;quot;: &amp;quot;1/? (n/a)&amp;quot;, &amp;quot;progressDetail&amp;quot;: {&amp;quot;current&amp;quot;: 1}}}
{&amp;quot;error&amp;quot;: &amp;quot;Invalid...&amp;quot;}
...
If you wish to push an image on to a private registry, that image must already have been tagged
into a repository which references that registry host name and port. This repository name should
then be used in the URL. This mirrors the flow of the CLI.
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /images/registry.acme.com:5000/test/push HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;tag&lt;/strong&gt; the tag to associate with the image on the registry, optional&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Request Headers:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;X-Registry-Auth&lt;/strong&gt; include a base64-encoded AuthConfig object.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such image&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;tag-an-image-into-a-repository&#34;&gt;Tag an image into a repository&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /images/(name)/tag&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Tag the image &lt;code&gt;name&lt;/code&gt; into a repository&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /images/test/tag?repo=myrepo&amp;amp;force=0&amp;amp;tag=v42 HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 201 OK
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;repo&lt;/strong&gt; The repository to tag in&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;force&lt;/strong&gt; 1/True/true or 0/False/false, default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;tag&lt;/strong&gt; - The new tag name&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;201&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;400&lt;/strong&gt; bad parameter&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such image&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;409&lt;/strong&gt; conflict&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;remove-an-image&#34;&gt;Remove an image&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;DELETE /images/(name)&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Remove the image &lt;code&gt;name&lt;/code&gt; from the filesystem&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; DELETE /images/test HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-type: application/json
[
{&amp;quot;Untagged&amp;quot;: &amp;quot;3e2f21a89f&amp;quot;},
{&amp;quot;Deleted&amp;quot;: &amp;quot;3e2f21a89f&amp;quot;},
{&amp;quot;Deleted&amp;quot;: &amp;quot;53b4f83ac9&amp;quot;}
]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;force&lt;/strong&gt; 1/True/true or 0/False/false, default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;noprune&lt;/strong&gt; 1/True/true or 0/False/false, default false&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such image&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;409&lt;/strong&gt; conflict&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;search-images&#34;&gt;Search images&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /images/search&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Search for an image on &lt;a href=&#34;https://hub.docker.com&#34;&gt;Docker Hub&lt;/a&gt;.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;:
The response keys have changed from API v1.6 to reflect the JSON
sent by the registry server to the docker daemon&amp;rsquo;s request.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /images/search?term=sshd HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
[
{
&amp;quot;description&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;is_official&amp;quot;: false,
&amp;quot;is_automated&amp;quot;: false,
&amp;quot;name&amp;quot;: &amp;quot;wma55/u1210sshd&amp;quot;,
&amp;quot;star_count&amp;quot;: 0
},
{
&amp;quot;description&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;is_official&amp;quot;: false,
&amp;quot;is_automated&amp;quot;: false,
&amp;quot;name&amp;quot;: &amp;quot;jdswinbank/sshd&amp;quot;,
&amp;quot;star_count&amp;quot;: 0
},
{
&amp;quot;description&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;is_official&amp;quot;: false,
&amp;quot;is_automated&amp;quot;: false,
&amp;quot;name&amp;quot;: &amp;quot;vgauthier/sshd&amp;quot;,
&amp;quot;star_count&amp;quot;: 0
}
...
]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;term&lt;/strong&gt; term to search&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;2-3-misc&#34;&gt;2.3 Misc&lt;/h2&gt;
&lt;h3 id=&#34;build-an-image-from-dockerfile-via-stdin&#34;&gt;Build an image from Dockerfile via stdin&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /build&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Build an image from Dockerfile via stdin&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /build HTTP/1.1
{{ TAR STREAM }}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
{&amp;quot;stream&amp;quot;: &amp;quot;Step 1...&amp;quot;}
{&amp;quot;stream&amp;quot;: &amp;quot;...&amp;quot;}
{&amp;quot;error&amp;quot;: &amp;quot;Error...&amp;quot;, &amp;quot;errorDetail&amp;quot;: {&amp;quot;code&amp;quot;: 123, &amp;quot;message&amp;quot;: &amp;quot;Error...&amp;quot;}}
The stream must be a tar archive compressed with one of the
following algorithms: identity (no compression), gzip, bzip2, xz.
The archive must include a file called `Dockerfile`
at its root. It may include any number of other files,
which will be accessible in the build context (See the [*ADD build
command*](/docker/reference/builder/#dockerbuilder)).
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;t&lt;/strong&gt; repository name (and optionally a tag) to be applied to
the resulting image in case of success&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;remote&lt;/strong&gt; git or HTTP/HTTPS URI build source&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;q&lt;/strong&gt; suppress verbose build output&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;nocache&lt;/strong&gt; do not use the cache when building the image&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;rm&lt;/strong&gt; - remove intermediate containers after a successful build (default behavior)&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;forcerm&lt;/strong&gt; - always remove intermediate containers (includes rm)&lt;/p&gt;
&lt;p&gt;Request Headers:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Content-type&lt;/strong&gt; should be set to &lt;code&gt;&amp;quot;application/tar&amp;quot;&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;X-Registry-Config&lt;/strong&gt; base64-encoded ConfigFile object&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;check-auth-configuration&#34;&gt;Check auth configuration&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /auth&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Get the default username and email&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /auth HTTP/1.1
Content-Type: application/json
{
&amp;quot;username&amp;quot;:&amp;quot; hannibal&amp;quot;,
&amp;quot;password: &amp;quot;xxxx&amp;quot;,
&amp;quot;email&amp;quot;: &amp;quot;hannibal@a-team.com&amp;quot;,
&amp;quot;serveraddress&amp;quot;: &amp;quot;https://index.docker.io/v1/&amp;quot;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;204&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;display-system-wide-information&#34;&gt;Display system-wide information&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /info&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Display system-wide information&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /info HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
{
&amp;quot;Containers&amp;quot;: 11,
&amp;quot;Images&amp;quot;: 16,
&amp;quot;Driver&amp;quot;: &amp;quot;btrfs&amp;quot;,
&amp;quot;ExecutionDriver&amp;quot;: &amp;quot;native-0.1&amp;quot;,
&amp;quot;KernelVersion&amp;quot;: &amp;quot;3.12.0-1-amd64&amp;quot;
&amp;quot;Debug&amp;quot;: false,
&amp;quot;NFd&amp;quot;: 11,
&amp;quot;NGoroutines&amp;quot;: 21,
&amp;quot;NEventsListener&amp;quot;: 0,
&amp;quot;InitPath&amp;quot;: &amp;quot;/usr/bin/docker&amp;quot;,
&amp;quot;IndexServerAddress&amp;quot;: [&amp;quot;https://index.docker.io/v1/&amp;quot;],
&amp;quot;MemoryLimit&amp;quot;: true,
&amp;quot;SwapLimit&amp;quot;: false,
&amp;quot;IPv4Forwarding&amp;quot;: true
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;show-the-docker-version-information&#34;&gt;Show the docker version information&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /version&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Show the docker version information&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /version HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
{
&amp;quot;ApiVersion&amp;quot;: &amp;quot;1.12&amp;quot;,
&amp;quot;Version&amp;quot;: &amp;quot;0.2.2&amp;quot;,
&amp;quot;GitCommit&amp;quot;: &amp;quot;5a2a5cc+CHANGES&amp;quot;,
&amp;quot;GoVersion&amp;quot;: &amp;quot;go1.0.3&amp;quot;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;ping-the-docker-server&#34;&gt;Ping the docker server&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /_ping&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Ping the docker server&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /_ping HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: text/plain
OK
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; - no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; - server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;create-a-new-image-from-a-container-s-changes&#34;&gt;Create a new image from a container&amp;rsquo;s changes&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /commit&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Create a new image from a container&amp;rsquo;s changes&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /commit?container=44c004db4b17&amp;amp;comment=message&amp;amp;repo=myrepo HTTP/1.1
Content-Type: application/json
{
&amp;quot;Hostname&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;Domainname&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;User&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;Memory&amp;quot;: 0,
&amp;quot;MemorySwap&amp;quot;: 0,
&amp;quot;CpuShares&amp;quot;: 512,
&amp;quot;Cpuset&amp;quot;: &amp;quot;0,1&amp;quot;,
&amp;quot;AttachStdin&amp;quot;: false,
&amp;quot;AttachStdout&amp;quot;: true,
&amp;quot;AttachStderr&amp;quot;: true,
&amp;quot;PortSpecs&amp;quot;: null,
&amp;quot;Tty&amp;quot;: false,
&amp;quot;OpenStdin&amp;quot;: false,
&amp;quot;StdinOnce&amp;quot;: false,
&amp;quot;Env&amp;quot;: null,
&amp;quot;Cmd&amp;quot;: [
&amp;quot;date&amp;quot;
],
&amp;quot;Volumes&amp;quot;: {
&amp;quot;/tmp&amp;quot;: {}
},
&amp;quot;WorkingDir&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;NetworkDisabled&amp;quot;: false,
&amp;quot;ExposedPorts&amp;quot;: {
&amp;quot;22/tcp&amp;quot;: {}
}
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 201 Created
Content-Type: application/vnd.docker.raw-stream
{&amp;quot;Id&amp;quot;: &amp;quot;596069db4bf5&amp;quot;}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Json Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;config&lt;/strong&gt; - the container&amp;rsquo;s configuration&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;container&lt;/strong&gt; source container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;repo&lt;/strong&gt; repository&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;tag&lt;/strong&gt; tag&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;comment&lt;/strong&gt; commit message&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;author&lt;/strong&gt; author (e.g., &amp;ldquo;John Hannibal Smith
&amp;lt;&lt;a href=&#34;mailto:hannibal%40a-team.com&#34;&gt;hannibal@a-team.com&lt;/a&gt;&amp;gt;&amp;ldquo;)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;201&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;monitor-docker-s-events&#34;&gt;Monitor Docker&amp;rsquo;s events&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /events&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Get container events from docker, either in real time via streaming, or via
polling (using since).&lt;/p&gt;
&lt;p&gt;Docker containers will report the following events:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;create, destroy, die, export, kill, pause, restart, start, stop, unpause
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;and Docker images will report:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;untag, delete
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /events?since=1374067924
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
{&amp;quot;status&amp;quot;: &amp;quot;create&amp;quot;, &amp;quot;id&amp;quot;: &amp;quot;dfdf82bd3881&amp;quot;,&amp;quot;from&amp;quot;: &amp;quot;ubuntu:latest&amp;quot;, &amp;quot;time&amp;quot;:1374067924}
{&amp;quot;status&amp;quot;: &amp;quot;start&amp;quot;, &amp;quot;id&amp;quot;: &amp;quot;dfdf82bd3881&amp;quot;,&amp;quot;from&amp;quot;: &amp;quot;ubuntu:latest&amp;quot;, &amp;quot;time&amp;quot;:1374067924}
{&amp;quot;status&amp;quot;: &amp;quot;stop&amp;quot;, &amp;quot;id&amp;quot;: &amp;quot;dfdf82bd3881&amp;quot;,&amp;quot;from&amp;quot;: &amp;quot;ubuntu:latest&amp;quot;, &amp;quot;time&amp;quot;:1374067966}
{&amp;quot;status&amp;quot;: &amp;quot;destroy&amp;quot;, &amp;quot;id&amp;quot;: &amp;quot;dfdf82bd3881&amp;quot;,&amp;quot;from&amp;quot;: &amp;quot;ubuntu:latest&amp;quot;, &amp;quot;time&amp;quot;:1374067970}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;since&lt;/strong&gt; timestamp used for polling&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;until&lt;/strong&gt; timestamp used for polling&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;get-a-tarball-containing-all-images-and-tags-in-a-repository&#34;&gt;Get a tarball containing all images and tags in a repository&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /images/(name)/get&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Get a tarball containing all images and metadata for the repository
specified by &lt;code&gt;name&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;See the &lt;a href=&#34;#image-tarball-format&#34;&gt;image tarball format&lt;/a&gt; for more details.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /images/ubuntu/get
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/x-tar
Binary data stream
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;load-a-tarball-with-a-set-of-images-and-tags-into-docker&#34;&gt;Load a tarball with a set of images and tags into docker&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /images/load&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Load a set of images and tags into the docker repository.
See the &lt;a href=&#34;#image-tarball-format&#34;&gt;image tarball format&lt;/a&gt; for more details.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /images/load
Tarball in body
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;image-tarball-format&#34;&gt;Image tarball format&lt;/h3&gt;
&lt;p&gt;An image tarball contains one directory per image layer (named using its long ID),
each containing three files:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;VERSION&lt;/code&gt;: currently &lt;code&gt;1.0&lt;/code&gt; - the file format version&lt;/li&gt;
&lt;li&gt;&lt;code&gt;json&lt;/code&gt;: detailed layer information, similar to &lt;code&gt;docker inspect layer_id&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;layer.tar&lt;/code&gt;: A tarfile containing the filesystem changes in this layer&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The &lt;code&gt;layer.tar&lt;/code&gt; file will contain &lt;code&gt;aufs&lt;/code&gt; style &lt;code&gt;.wh..wh.aufs&lt;/code&gt; files and directories
for storing attribute changes and deletions.&lt;/p&gt;
&lt;p&gt;If the tarball defines a repository, there will also be a &lt;code&gt;repositories&lt;/code&gt; file at
the root that contains a list of repository and tag names mapped to layer IDs.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;{&amp;quot;hello-world&amp;quot;:
{&amp;quot;latest&amp;quot;: &amp;quot;565a9d68a73f6706862bfe8409a7f659776d4d60a8d096eb4a3cbce6999cc2a1&amp;quot;}
}
&lt;/code&gt;&lt;/pre&gt;
&lt;h1 id=&#34;3-going-further&#34;&gt;3. Going further&lt;/h1&gt;
&lt;h2 id=&#34;3-1-inside-docker-run&#34;&gt;3.1 Inside &lt;code&gt;docker run&lt;/code&gt;&lt;/h2&gt;
&lt;p&gt;As an example, the &lt;code&gt;docker run&lt;/code&gt; command line makes the following API calls:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Create the container&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If the status code is 404, it means the image doesn&amp;rsquo;t exist:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Try to pull it&lt;/li&gt;
&lt;li&gt;Then retry to create the container&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Start the container&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If you are not in detached mode:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Attach to the container, using logs=1 (to have stdout and
stderr from the container&amp;rsquo;s start) and stream=1&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If in detached mode or only stdin is attached:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Display the container&amp;rsquo;s id&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;3-2-hijacking&#34;&gt;3.2 Hijacking&lt;/h2&gt;
&lt;p&gt;In this version of the API, /attach, uses hijacking to transport stdin,
stdout and stderr on the same socket. This might change in the future.&lt;/p&gt;
&lt;h2 id=&#34;3-3-cors-requests&#34;&gt;3.3 CORS Requests&lt;/h2&gt;
&lt;p&gt;To enable cross origin requests to the remote api add the flag
&amp;ldquo;&amp;ndash;api-enable-cors&amp;rdquo; when running docker in daemon mode.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ docker -d -H=&amp;quot;192.168.1.9:2375&amp;quot; --api-enable-cors
&lt;/code&gt;&lt;/pre&gt;
</description>
</item>
<item>
<title>Remote API v1.15</title>
<link>http://localhost/reference/api/docker_remote_api_v1.15/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>http://localhost/reference/api/docker_remote_api_v1.15/</guid>
<description>
&lt;h1 id=&#34;docker-remote-api-v1-15&#34;&gt;Docker Remote API v1.15&lt;/h1&gt;
&lt;h2 id=&#34;1-brief-introduction&#34;&gt;1. Brief introduction&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;The Remote API has replaced &lt;code&gt;rcli&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The daemon listens on &lt;code&gt;unix:///var/run/docker.sock&lt;/code&gt; but you can
&lt;a href=&#34;http://localhost/articles/basics/#bind-docker-to-another-hostport-or-a-unix-socket&#34;&gt;Bind Docker to another host/port or a Unix socket&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;The API tends to be REST, but for some complex commands, like &lt;code&gt;attach&lt;/code&gt;
or &lt;code&gt;pull&lt;/code&gt;, the HTTP connection is hijacked to transport &lt;code&gt;STDOUT&lt;/code&gt;,
&lt;code&gt;STDIN&lt;/code&gt; and &lt;code&gt;STDERR&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;h1 id=&#34;2-endpoints&#34;&gt;2. Endpoints&lt;/h1&gt;
&lt;h2 id=&#34;2-1-containers&#34;&gt;2.1 Containers&lt;/h2&gt;
&lt;h3 id=&#34;list-containers&#34;&gt;List containers&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /containers/json&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;List containers&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /containers/json?all=1&amp;amp;before=8dfafdbc3a40&amp;amp;size=1 HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
[
{
&amp;quot;Id&amp;quot;: &amp;quot;8dfafdbc3a40&amp;quot;,
&amp;quot;Image&amp;quot;: &amp;quot;ubuntu:latest&amp;quot;,
&amp;quot;Command&amp;quot;: &amp;quot;echo 1&amp;quot;,
&amp;quot;Created&amp;quot;: 1367854155,
&amp;quot;Status&amp;quot;: &amp;quot;Exit 0&amp;quot;,
&amp;quot;Ports&amp;quot;: [{&amp;quot;PrivatePort&amp;quot;: 2222, &amp;quot;PublicPort&amp;quot;: 3333, &amp;quot;Type&amp;quot;: &amp;quot;tcp&amp;quot;}],
&amp;quot;SizeRw&amp;quot;: 12288,
&amp;quot;SizeRootFs&amp;quot;: 0
},
{
&amp;quot;Id&amp;quot;: &amp;quot;9cd87474be90&amp;quot;,
&amp;quot;Image&amp;quot;: &amp;quot;ubuntu:latest&amp;quot;,
&amp;quot;Command&amp;quot;: &amp;quot;echo 222222&amp;quot;,
&amp;quot;Created&amp;quot;: 1367854155,
&amp;quot;Status&amp;quot;: &amp;quot;Exit 0&amp;quot;,
&amp;quot;Ports&amp;quot;: [],
&amp;quot;SizeRw&amp;quot;: 12288,
&amp;quot;SizeRootFs&amp;quot;: 0
},
{
&amp;quot;Id&amp;quot;: &amp;quot;3176a2479c92&amp;quot;,
&amp;quot;Image&amp;quot;: &amp;quot;ubuntu:latest&amp;quot;,
&amp;quot;Command&amp;quot;: &amp;quot;echo 3333333333333333&amp;quot;,
&amp;quot;Created&amp;quot;: 1367854154,
&amp;quot;Status&amp;quot;: &amp;quot;Exit 0&amp;quot;,
&amp;quot;Ports&amp;quot;:[],
&amp;quot;SizeRw&amp;quot;:12288,
&amp;quot;SizeRootFs&amp;quot;:0
},
{
&amp;quot;Id&amp;quot;: &amp;quot;4cb07b47f9fb&amp;quot;,
&amp;quot;Image&amp;quot;: &amp;quot;ubuntu:latest&amp;quot;,
&amp;quot;Command&amp;quot;: &amp;quot;echo 444444444444444444444444444444444&amp;quot;,
&amp;quot;Created&amp;quot;: 1367854152,
&amp;quot;Status&amp;quot;: &amp;quot;Exit 0&amp;quot;,
&amp;quot;Ports&amp;quot;: [],
&amp;quot;SizeRw&amp;quot;: 12288,
&amp;quot;SizeRootFs&amp;quot;: 0
}
]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;all&lt;/strong&gt; 1/True/true or 0/False/false, Show all containers.
Only running containers are shown by default (i.e., this defaults to false)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;limit&lt;/strong&gt; Show &lt;code&gt;limit&lt;/code&gt; last created
containers, include non-running ones.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;since&lt;/strong&gt; Show only containers created since Id, include
non-running ones.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;before&lt;/strong&gt; Show only containers created before Id, include
non-running ones.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;size&lt;/strong&gt; 1/True/true or 0/False/false, Show the containers
sizes&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;filters&lt;/strong&gt; - a json encoded value of the filters (a map[string][]string) to process on the containers list. Available filters:
&lt;ul&gt;
&lt;li&gt;exited=&amp;lt;int&amp;gt; &amp;ndash; containers with exit code of &amp;lt;int&amp;gt;&lt;/li&gt;
&lt;li&gt;status=(restarting|running|paused|exited)&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;400&lt;/strong&gt; bad parameter&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;create-a-container&#34;&gt;Create a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /containers/create&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Create a container&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /containers/create HTTP/1.1
Content-Type: application/json
{
&amp;quot;Hostname&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;Domainname&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;User&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;Memory&amp;quot;: 0,
&amp;quot;MemorySwap&amp;quot;: 0,
&amp;quot;CpuShares&amp;quot;: 512,
&amp;quot;Cpuset&amp;quot;: &amp;quot;0,1&amp;quot;,
&amp;quot;AttachStdin&amp;quot;: false,
&amp;quot;AttachStdout&amp;quot;: true,
&amp;quot;AttachStderr&amp;quot;: true,
&amp;quot;Tty&amp;quot;: false,
&amp;quot;OpenStdin&amp;quot;: false,
&amp;quot;StdinOnce&amp;quot;: false,
&amp;quot;Env&amp;quot;: null,
&amp;quot;Cmd&amp;quot;: [
&amp;quot;date&amp;quot;
],
&amp;quot;Entrypoint&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;Image&amp;quot;: &amp;quot;ubuntu&amp;quot;,
&amp;quot;Volumes&amp;quot;: {
&amp;quot;/tmp&amp;quot;: {}
},
&amp;quot;WorkingDir&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;NetworkDisabled&amp;quot;: false,
&amp;quot;MacAddress&amp;quot;: &amp;quot;12:34:56:78:9a:bc&amp;quot;,
&amp;quot;ExposedPorts&amp;quot;: {
&amp;quot;22/tcp&amp;quot;: {}
},
&amp;quot;SecurityOpts&amp;quot;: [&amp;quot;&amp;quot;],
&amp;quot;HostConfig&amp;quot;: {
&amp;quot;Binds&amp;quot;: [&amp;quot;/tmp:/tmp&amp;quot;],
&amp;quot;Links&amp;quot;: [&amp;quot;redis3:redis&amp;quot;],
&amp;quot;LxcConf&amp;quot;: {&amp;quot;lxc.utsname&amp;quot;:&amp;quot;docker&amp;quot;},
&amp;quot;PortBindings&amp;quot;: { &amp;quot;22/tcp&amp;quot;: [{ &amp;quot;HostPort&amp;quot;: &amp;quot;11022&amp;quot; }] },
&amp;quot;PublishAllPorts&amp;quot;: false,
&amp;quot;Privileged&amp;quot;: false,
&amp;quot;Dns&amp;quot;: [&amp;quot;8.8.8.8&amp;quot;],
&amp;quot;DnsSearch&amp;quot;: [&amp;quot;&amp;quot;],
&amp;quot;ExtraHosts&amp;quot;: null,
&amp;quot;VolumesFrom&amp;quot;: [&amp;quot;parent&amp;quot;, &amp;quot;other:ro&amp;quot;],
&amp;quot;CapAdd&amp;quot;: [&amp;quot;NET_ADMIN&amp;quot;],
&amp;quot;CapDrop&amp;quot;: [&amp;quot;MKNOD&amp;quot;],
&amp;quot;RestartPolicy&amp;quot;: { &amp;quot;Name&amp;quot;: &amp;quot;&amp;quot;, &amp;quot;MaximumRetryCount&amp;quot;: 0 },
&amp;quot;NetworkMode&amp;quot;: &amp;quot;bridge&amp;quot;,
&amp;quot;Devices&amp;quot;: []
}
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 201 Created
Content-Type: application/json
{
&amp;quot;Id&amp;quot;: &amp;quot;f91ddc4b01e079c4481a8340bbbeca4dbd33d6e4a10662e499f8eacbb5bf252b&amp;quot;
&amp;quot;Warnings&amp;quot;: []
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Json Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Hostname&lt;/strong&gt; - A string value containing the desired hostname to use for the
container.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Domainname&lt;/strong&gt; - A string value containing the desired domain name to use
for the container.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;User&lt;/strong&gt; - A string value containing the user to use inside the container.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Memory&lt;/strong&gt; - Memory limit in bytes.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;MemorySwap&lt;/strong&gt;- Total memory usage (memory + swap); set &lt;code&gt;-1&lt;/code&gt; to disable swap.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;CpuShares&lt;/strong&gt; - An integer value containing the CPU Shares for container
(ie. the relative weight vs other containers).
&lt;strong&gt;CpuSet&lt;/strong&gt; - String value containing the cgroups Cpuset to use.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;AttachStdin&lt;/strong&gt; - Boolean value, attaches to stdin.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;AttachStdout&lt;/strong&gt; - Boolean value, attaches to stdout.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;AttachStderr&lt;/strong&gt; - Boolean value, attaches to stderr.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Tty&lt;/strong&gt; - Boolean value, Attach standard streams to a tty, including stdin if it is not closed.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;OpenStdin&lt;/strong&gt; - Boolean value, opens stdin,&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;StdinOnce&lt;/strong&gt; - Boolean value, close stdin after the 1 attached client disconnects.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Env&lt;/strong&gt; - A list of environment variables in the form of &lt;code&gt;VAR=value&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Cmd&lt;/strong&gt; - Command to run specified as a string or an array of strings.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Entrypoint&lt;/strong&gt; - Set the entrypoint for the container a a string or an array
of strings&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Image&lt;/strong&gt; - String value containing the image name to use for the container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Volumes&lt;/strong&gt; An object mapping mountpoint paths (strings) inside the
container to empty objects.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;WorkingDir&lt;/strong&gt; - A string value containing the working dir for commands to
run in.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;NetworkDisabled&lt;/strong&gt; - Boolean value, when true disables networking for the
container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;ExposedPorts&lt;/strong&gt; - An object mapping ports to an empty object in the form of:
&lt;code&gt;&amp;quot;ExposedPorts&amp;quot;: { &amp;quot;&amp;lt;port&amp;gt;/&amp;lt;tcp|udp&amp;gt;: {}&amp;quot; }&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;SecurityOpts&lt;/strong&gt;: A list of string values to customize labels for MLS
systems, such as SELinux.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;HostConfig&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Binds&lt;/strong&gt; A list of volume bindings for this container. Each volume
binding is a string of the form &lt;code&gt;container_path&lt;/code&gt; (to create a new
volume for the container), &lt;code&gt;host_path:container_path&lt;/code&gt; (to bind-mount
a host path into the container), or &lt;code&gt;host_path:container_path:ro&lt;/code&gt;
(to make the bind-mount read-only inside the container).&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Links&lt;/strong&gt; - A list of links for the container. Each link entry should be
in the form of &amp;ldquo;container_name:alias&amp;rdquo;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;LxcConf&lt;/strong&gt; - LXC specific configurations. These configurations will only
work when using the &lt;code&gt;lxc&lt;/code&gt; execution driver.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;PortBindings&lt;/strong&gt; - A map of exposed container ports and the host port they
should map to. It should be specified in the form
&lt;code&gt;{ &amp;lt;port&amp;gt;/&amp;lt;protocol&amp;gt;: [{ &amp;quot;HostPort&amp;quot;: &amp;quot;&amp;lt;port&amp;gt;&amp;quot; }] }&lt;/code&gt;
Take note that &lt;code&gt;port&lt;/code&gt; is specified as a string and not an integer value.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;PublishAllPorts&lt;/strong&gt; - Allocates a random host port for all of a container&amp;rsquo;s
exposed ports. Specified as a boolean value.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Privileged&lt;/strong&gt; - Gives the container full access to the host. Specified as
a boolean value.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Dns&lt;/strong&gt; - A list of dns servers for the container to use.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;DnsSearch&lt;/strong&gt; - A list of DNS search domains&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;ExtraHosts&lt;/strong&gt; - A list of hostnames/IP mappings to be added to the
container&amp;rsquo;s &lt;code&gt;/etc/hosts&lt;/code&gt; file. Specified in the form &lt;code&gt;[&amp;quot;hostname:IP&amp;quot;]&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;VolumesFrom&lt;/strong&gt; - A list of volumes to inherit from another container.
Specified in the form &lt;code&gt;&amp;lt;container name&amp;gt;[:&amp;lt;ro|rw&amp;gt;]&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;CapAdd&lt;/strong&gt; - A list of kernel capabilities to add to the container.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Capdrop&lt;/strong&gt; - A list of kernel capabilities to drop from the container.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;RestartPolicy&lt;/strong&gt; The behavior to apply when the container exits. The
value is an object with a &lt;code&gt;Name&lt;/code&gt; property of either &lt;code&gt;&amp;quot;always&amp;quot;&lt;/code&gt; to
always restart or &lt;code&gt;&amp;quot;on-failure&amp;quot;&lt;/code&gt; to restart only when the container
exit code is non-zero. If &lt;code&gt;on-failure&lt;/code&gt; is used, &lt;code&gt;MaximumRetryCount&lt;/code&gt;
controls the number of times to retry before giving up.
The default is not to restart. (optional)
An ever increasing delay (double the previous delay, starting at 100mS)
is added before each restart to prevent flooding the server.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;NetworkMode&lt;/strong&gt; - Sets the networking mode for the container. Supported
values are: &lt;code&gt;bridge&lt;/code&gt;, &lt;code&gt;host&lt;/code&gt;, and &lt;code&gt;container:&amp;lt;name|id&amp;gt;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Devices&lt;/strong&gt; - A list of devices to add to the container specified in the
form
&lt;code&gt;{ &amp;quot;PathOnHost&amp;quot;: &amp;quot;/dev/deviceName&amp;quot;, &amp;quot;PathInContainer&amp;quot;: &amp;quot;/dev/deviceName&amp;quot;, &amp;quot;CgroupPermissions&amp;quot;: &amp;quot;mrw&amp;quot;}&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;name&lt;/strong&gt; Assign the specified name to the container. Must
match &lt;code&gt;/?[a-zA-Z0-9_-]+&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;201&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;406&lt;/strong&gt; impossible to attach (container not running)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;inspect-a-container&#34;&gt;Inspect a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /containers/(id)/json&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Return low-level information on the container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /containers/4fa6e0f0c678/json HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
{
&amp;quot;Id&amp;quot;: &amp;quot;4fa6e0f0c6786287e131c3852c58a2e01cc697a68231826813597e4994f1d6e2&amp;quot;,
&amp;quot;Created&amp;quot;: &amp;quot;2013-05-07T14:51:42.041847+02:00&amp;quot;,
&amp;quot;Path&amp;quot;: &amp;quot;date&amp;quot;,
&amp;quot;Args&amp;quot;: [],
&amp;quot;Config&amp;quot;: {
&amp;quot;Hostname&amp;quot;: &amp;quot;4fa6e0f0c678&amp;quot;,
&amp;quot;User&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;Memory&amp;quot;: 0,
&amp;quot;MemorySwap&amp;quot;: 0,
&amp;quot;AttachStdin&amp;quot;: false,
&amp;quot;AttachStdout&amp;quot;: true,
&amp;quot;AttachStderr&amp;quot;: true,
&amp;quot;PortSpecs&amp;quot;: null,
&amp;quot;Tty&amp;quot;: false,
&amp;quot;OpenStdin&amp;quot;: false,
&amp;quot;StdinOnce&amp;quot;: false,
&amp;quot;Env&amp;quot;: null,
&amp;quot;Cmd&amp;quot;: [
&amp;quot;date&amp;quot;
],
&amp;quot;Dns&amp;quot;: null,
&amp;quot;Image&amp;quot;: &amp;quot;ubuntu&amp;quot;,
&amp;quot;Volumes&amp;quot;: {},
&amp;quot;VolumesFrom&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;WorkingDir&amp;quot;: &amp;quot;&amp;quot;
},
&amp;quot;State&amp;quot;: {
&amp;quot;Running&amp;quot;: false,
&amp;quot;Pid&amp;quot;: 0,
&amp;quot;ExitCode&amp;quot;: 0,
&amp;quot;StartedAt&amp;quot;: &amp;quot;2013-05-07T14:51:42.087658+02:01360&amp;quot;,
&amp;quot;Ghost&amp;quot;: false
},
&amp;quot;Image&amp;quot;: &amp;quot;b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc&amp;quot;,
&amp;quot;NetworkSettings&amp;quot;: {
&amp;quot;IpAddress&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;IpPrefixLen&amp;quot;: 0,
&amp;quot;Gateway&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;Bridge&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;PortMapping&amp;quot;: null
},
&amp;quot;SysInitPath&amp;quot;: &amp;quot;/home/kitty/go/src/github.com/docker/docker/bin/docker&amp;quot;,
&amp;quot;ResolvConfPath&amp;quot;: &amp;quot;/etc/resolv.conf&amp;quot;,
&amp;quot;Volumes&amp;quot;: {},
&amp;quot;HostConfig&amp;quot;: {
&amp;quot;Binds&amp;quot;: null,
&amp;quot;ContainerIDFile&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;LxcConf&amp;quot;: [],
&amp;quot;Privileged&amp;quot;: false,
&amp;quot;PortBindings&amp;quot;: {
&amp;quot;80/tcp&amp;quot;: [
{
&amp;quot;HostIp&amp;quot;: &amp;quot;0.0.0.0&amp;quot;,
&amp;quot;HostPort&amp;quot;: &amp;quot;49153&amp;quot;
}
]
},
&amp;quot;Links&amp;quot;: [&amp;quot;/name:alias&amp;quot;],
&amp;quot;PublishAllPorts&amp;quot;: false,
&amp;quot;CapAdd&amp;quot;: [&amp;quot;NET_ADMIN&amp;quot;],
&amp;quot;CapDrop&amp;quot;: [&amp;quot;MKNOD&amp;quot;]
}
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;list-processes-running-inside-a-container&#34;&gt;List processes running inside a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /containers/(id)/top&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;List processes running inside the container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /containers/4fa6e0f0c678/top HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
{
&amp;quot;Titles&amp;quot;: [
&amp;quot;USER&amp;quot;,
&amp;quot;PID&amp;quot;,
&amp;quot;%CPU&amp;quot;,
&amp;quot;%MEM&amp;quot;,
&amp;quot;VSZ&amp;quot;,
&amp;quot;RSS&amp;quot;,
&amp;quot;TTY&amp;quot;,
&amp;quot;STAT&amp;quot;,
&amp;quot;START&amp;quot;,
&amp;quot;TIME&amp;quot;,
&amp;quot;COMMAND&amp;quot;
],
&amp;quot;Processes&amp;quot;: [
[&amp;quot;root&amp;quot;,&amp;quot;20147&amp;quot;,&amp;quot;0.0&amp;quot;,&amp;quot;0.1&amp;quot;,&amp;quot;18060&amp;quot;,&amp;quot;1864&amp;quot;,&amp;quot;pts/4&amp;quot;,&amp;quot;S&amp;quot;,&amp;quot;10:06&amp;quot;,&amp;quot;0:00&amp;quot;,&amp;quot;bash&amp;quot;],
[&amp;quot;root&amp;quot;,&amp;quot;20271&amp;quot;,&amp;quot;0.0&amp;quot;,&amp;quot;0.0&amp;quot;,&amp;quot;4312&amp;quot;,&amp;quot;352&amp;quot;,&amp;quot;pts/4&amp;quot;,&amp;quot;S+&amp;quot;,&amp;quot;10:07&amp;quot;,&amp;quot;0:00&amp;quot;,&amp;quot;sleep&amp;quot;,&amp;quot;10&amp;quot;]
]
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;ps_args&lt;/strong&gt; ps arguments to use (e.g., aux)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;get-container-logs&#34;&gt;Get container logs&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /containers/(id)/logs&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Get stdout and stderr logs from the container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /containers/4fa6e0f0c678/logs?stderr=1&amp;amp;stdout=1&amp;amp;timestamps=1&amp;amp;follow=1&amp;amp;tail=10 HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/vnd.docker.raw-stream
{{ STREAM }}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;follow&lt;/strong&gt; 1/True/true or 0/False/false, return stream. Default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;stdout&lt;/strong&gt; 1/True/true or 0/False/false, show stdout log. Default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;stderr&lt;/strong&gt; 1/True/true or 0/False/false, show stderr log. Default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;timestamps&lt;/strong&gt; 1/True/true or 0/False/false, print timestamps for
every log line. Default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;tail&lt;/strong&gt; Output specified number of lines at the end of logs: &lt;code&gt;all&lt;/code&gt; or &lt;code&gt;&amp;lt;number&amp;gt;&lt;/code&gt;. Default all&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;inspect-changes-on-a-container-s-filesystem&#34;&gt;Inspect changes on a container&amp;rsquo;s filesystem&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /containers/(id)/changes&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Inspect changes on container &lt;code&gt;id&lt;/code&gt;&amp;rsquo;s filesystem&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /containers/4fa6e0f0c678/changes HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
[
{
&amp;quot;Path&amp;quot;: &amp;quot;/dev&amp;quot;,
&amp;quot;Kind&amp;quot;: 0
},
{
&amp;quot;Path&amp;quot;: &amp;quot;/dev/kmsg&amp;quot;,
&amp;quot;Kind&amp;quot;: 1
},
{
&amp;quot;Path&amp;quot;: &amp;quot;/test&amp;quot;,
&amp;quot;Kind&amp;quot;: 1
}
]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;export-a-container&#34;&gt;Export a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /containers/(id)/export&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Export the contents of container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /containers/4fa6e0f0c678/export HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/octet-stream
{{ TAR STREAM }}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;resize-a-container-tty&#34;&gt;Resize a container TTY&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /containers/(id)/resize?h=&amp;lt;height&amp;gt;&amp;amp;w=&amp;lt;width&amp;gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Resize the TTY of container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /containers/4fa6e0f0c678/resize?h=40&amp;amp;w=80 HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Length: 0
Content-Type: text/plain; charset=utf-8
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; No such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; bad file descriptor&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;start-a-container&#34;&gt;Start a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /containers/(id)/start&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Start the container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /containers/(id)/start HTTP/1.1
Content-Type: application/json
{
&amp;quot;Binds&amp;quot;: [&amp;quot;/tmp:/tmp&amp;quot;],
&amp;quot;Links&amp;quot;: [&amp;quot;redis3:redis&amp;quot;],
&amp;quot;LxcConf&amp;quot;: {&amp;quot;lxc.utsname&amp;quot;:&amp;quot;docker&amp;quot;},
&amp;quot;PortBindings&amp;quot;: { &amp;quot;22/tcp&amp;quot;: [{ &amp;quot;HostPort&amp;quot;: &amp;quot;11022&amp;quot; }] },
&amp;quot;PublishAllPorts&amp;quot;: false,
&amp;quot;Privileged&amp;quot;: false,
&amp;quot;Dns&amp;quot;: [&amp;quot;8.8.8.8&amp;quot;],
&amp;quot;DnsSearch&amp;quot;: [&amp;quot;&amp;quot;],
&amp;quot;VolumesFrom&amp;quot;: [&amp;quot;parent&amp;quot;, &amp;quot;other:ro&amp;quot;],
&amp;quot;CapAdd&amp;quot;: [&amp;quot;NET_ADMIN&amp;quot;],
&amp;quot;CapDrop&amp;quot;: [&amp;quot;MKNOD&amp;quot;],
&amp;quot;RestartPolicy&amp;quot;: { &amp;quot;Name&amp;quot;: &amp;quot;&amp;quot;, &amp;quot;MaximumRetryCount&amp;quot;: 0 },
&amp;quot;NetworkMode&amp;quot;: &amp;quot;bridge&amp;quot;,
&amp;quot;Devices&amp;quot;: []
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 204 No Content
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Json Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Binds&lt;/strong&gt; A list of volume bindings for this container. Each volume
binding is a string of the form &lt;code&gt;container_path&lt;/code&gt; (to create a new
volume for the container), &lt;code&gt;host_path:container_path&lt;/code&gt; (to bind-mount
a host path into the container), or &lt;code&gt;host_path:container_path:ro&lt;/code&gt;
(to make the bind-mount read-only inside the container).&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Links&lt;/strong&gt; - A list of links for the container. Each link entry should be of
of the form &amp;ldquo;container_name:alias&amp;rdquo;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;LxcConf&lt;/strong&gt; - LXC specific configurations. These configurations will only
work when using the &lt;code&gt;lxc&lt;/code&gt; execution driver.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;PortBindings&lt;/strong&gt; - A map of exposed container ports and the host port they
should map to. It should be specified in the form
&lt;code&gt;{ &amp;lt;port&amp;gt;/&amp;lt;protocol&amp;gt;: [{ &amp;quot;HostPort&amp;quot;: &amp;quot;&amp;lt;port&amp;gt;&amp;quot; }] }&lt;/code&gt;
Take note that &lt;code&gt;port&lt;/code&gt; is specified as a string and not an integer value.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;PublishAllPorts&lt;/strong&gt; - Allocates a random host port for all of a container&amp;rsquo;s
exposed ports. Specified as a boolean value.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Privileged&lt;/strong&gt; - Gives the container full access to the host. Specified as
a boolean value.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Dns&lt;/strong&gt; - A list of dns servers for the container to use.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;DnsSearch&lt;/strong&gt; - A list of DNS search domains&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;VolumesFrom&lt;/strong&gt; - A list of volumes to inherit from another container.
Specified in the form &lt;code&gt;&amp;lt;container name&amp;gt;[:&amp;lt;ro|rw&amp;gt;]&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;CapAdd&lt;/strong&gt; - A list of kernel capabilities to add to the container.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Capdrop&lt;/strong&gt; - A list of kernel capabilities to drop from the container.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;RestartPolicy&lt;/strong&gt; The behavior to apply when the container exits. The
value is an object with a &lt;code&gt;Name&lt;/code&gt; property of either &lt;code&gt;&amp;quot;always&amp;quot;&lt;/code&gt; to
always restart or &lt;code&gt;&amp;quot;on-failure&amp;quot;&lt;/code&gt; to restart only when the container
exit code is non-zero. If &lt;code&gt;on-failure&lt;/code&gt; is used, &lt;code&gt;MaximumRetryCount&lt;/code&gt;
controls the number of times to retry before giving up.
The default is not to restart. (optional)
An ever increasing delay (double the previous delay, starting at 100mS)
is added before each restart to prevent flooding the server.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;NetworkMode&lt;/strong&gt; - Sets the networking mode for the container. Supported
values are: &lt;code&gt;bridge&lt;/code&gt;, &lt;code&gt;host&lt;/code&gt;, and &lt;code&gt;container:&amp;lt;name|id&amp;gt;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Devices&lt;/strong&gt; - A list of devices to add to the container specified in the
form
&lt;code&gt;{ &amp;quot;PathOnHost&amp;quot;: &amp;quot;/dev/deviceName&amp;quot;, &amp;quot;PathInContainer&amp;quot;: &amp;quot;/dev/deviceName&amp;quot;, &amp;quot;CgroupPermissions&amp;quot;: &amp;quot;mrw&amp;quot;}&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;204&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;304&lt;/strong&gt; container already started&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;stop-a-container&#34;&gt;Stop a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /containers/(id)/stop&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Stop the container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /containers/e90e34656806/stop?t=5 HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 204 No Content
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;t&lt;/strong&gt; number of seconds to wait before killing the container&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;204&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;304&lt;/strong&gt; container already stopped&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;restart-a-container&#34;&gt;Restart a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /containers/(id)/restart&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Restart the container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /containers/e90e34656806/restart?t=5 HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 204 No Content
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;t&lt;/strong&gt; number of seconds to wait before killing the container&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;204&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;kill-a-container&#34;&gt;Kill a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /containers/(id)/kill&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Kill the container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /containers/e90e34656806/kill HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 204 No Content
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;signal&lt;/strong&gt; - Signal to send to the container: integer or string like &amp;ldquo;SIGINT&amp;rdquo;.
When not set, SIGKILL is assumed and the call will waits for the container to exit.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;204&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;pause-a-container&#34;&gt;Pause a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /containers/(id)/pause&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Pause the container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /containers/e90e34656806/pause HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 204 No Content
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;204&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;unpause-a-container&#34;&gt;Unpause a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /containers/(id)/unpause&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Unpause the container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /containers/e90e34656806/unpause HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 204 No Content
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;204&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;attach-to-a-container&#34;&gt;Attach to a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /containers/(id)/attach&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Attach to the container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /containers/16253994b7c4/attach?logs=1&amp;amp;stream=0&amp;amp;stdout=1 HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/vnd.docker.raw-stream
{{ STREAM }}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;logs&lt;/strong&gt; 1/True/true or 0/False/false, return logs. Default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;stream&lt;/strong&gt; 1/True/true or 0/False/false, return stream.
Default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;stdin&lt;/strong&gt; 1/True/true or 0/False/false, if stream=true, attach
to stdin. Default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;stdout&lt;/strong&gt; 1/True/true or 0/False/false, if logs=true, return
stdout log, if stream=true, attach to stdout. Default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;stderr&lt;/strong&gt; 1/True/true or 0/False/false, if logs=true, return
stderr log, if stream=true, attach to stderr. Default false&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;400&lt;/strong&gt; bad parameter&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Stream details&lt;/strong&gt;:&lt;/p&gt;
&lt;p&gt;When using the TTY setting is enabled in
&lt;a href=&#34;http://localhost/docker/reference/api/docker_remote_api_v1.9/#create-a-container&#34; title=&#34;POST /containers/create&#34;&gt;&lt;code&gt;POST /containers/create&lt;/code&gt;
&lt;/a&gt;,
the stream is the raw data from the process PTY and client&amp;rsquo;s stdin.
When the TTY is disabled, then the stream is multiplexed to separate
stdout and stderr.&lt;/p&gt;
&lt;p&gt;The format is a &lt;strong&gt;Header&lt;/strong&gt; and a &lt;strong&gt;Payload&lt;/strong&gt; (frame).&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;HEADER&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The header will contain the information on which stream write the
stream (stdout or stderr). It also contain the size of the
associated frame encoded on the last 4 bytes (uint32).&lt;/p&gt;
&lt;p&gt;It is encoded on the first 8 bytes like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;header := [8]byte{STREAM_TYPE, 0, 0, 0, SIZE1, SIZE2, SIZE3, SIZE4}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;STREAM_TYPE&lt;/code&gt; can be:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;0: stdin (will be written on stdout)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;1: stdout&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;2: stderr&lt;/p&gt;
&lt;p&gt;&lt;code&gt;SIZE1, SIZE2, SIZE3, SIZE4&lt;/code&gt; are the 4 bytes of
the uint32 size encoded as big endian.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;PAYLOAD&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The payload is the raw stream.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;IMPLEMENTATION&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The simplest way to implement the Attach protocol is the following:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Read 8 bytes&lt;/li&gt;
&lt;li&gt;chose stdout or stderr depending on the first byte&lt;/li&gt;
&lt;li&gt;Extract the frame size from the last 4 bytes&lt;/li&gt;
&lt;li&gt;Read the extracted size and output it on the correct output&lt;/li&gt;
&lt;li&gt;Goto 1&lt;/li&gt;
&lt;/ol&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;attach-to-a-container-websocket&#34;&gt;Attach to a container (websocket)&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /containers/(id)/attach/ws&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Attach to the container &lt;code&gt;id&lt;/code&gt; via websocket&lt;/p&gt;
&lt;p&gt;Implements websocket protocol handshake according to &lt;a href=&#34;http://tools.ietf.org/html/rfc6455&#34;&gt;RFC 6455&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /containers/e90e34656806/attach/ws?logs=0&amp;amp;stream=1&amp;amp;stdin=1&amp;amp;stdout=1&amp;amp;stderr=1 HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; {{ STREAM }}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;logs&lt;/strong&gt; 1/True/true or 0/False/false, return logs. Default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;stream&lt;/strong&gt; 1/True/true or 0/False/false, return stream.
Default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;stdin&lt;/strong&gt; 1/True/true or 0/False/false, if stream=true, attach
to stdin. Default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;stdout&lt;/strong&gt; 1/True/true or 0/False/false, if logs=true, return
stdout log, if stream=true, attach to stdout. Default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;stderr&lt;/strong&gt; 1/True/true or 0/False/false, if logs=true, return
stderr log, if stream=true, attach to stderr. Default false&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;400&lt;/strong&gt; bad parameter&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;wait-a-container&#34;&gt;Wait a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /containers/(id)/wait&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Block until container &lt;code&gt;id&lt;/code&gt; stops, then returns the exit code&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /containers/16253994b7c4/wait HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
{&amp;quot;StatusCode&amp;quot;: 0}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;remove-a-container&#34;&gt;Remove a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;DELETE /containers/(id)&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Remove the container &lt;code&gt;id&lt;/code&gt; from the filesystem&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; DELETE /containers/16253994b7c4?v=1 HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 204 No Content
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;v&lt;/strong&gt; 1/True/true or 0/False/false, Remove the volumes
associated to the container. Default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;force&lt;/strong&gt; - 1/True/true or 0/False/false, Kill then remove the container.
Default false&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;204&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;400&lt;/strong&gt; bad parameter&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;copy-files-or-folders-from-a-container&#34;&gt;Copy files or folders from a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /containers/(id)/copy&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Copy files or folders of container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /containers/4fa6e0f0c678/copy HTTP/1.1
Content-Type: application/json
{
&amp;quot;Resource&amp;quot;: &amp;quot;test.txt&amp;quot;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/x-tar
{{ TAR STREAM }}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;2-2-images&#34;&gt;2.2 Images&lt;/h2&gt;
&lt;h3 id=&#34;list-images&#34;&gt;List Images&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /images/json&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /images/json?all=0 HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
[
{
&amp;quot;RepoTags&amp;quot;: [
&amp;quot;ubuntu:12.04&amp;quot;,
&amp;quot;ubuntu:precise&amp;quot;,
&amp;quot;ubuntu:latest&amp;quot;
],
&amp;quot;Id&amp;quot;: &amp;quot;8dbd9e392a964056420e5d58ca5cc376ef18e2de93b5cc90e868a1bbc8318c1c&amp;quot;,
&amp;quot;Created&amp;quot;: 1365714795,
&amp;quot;Size&amp;quot;: 131506275,
&amp;quot;VirtualSize&amp;quot;: 131506275
},
{
&amp;quot;RepoTags&amp;quot;: [
&amp;quot;ubuntu:12.10&amp;quot;,
&amp;quot;ubuntu:quantal&amp;quot;
],
&amp;quot;ParentId&amp;quot;: &amp;quot;27cf784147099545&amp;quot;,
&amp;quot;Id&amp;quot;: &amp;quot;b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc&amp;quot;,
&amp;quot;Created&amp;quot;: 1364102658,
&amp;quot;Size&amp;quot;: 24653,
&amp;quot;VirtualSize&amp;quot;: 180116135
}
]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;all&lt;/strong&gt; 1/True/true or 0/False/false, default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;filters&lt;/strong&gt; a json encoded value of the filters (a map[string][]string) to process on the images list. Available filters:
&lt;ul&gt;
&lt;li&gt;dangling=true&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;create-an-image&#34;&gt;Create an image&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /images/create&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Create an image, either by pulling it from the registry or by importing it&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /images/create?fromImage=ubuntu HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
{&amp;quot;status&amp;quot;: &amp;quot;Pulling...&amp;quot;}
{&amp;quot;status&amp;quot;: &amp;quot;Pulling&amp;quot;, &amp;quot;progress&amp;quot;: &amp;quot;1 B/ 100 B&amp;quot;, &amp;quot;progressDetail&amp;quot;: {&amp;quot;current&amp;quot;: 1, &amp;quot;total&amp;quot;: 100}}
{&amp;quot;error&amp;quot;: &amp;quot;Invalid...&amp;quot;}
...
When using this endpoint to pull an image from the registry, the
`X-Registry-Auth` header can be used to include
a base64-encoded AuthConfig object.
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;fromImage&lt;/strong&gt; name of the image to pull&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;fromSrc&lt;/strong&gt; source to import. The value may be a URL from which the image
can be retrieved or &lt;code&gt;-&lt;/code&gt; to read the image from the request body.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;repo&lt;/strong&gt; repository&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;tag&lt;/strong&gt; tag&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;registry&lt;/strong&gt; the registry to pull from&lt;/p&gt;
&lt;p&gt;Request Headers:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;X-Registry-Auth&lt;/strong&gt; base64-encoded AuthConfig object&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;inspect-an-image&#34;&gt;Inspect an image&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /images/(name)/json&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Return low-level information on the image &lt;code&gt;name&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /images/ubuntu/json HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
{
&amp;quot;Created&amp;quot;: &amp;quot;2013-03-23T22:24:18.818426-07:00&amp;quot;,
&amp;quot;Container&amp;quot;: &amp;quot;3d67245a8d72ecf13f33dffac9f79dcdf70f75acb84d308770391510e0c23ad0&amp;quot;,
&amp;quot;ContainerConfig&amp;quot;:
{
&amp;quot;Hostname&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;User&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;Memory&amp;quot;: 0,
&amp;quot;MemorySwap&amp;quot;: 0,
&amp;quot;AttachStdin&amp;quot;: false,
&amp;quot;AttachStdout&amp;quot;: false,
&amp;quot;AttachStderr&amp;quot;: false,
&amp;quot;PortSpecs&amp;quot;: null,
&amp;quot;Tty&amp;quot;: true,
&amp;quot;OpenStdin&amp;quot;: true,
&amp;quot;StdinOnce&amp;quot;: false,
&amp;quot;Env&amp;quot;: null,
&amp;quot;Cmd&amp;quot;: [&amp;quot;/bin/bash&amp;quot;],
&amp;quot;Dns&amp;quot;: null,
&amp;quot;Image&amp;quot;: &amp;quot;ubuntu&amp;quot;,
&amp;quot;Volumes&amp;quot;: null,
&amp;quot;VolumesFrom&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;WorkingDir&amp;quot;: &amp;quot;&amp;quot;
},
&amp;quot;Id&amp;quot;: &amp;quot;b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc&amp;quot;,
&amp;quot;Parent&amp;quot;: &amp;quot;27cf784147099545&amp;quot;,
&amp;quot;Size&amp;quot;: 6824592
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such image&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;get-the-history-of-an-image&#34;&gt;Get the history of an image&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /images/(name)/history&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Return the history of the image &lt;code&gt;name&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /images/ubuntu/history HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
[
{
&amp;quot;Id&amp;quot;: &amp;quot;b750fe79269d&amp;quot;,
&amp;quot;Created&amp;quot;: 1364102658,
&amp;quot;CreatedBy&amp;quot;: &amp;quot;/bin/bash&amp;quot;
},
{
&amp;quot;Id&amp;quot;: &amp;quot;27cf78414709&amp;quot;,
&amp;quot;Created&amp;quot;: 1364068391,
&amp;quot;CreatedBy&amp;quot;: &amp;quot;&amp;quot;
}
]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such image&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;push-an-image-on-the-registry&#34;&gt;Push an image on the registry&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /images/(name)/push&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Push the image &lt;code&gt;name&lt;/code&gt; on the registry&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /images/test/push HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
{&amp;quot;status&amp;quot;: &amp;quot;Pushing...&amp;quot;}
{&amp;quot;status&amp;quot;: &amp;quot;Pushing&amp;quot;, &amp;quot;progress&amp;quot;: &amp;quot;1/? (n/a)&amp;quot;, &amp;quot;progressDetail&amp;quot;: {&amp;quot;current&amp;quot;: 1}}}
{&amp;quot;error&amp;quot;: &amp;quot;Invalid...&amp;quot;}
...
If you wish to push an image on to a private registry, that image must already have been tagged
into a repository which references that registry host name and port. This repository name should
then be used in the URL. This mirrors the flow of the CLI.
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /images/registry.acme.com:5000/test/push HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;tag&lt;/strong&gt; the tag to associate with the image on the registry, optional&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Request Headers:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;X-Registry-Auth&lt;/strong&gt; include a base64-encoded AuthConfig
object.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such image&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;tag-an-image-into-a-repository&#34;&gt;Tag an image into a repository&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /images/(name)/tag&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Tag the image &lt;code&gt;name&lt;/code&gt; into a repository&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /images/test/tag?repo=myrepo&amp;amp;force=0&amp;amp;tag=v42 HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 201 OK
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;repo&lt;/strong&gt; The repository to tag in&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;force&lt;/strong&gt; 1/True/true or 0/False/false, default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;tag&lt;/strong&gt; - The new tag name&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;201&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;400&lt;/strong&gt; bad parameter&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such image&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;409&lt;/strong&gt; conflict&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;remove-an-image&#34;&gt;Remove an image&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;DELETE /images/(name)&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Remove the image &lt;code&gt;name&lt;/code&gt; from the filesystem&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; DELETE /images/test HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-type: application/json
[
{&amp;quot;Untagged&amp;quot;: &amp;quot;3e2f21a89f&amp;quot;},
{&amp;quot;Deleted&amp;quot;: &amp;quot;3e2f21a89f&amp;quot;},
{&amp;quot;Deleted&amp;quot;: &amp;quot;53b4f83ac9&amp;quot;}
]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;force&lt;/strong&gt; 1/True/true or 0/False/false, default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;noprune&lt;/strong&gt; 1/True/true or 0/False/false, default false&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such image&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;409&lt;/strong&gt; conflict&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;search-images&#34;&gt;Search images&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /images/search&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Search for an image on &lt;a href=&#34;https://hub.docker.com&#34;&gt;Docker Hub&lt;/a&gt;.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;:
The response keys have changed from API v1.6 to reflect the JSON
sent by the registry server to the docker daemon&amp;rsquo;s request.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /images/search?term=sshd HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
[
{
&amp;quot;description&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;is_official&amp;quot;: false,
&amp;quot;is_automated&amp;quot;: false,
&amp;quot;name&amp;quot;: &amp;quot;wma55/u1210sshd&amp;quot;,
&amp;quot;star_count&amp;quot;: 0
},
{
&amp;quot;description&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;is_official&amp;quot;: false,
&amp;quot;is_automated&amp;quot;: false,
&amp;quot;name&amp;quot;: &amp;quot;jdswinbank/sshd&amp;quot;,
&amp;quot;star_count&amp;quot;: 0
},
{
&amp;quot;description&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;is_official&amp;quot;: false,
&amp;quot;is_automated&amp;quot;: false,
&amp;quot;name&amp;quot;: &amp;quot;vgauthier/sshd&amp;quot;,
&amp;quot;star_count&amp;quot;: 0
}
...
]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;term&lt;/strong&gt; term to search&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;2-3-misc&#34;&gt;2.3 Misc&lt;/h2&gt;
&lt;h3 id=&#34;build-an-image-from-dockerfile-via-stdin&#34;&gt;Build an image from Dockerfile via stdin&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /build&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Build an image from Dockerfile via stdin&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /build HTTP/1.1
{{ TAR STREAM }}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
{&amp;quot;stream&amp;quot;: &amp;quot;Step 1...&amp;quot;}
{&amp;quot;stream&amp;quot;: &amp;quot;...&amp;quot;}
{&amp;quot;error&amp;quot;: &amp;quot;Error...&amp;quot;, &amp;quot;errorDetail&amp;quot;: {&amp;quot;code&amp;quot;: 123, &amp;quot;message&amp;quot;: &amp;quot;Error...&amp;quot;}}
The stream must be a tar archive compressed with one of the
following algorithms: identity (no compression), gzip, bzip2, xz.
The archive must include a file called `Dockerfile`
at its root. It may include any number of other files,
which will be accessible in the build context (See the [*ADD build
command*](/docker/reference/builder/#dockerbuilder)).
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;t&lt;/strong&gt; repository name (and optionally a tag) to be applied to
the resulting image in case of success&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;remote&lt;/strong&gt; git or HTTP/HTTPS URI build source&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;q&lt;/strong&gt; suppress verbose build output&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;nocache&lt;/strong&gt; do not use the cache when building the image&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;rm&lt;/strong&gt; - remove intermediate containers after a successful build (default behavior)&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;forcerm&lt;/strong&gt; - always remove intermediate containers (includes rm)&lt;/p&gt;
&lt;p&gt;Request Headers:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Content-type&lt;/strong&gt; should be set to &lt;code&gt;&amp;quot;application/tar&amp;quot;&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;X-Registry-Config&lt;/strong&gt; base64-encoded ConfigFile object&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;check-auth-configuration&#34;&gt;Check auth configuration&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /auth&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Get the default username and email&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /auth HTTP/1.1
Content-Type: application/json
{
&amp;quot;username&amp;quot;:&amp;quot; hannibal&amp;quot;,
&amp;quot;password: &amp;quot;xxxx&amp;quot;,
&amp;quot;email&amp;quot;: &amp;quot;hannibal@a-team.com&amp;quot;,
&amp;quot;serveraddress&amp;quot;: &amp;quot;https://index.docker.io/v1/&amp;quot;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;204&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;display-system-wide-information&#34;&gt;Display system-wide information&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /info&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Display system-wide information&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /info HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
{
&amp;quot;Containers&amp;quot;: 11,
&amp;quot;Images&amp;quot;: 16,
&amp;quot;Driver&amp;quot;: &amp;quot;btrfs&amp;quot;,
&amp;quot;ExecutionDriver&amp;quot;: &amp;quot;native-0.1&amp;quot;,
&amp;quot;KernelVersion&amp;quot;: &amp;quot;3.12.0-1-amd64&amp;quot;
&amp;quot;Debug&amp;quot;: false,
&amp;quot;NFd&amp;quot;: 11,
&amp;quot;NGoroutines&amp;quot;: 21,
&amp;quot;NEventsListener&amp;quot;: 0,
&amp;quot;InitPath&amp;quot;: &amp;quot;/usr/bin/docker&amp;quot;,
&amp;quot;IndexServerAddress&amp;quot;: [&amp;quot;https://index.docker.io/v1/&amp;quot;],
&amp;quot;MemoryLimit&amp;quot;: true,
&amp;quot;SwapLimit&amp;quot;: false,
&amp;quot;IPv4Forwarding&amp;quot;: true
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;show-the-docker-version-information&#34;&gt;Show the docker version information&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /version&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Show the docker version information&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /version HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
{
&amp;quot;ApiVersion&amp;quot;: &amp;quot;1.12&amp;quot;,
&amp;quot;Version&amp;quot;: &amp;quot;0.2.2&amp;quot;,
&amp;quot;GitCommit&amp;quot;: &amp;quot;5a2a5cc+CHANGES&amp;quot;,
&amp;quot;GoVersion&amp;quot;: &amp;quot;go1.0.3&amp;quot;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;ping-the-docker-server&#34;&gt;Ping the docker server&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /_ping&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Ping the docker server&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /_ping HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: text/plain
OK
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; - no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; - server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;create-a-new-image-from-a-container-s-changes&#34;&gt;Create a new image from a container&amp;rsquo;s changes&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /commit&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Create a new image from a container&amp;rsquo;s changes&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /commit?container=44c004db4b17&amp;amp;comment=message&amp;amp;repo=myrepo HTTP/1.1
Content-Type: application/json
{
&amp;quot;Hostname&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;Domainname&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;User&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;Memory&amp;quot;: 0,
&amp;quot;MemorySwap&amp;quot;: 0,
&amp;quot;CpuShares&amp;quot;: 512,
&amp;quot;Cpuset&amp;quot;: &amp;quot;0,1&amp;quot;,
&amp;quot;AttachStdin&amp;quot;: false,
&amp;quot;AttachStdout&amp;quot;: true,
&amp;quot;AttachStderr&amp;quot;: true,
&amp;quot;PortSpecs&amp;quot;: null,
&amp;quot;Tty&amp;quot;: false,
&amp;quot;OpenStdin&amp;quot;: false,
&amp;quot;StdinOnce&amp;quot;: false,
&amp;quot;Env&amp;quot;: null,
&amp;quot;Cmd&amp;quot;: [
&amp;quot;date&amp;quot;
],
&amp;quot;Volumes&amp;quot;: {
&amp;quot;/tmp&amp;quot;: {}
},
&amp;quot;WorkingDir&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;NetworkDisabled&amp;quot;: false,
&amp;quot;ExposedPorts&amp;quot;: {
&amp;quot;22/tcp&amp;quot;: {}
}
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 201 Created
Content-Type: application/vnd.docker.raw-stream
{&amp;quot;Id&amp;quot;: &amp;quot;596069db4bf5&amp;quot;}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Json Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;config&lt;/strong&gt; - the container&amp;rsquo;s configuration&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;container&lt;/strong&gt; source container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;repo&lt;/strong&gt; repository&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;tag&lt;/strong&gt; tag&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;comment&lt;/strong&gt; commit message&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;author&lt;/strong&gt; author (e.g., &amp;ldquo;John Hannibal Smith
&amp;lt;&lt;a href=&#34;mailto:hannibal%40a-team.com&#34;&gt;hannibal@a-team.com&lt;/a&gt;&amp;gt;&amp;ldquo;)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;201&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;monitor-docker-s-events&#34;&gt;Monitor Docker&amp;rsquo;s events&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /events&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Get container events from docker, either in real time via streaming, or via
polling (using since).&lt;/p&gt;
&lt;p&gt;Docker containers will report the following events:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;create, destroy, die, export, kill, pause, restart, start, stop, unpause
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;and Docker images will report:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;untag, delete
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /events?since=1374067924
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
{&amp;quot;status&amp;quot;: &amp;quot;create&amp;quot;, &amp;quot;id&amp;quot;: &amp;quot;dfdf82bd3881&amp;quot;,&amp;quot;from&amp;quot;: &amp;quot;ubuntu:latest&amp;quot;, &amp;quot;time&amp;quot;:1374067924}
{&amp;quot;status&amp;quot;: &amp;quot;start&amp;quot;, &amp;quot;id&amp;quot;: &amp;quot;dfdf82bd3881&amp;quot;,&amp;quot;from&amp;quot;: &amp;quot;ubuntu:latest&amp;quot;, &amp;quot;time&amp;quot;:1374067924}
{&amp;quot;status&amp;quot;: &amp;quot;stop&amp;quot;, &amp;quot;id&amp;quot;: &amp;quot;dfdf82bd3881&amp;quot;,&amp;quot;from&amp;quot;: &amp;quot;ubuntu:latest&amp;quot;, &amp;quot;time&amp;quot;:1374067966}
{&amp;quot;status&amp;quot;: &amp;quot;destroy&amp;quot;, &amp;quot;id&amp;quot;: &amp;quot;dfdf82bd3881&amp;quot;,&amp;quot;from&amp;quot;: &amp;quot;ubuntu:latest&amp;quot;, &amp;quot;time&amp;quot;:1374067970}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;since&lt;/strong&gt; timestamp used for polling&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;until&lt;/strong&gt; timestamp used for polling&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;get-a-tarball-containing-all-images-in-a-repository&#34;&gt;Get a tarball containing all images in a repository&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /images/(name)/get&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Get a tarball containing all images and metadata for the repository specified
by &lt;code&gt;name&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;If &lt;code&gt;name&lt;/code&gt; is a specific name and tag (e.g. ubuntu:latest), then only that image
(and its parents) are returned. If &lt;code&gt;name&lt;/code&gt; is an image ID, similarly only that
image (and its parents) are returned, but with the exclusion of the
&amp;lsquo;repositories&amp;rsquo; file in the tarball, as there were no image names referenced.&lt;/p&gt;
&lt;p&gt;See the &lt;a href=&#34;#image-tarball-format&#34;&gt;image tarball format&lt;/a&gt; for more details.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /images/ubuntu/get
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/x-tar
Binary data stream
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;get-a-tarball-containing-all-images&#34;&gt;Get a tarball containing all images.&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /images/get&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Get a tarball containing all images and metadata for one or more repositories.&lt;/p&gt;
&lt;p&gt;For each value of the &lt;code&gt;names&lt;/code&gt; parameter: if it is a specific name and tag (e.g.
ubuntu:latest), then only that image (and its parents) are returned; if it is
an image ID, similarly only that image (and its parents) are returned and there
would be no names referenced in the &amp;lsquo;repositories&amp;rsquo; file for this image ID.&lt;/p&gt;
&lt;p&gt;See the &lt;a href=&#34;#image-tarball-format&#34;&gt;image tarball format&lt;/a&gt; for more details.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /images/get?names=myname%2Fmyapp%3Alatest&amp;amp;names=busybox
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/x-tar
Binary data stream
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;load-a-tarball-with-a-set-of-images-and-tags-into-docker&#34;&gt;Load a tarball with a set of images and tags into docker&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /images/load&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Load a set of images and tags into the docker repository.
See the &lt;a href=&#34;#image-tarball-format&#34;&gt;image tarball format&lt;/a&gt; for more details.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /images/load
Tarball in body
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;image-tarball-format&#34;&gt;Image tarball format&lt;/h3&gt;
&lt;p&gt;An image tarball contains one directory per image layer (named using its long ID),
each containing three files:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;VERSION&lt;/code&gt;: currently &lt;code&gt;1.0&lt;/code&gt; - the file format version&lt;/li&gt;
&lt;li&gt;&lt;code&gt;json&lt;/code&gt;: detailed layer information, similar to &lt;code&gt;docker inspect layer_id&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;layer.tar&lt;/code&gt;: A tarfile containing the filesystem changes in this layer&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The &lt;code&gt;layer.tar&lt;/code&gt; file will contain &lt;code&gt;aufs&lt;/code&gt; style &lt;code&gt;.wh..wh.aufs&lt;/code&gt; files and directories
for storing attribute changes and deletions.&lt;/p&gt;
&lt;p&gt;If the tarball defines a repository, there will also be a &lt;code&gt;repositories&lt;/code&gt; file at
the root that contains a list of repository and tag names mapped to layer IDs.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;{&amp;quot;hello-world&amp;quot;:
{&amp;quot;latest&amp;quot;: &amp;quot;565a9d68a73f6706862bfe8409a7f659776d4d60a8d096eb4a3cbce6999cc2a1&amp;quot;}
}
&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&#34;exec-create&#34;&gt;Exec Create&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /containers/(id)/exec&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Sets up an exec instance in a running container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /containers/e90e34656806/exec HTTP/1.1
Content-Type: application/json
{
&amp;quot;AttachStdin&amp;quot;: false,
&amp;quot;AttachStdout&amp;quot;: true,
&amp;quot;AttachStderr&amp;quot;: true,
&amp;quot;Tty&amp;quot;: false,
&amp;quot;Cmd&amp;quot;: [
&amp;quot;date&amp;quot;
],
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 201 OK
Content-Type: application/json
{
&amp;quot;Id&amp;quot;: &amp;quot;f90e34656806&amp;quot;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Json Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;AttachStdin&lt;/strong&gt; - Boolean value, attaches to stdin of the exec command.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;AttachStdout&lt;/strong&gt; - Boolean value, attaches to stdout of the exec command.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;AttachStderr&lt;/strong&gt; - Boolean value, attaches to stderr of the exec command.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Tty&lt;/strong&gt; - Boolean value to allocate a pseudo-TTY&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Cmd&lt;/strong&gt; - Command to run specified as a string or an array of strings.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;201&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;exec-start&#34;&gt;Exec Start&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /exec/(id)/start&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Starts a previously set up exec instance &lt;code&gt;id&lt;/code&gt;. If &lt;code&gt;detach&lt;/code&gt; is true, this API
returns after starting the &lt;code&gt;exec&lt;/code&gt; command. Otherwise, this API sets up an
interactive session with the &lt;code&gt;exec&lt;/code&gt; command.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /exec/e90e34656806/start HTTP/1.1
Content-Type: application/json
{
&amp;quot;Detach&amp;quot;: false,
&amp;quot;Tty&amp;quot;: false,
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 201 OK
Content-Type: application/json
{{ STREAM }}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Json Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Detach&lt;/strong&gt; - Detach from the exec command&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Tty&lt;/strong&gt; - Boolean value to allocate a pseudo-TTY&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;201&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;404&lt;/strong&gt; no such exec instance&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Stream details&lt;/strong&gt;:
Similar to the stream behavior of &lt;code&gt;POST /container/(id)/attach&lt;/code&gt; API&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;exec-resize&#34;&gt;Exec Resize&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /exec/(id)/resize&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Resizes the tty session used by the exec command &lt;code&gt;id&lt;/code&gt;.
This API is valid only if &lt;code&gt;tty&lt;/code&gt; was specified as part of creating and starting the exec command.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /exec/e90e34656806/resize HTTP/1.1
Content-Type: plain/text
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 201 OK
Content-Type: plain/text
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;h&lt;/strong&gt; height of tty session&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;w&lt;/strong&gt; width&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;201&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such exec instance&lt;/li&gt;
&lt;/ul&gt;
&lt;h1 id=&#34;3-going-further&#34;&gt;3. Going further&lt;/h1&gt;
&lt;h2 id=&#34;3-1-inside-docker-run&#34;&gt;3.1 Inside &lt;code&gt;docker run&lt;/code&gt;&lt;/h2&gt;
&lt;p&gt;As an example, the &lt;code&gt;docker run&lt;/code&gt; command line makes the following API calls:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Create the container&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If the status code is 404, it means the image doesn&amp;rsquo;t exist:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Try to pull it&lt;/li&gt;
&lt;li&gt;Then retry to create the container&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Start the container&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If you are not in detached mode:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Attach to the container, using logs=1 (to have stdout and
stderr from the container&amp;rsquo;s start) and stream=1&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If in detached mode or only stdin is attached:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Display the container&amp;rsquo;s id&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;3-2-hijacking&#34;&gt;3.2 Hijacking&lt;/h2&gt;
&lt;p&gt;In this version of the API, /attach, uses hijacking to transport stdin,
stdout and stderr on the same socket. This might change in the future.&lt;/p&gt;
&lt;h2 id=&#34;3-3-cors-requests&#34;&gt;3.3 CORS Requests&lt;/h2&gt;
&lt;p&gt;To enable cross origin requests to the remote api add the flag
&amp;ldquo;&amp;ndash;api-enable-cors&amp;rdquo; when running docker in daemon mode.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ docker -d -H=&amp;quot;192.168.1.9:2375&amp;quot; --api-enable-cors
&lt;/code&gt;&lt;/pre&gt;
</description>
</item>
<item>
<title>Remote API v1.16</title>
<link>http://localhost/reference/api/docker_remote_api_v1.16/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>http://localhost/reference/api/docker_remote_api_v1.16/</guid>
<description>
&lt;h1 id=&#34;docker-remote-api-v1-16&#34;&gt;Docker Remote API v1.16&lt;/h1&gt;
&lt;h2 id=&#34;1-brief-introduction&#34;&gt;1. Brief introduction&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;The Remote API has replaced &lt;code&gt;rcli&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The daemon listens on &lt;code&gt;unix:///var/run/docker.sock&lt;/code&gt; but you can
&lt;a href=&#34;http://localhost/articles/basics/#bind-docker-to-another-hostport-or-a-unix-socket&#34;&gt;Bind Docker to another host/port or a Unix socket&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;The API tends to be REST, but for some complex commands, like &lt;code&gt;attach&lt;/code&gt;
or &lt;code&gt;pull&lt;/code&gt;, the HTTP connection is hijacked to transport &lt;code&gt;STDOUT&lt;/code&gt;,
&lt;code&gt;STDIN&lt;/code&gt; and &lt;code&gt;STDERR&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;h1 id=&#34;2-endpoints&#34;&gt;2. Endpoints&lt;/h1&gt;
&lt;h2 id=&#34;2-1-containers&#34;&gt;2.1 Containers&lt;/h2&gt;
&lt;h3 id=&#34;list-containers&#34;&gt;List containers&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /containers/json&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;List containers&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /containers/json?all=1&amp;amp;before=8dfafdbc3a40&amp;amp;size=1 HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
[
{
&amp;quot;Id&amp;quot;: &amp;quot;8dfafdbc3a40&amp;quot;,
&amp;quot;Image&amp;quot;: &amp;quot;ubuntu:latest&amp;quot;,
&amp;quot;Command&amp;quot;: &amp;quot;echo 1&amp;quot;,
&amp;quot;Created&amp;quot;: 1367854155,
&amp;quot;Status&amp;quot;: &amp;quot;Exit 0&amp;quot;,
&amp;quot;Ports&amp;quot;: [{&amp;quot;PrivatePort&amp;quot;: 2222, &amp;quot;PublicPort&amp;quot;: 3333, &amp;quot;Type&amp;quot;: &amp;quot;tcp&amp;quot;}],
&amp;quot;SizeRw&amp;quot;: 12288,
&amp;quot;SizeRootFs&amp;quot;: 0
},
{
&amp;quot;Id&amp;quot;: &amp;quot;9cd87474be90&amp;quot;,
&amp;quot;Image&amp;quot;: &amp;quot;ubuntu:latest&amp;quot;,
&amp;quot;Command&amp;quot;: &amp;quot;echo 222222&amp;quot;,
&amp;quot;Created&amp;quot;: 1367854155,
&amp;quot;Status&amp;quot;: &amp;quot;Exit 0&amp;quot;,
&amp;quot;Ports&amp;quot;: [],
&amp;quot;SizeRw&amp;quot;: 12288,
&amp;quot;SizeRootFs&amp;quot;: 0
},
{
&amp;quot;Id&amp;quot;: &amp;quot;3176a2479c92&amp;quot;,
&amp;quot;Image&amp;quot;: &amp;quot;ubuntu:latest&amp;quot;,
&amp;quot;Command&amp;quot;: &amp;quot;echo 3333333333333333&amp;quot;,
&amp;quot;Created&amp;quot;: 1367854154,
&amp;quot;Status&amp;quot;: &amp;quot;Exit 0&amp;quot;,
&amp;quot;Ports&amp;quot;:[],
&amp;quot;SizeRw&amp;quot;:12288,
&amp;quot;SizeRootFs&amp;quot;:0
},
{
&amp;quot;Id&amp;quot;: &amp;quot;4cb07b47f9fb&amp;quot;,
&amp;quot;Image&amp;quot;: &amp;quot;ubuntu:latest&amp;quot;,
&amp;quot;Command&amp;quot;: &amp;quot;echo 444444444444444444444444444444444&amp;quot;,
&amp;quot;Created&amp;quot;: 1367854152,
&amp;quot;Status&amp;quot;: &amp;quot;Exit 0&amp;quot;,
&amp;quot;Ports&amp;quot;: [],
&amp;quot;SizeRw&amp;quot;: 12288,
&amp;quot;SizeRootFs&amp;quot;: 0
}
]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;all&lt;/strong&gt; 1/True/true or 0/False/false, Show all containers.
Only running containers are shown by default (i.e., this defaults to false)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;limit&lt;/strong&gt; Show &lt;code&gt;limit&lt;/code&gt; last created
containers, include non-running ones.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;since&lt;/strong&gt; Show only containers created since Id, include
non-running ones.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;before&lt;/strong&gt; Show only containers created before Id, include
non-running ones.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;size&lt;/strong&gt; 1/True/true or 0/False/false, Show the containers
sizes&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;filters&lt;/strong&gt; - a json encoded value of the filters (a map[string][]string) to process on the containers list. Available filters:
&lt;ul&gt;
&lt;li&gt;exited=&amp;lt;int&amp;gt; &amp;ndash; containers with exit code of &amp;lt;int&amp;gt;&lt;/li&gt;
&lt;li&gt;status=(restarting|running|paused|exited)&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;400&lt;/strong&gt; bad parameter&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;create-a-container&#34;&gt;Create a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /containers/create&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Create a container&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /containers/create HTTP/1.1
Content-Type: application/json
{
&amp;quot;Hostname&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;Domainname&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;User&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;Memory&amp;quot;: 0,
&amp;quot;MemorySwap&amp;quot;: 0,
&amp;quot;CpuShares&amp;quot;: 512,
&amp;quot;Cpuset&amp;quot;: &amp;quot;0,1&amp;quot;,
&amp;quot;AttachStdin&amp;quot;: false,
&amp;quot;AttachStdout&amp;quot;: true,
&amp;quot;AttachStderr&amp;quot;: true,
&amp;quot;Tty&amp;quot;: false,
&amp;quot;OpenStdin&amp;quot;: false,
&amp;quot;StdinOnce&amp;quot;: false,
&amp;quot;Env&amp;quot;: null,
&amp;quot;Cmd&amp;quot;: [
&amp;quot;date&amp;quot;
],
&amp;quot;Entrypoint&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;Image&amp;quot;: &amp;quot;ubuntu&amp;quot;,
&amp;quot;Volumes&amp;quot;: {
&amp;quot;/tmp&amp;quot;: {}
},
&amp;quot;WorkingDir&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;NetworkDisabled&amp;quot;: false,
&amp;quot;MacAddress&amp;quot;: &amp;quot;12:34:56:78:9a:bc&amp;quot;,
&amp;quot;ExposedPorts&amp;quot;: {
&amp;quot;22/tcp&amp;quot;: {}
},
&amp;quot;SecurityOpts&amp;quot;: [&amp;quot;&amp;quot;],
&amp;quot;HostConfig&amp;quot;: {
&amp;quot;Binds&amp;quot;: [&amp;quot;/tmp:/tmp&amp;quot;],
&amp;quot;Links&amp;quot;: [&amp;quot;redis3:redis&amp;quot;],
&amp;quot;LxcConf&amp;quot;: {&amp;quot;lxc.utsname&amp;quot;:&amp;quot;docker&amp;quot;},
&amp;quot;PortBindings&amp;quot;: { &amp;quot;22/tcp&amp;quot;: [{ &amp;quot;HostPort&amp;quot;: &amp;quot;11022&amp;quot; }] },
&amp;quot;PublishAllPorts&amp;quot;: false,
&amp;quot;Privileged&amp;quot;: false,
&amp;quot;Dns&amp;quot;: [&amp;quot;8.8.8.8&amp;quot;],
&amp;quot;DnsSearch&amp;quot;: [&amp;quot;&amp;quot;],
&amp;quot;ExtraHosts&amp;quot;: null,
&amp;quot;VolumesFrom&amp;quot;: [&amp;quot;parent&amp;quot;, &amp;quot;other:ro&amp;quot;],
&amp;quot;CapAdd&amp;quot;: [&amp;quot;NET_ADMIN&amp;quot;],
&amp;quot;CapDrop&amp;quot;: [&amp;quot;MKNOD&amp;quot;],
&amp;quot;RestartPolicy&amp;quot;: { &amp;quot;Name&amp;quot;: &amp;quot;&amp;quot;, &amp;quot;MaximumRetryCount&amp;quot;: 0 },
&amp;quot;NetworkMode&amp;quot;: &amp;quot;bridge&amp;quot;,
&amp;quot;Devices&amp;quot;: []
}
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 201 Created
Content-Type: application/json
{
&amp;quot;Id&amp;quot;:&amp;quot;e90e34656806&amp;quot;
&amp;quot;Warnings&amp;quot;:[]
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Json Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Hostname&lt;/strong&gt; - A string value containing the desired hostname to use for the
container.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Domainname&lt;/strong&gt; - A string value containing the desired domain name to use
for the container.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;User&lt;/strong&gt; - A string value containing the user to use inside the container.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Memory&lt;/strong&gt; - Memory limit in bytes.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;MemorySwap&lt;/strong&gt;- Total memory usage (memory + swap); set &lt;code&gt;-1&lt;/code&gt; to disable swap.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;CpuShares&lt;/strong&gt; - An integer value containing the CPU Shares for container
(ie. the relative weight vs other containers).
&lt;strong&gt;CpuSet&lt;/strong&gt; - String value containing the cgroups Cpuset to use.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;AttachStdin&lt;/strong&gt; - Boolean value, attaches to stdin.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;AttachStdout&lt;/strong&gt; - Boolean value, attaches to stdout.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;AttachStderr&lt;/strong&gt; - Boolean value, attaches to stderr.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Tty&lt;/strong&gt; - Boolean value, Attach standard streams to a tty, including stdin if it is not closed.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;OpenStdin&lt;/strong&gt; - Boolean value, opens stdin,&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;StdinOnce&lt;/strong&gt; - Boolean value, close stdin after the 1 attached client disconnects.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Env&lt;/strong&gt; - A list of environment variables in the form of &lt;code&gt;VAR=value&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Cmd&lt;/strong&gt; - Command to run specified as a string or an array of strings.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Entrypoint&lt;/strong&gt; - Set the entrypoint for the container a a string or an array
of strings&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Image&lt;/strong&gt; - String value containing the image name to use for the container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Volumes&lt;/strong&gt; An object mapping mountpoint paths (strings) inside the
container to empty objects.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;WorkingDir&lt;/strong&gt; - A string value containing the working dir for commands to
run in.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;NetworkDisabled&lt;/strong&gt; - Boolean value, when true disables networking for the
container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;ExposedPorts&lt;/strong&gt; - An object mapping ports to an empty object in the form of:
&lt;code&gt;&amp;quot;ExposedPorts&amp;quot;: { &amp;quot;&amp;lt;port&amp;gt;/&amp;lt;tcp|udp&amp;gt;: {}&amp;quot; }&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;SecurityOpts&lt;/strong&gt;: A list of string values to customize labels for MLS
systems, such as SELinux.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;HostConfig&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Binds&lt;/strong&gt; A list of volume bindings for this container. Each volume
binding is a string of the form &lt;code&gt;container_path&lt;/code&gt; (to create a new
volume for the container), &lt;code&gt;host_path:container_path&lt;/code&gt; (to bind-mount
a host path into the container), or &lt;code&gt;host_path:container_path:ro&lt;/code&gt;
(to make the bind-mount read-only inside the container).&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Links&lt;/strong&gt; - A list of links for the container. Each link entry should be
in the form of &amp;ldquo;container_name:alias&amp;rdquo;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;LxcConf&lt;/strong&gt; - LXC specific configurations. These configurations will only
work when using the &lt;code&gt;lxc&lt;/code&gt; execution driver.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;PortBindings&lt;/strong&gt; - A map of exposed container ports and the host port they
should map to. It should be specified in the form
&lt;code&gt;{ &amp;lt;port&amp;gt;/&amp;lt;protocol&amp;gt;: [{ &amp;quot;HostPort&amp;quot;: &amp;quot;&amp;lt;port&amp;gt;&amp;quot; }] }&lt;/code&gt;
Take note that &lt;code&gt;port&lt;/code&gt; is specified as a string and not an integer value.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;PublishAllPorts&lt;/strong&gt; - Allocates a random host port for all of a container&amp;rsquo;s
exposed ports. Specified as a boolean value.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Privileged&lt;/strong&gt; - Gives the container full access to the host. Specified as
a boolean value.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Dns&lt;/strong&gt; - A list of dns servers for the container to use.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;DnsSearch&lt;/strong&gt; - A list of DNS search domains&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;ExtraHosts&lt;/strong&gt; - A list of hostnames/IP mappings to be added to the
container&amp;rsquo;s &lt;code&gt;/etc/hosts&lt;/code&gt; file. Specified in the form &lt;code&gt;[&amp;quot;hostname:IP&amp;quot;]&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;VolumesFrom&lt;/strong&gt; - A list of volumes to inherit from another container.
Specified in the form &lt;code&gt;&amp;lt;container name&amp;gt;[:&amp;lt;ro|rw&amp;gt;]&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;CapAdd&lt;/strong&gt; - A list of kernel capabilities to add to the container.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Capdrop&lt;/strong&gt; - A list of kernel capabilities to drop from the container.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;RestartPolicy&lt;/strong&gt; The behavior to apply when the container exits. The
value is an object with a &lt;code&gt;Name&lt;/code&gt; property of either &lt;code&gt;&amp;quot;always&amp;quot;&lt;/code&gt; to
always restart or &lt;code&gt;&amp;quot;on-failure&amp;quot;&lt;/code&gt; to restart only when the container
exit code is non-zero. If &lt;code&gt;on-failure&lt;/code&gt; is used, &lt;code&gt;MaximumRetryCount&lt;/code&gt;
controls the number of times to retry before giving up.
The default is not to restart. (optional)
An ever increasing delay (double the previous delay, starting at 100mS)
is added before each restart to prevent flooding the server.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;NetworkMode&lt;/strong&gt; - Sets the networking mode for the container. Supported
values are: &lt;code&gt;bridge&lt;/code&gt;, &lt;code&gt;host&lt;/code&gt;, and &lt;code&gt;container:&amp;lt;name|id&amp;gt;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Devices&lt;/strong&gt; - A list of devices to add to the container specified in the
form
&lt;code&gt;{ &amp;quot;PathOnHost&amp;quot;: &amp;quot;/dev/deviceName&amp;quot;, &amp;quot;PathInContainer&amp;quot;: &amp;quot;/dev/deviceName&amp;quot;, &amp;quot;CgroupPermissions&amp;quot;: &amp;quot;mrw&amp;quot;}&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;name&lt;/strong&gt; Assign the specified name to the container. Must
match &lt;code&gt;/?[a-zA-Z0-9_-]+&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;201&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;406&lt;/strong&gt; impossible to attach (container not running)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;inspect-a-container&#34;&gt;Inspect a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /containers/(id)/json&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Return low-level information on the container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /containers/4fa6e0f0c678/json HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
{
&amp;quot;Id&amp;quot;: &amp;quot;4fa6e0f0c6786287e131c3852c58a2e01cc697a68231826813597e4994f1d6e2&amp;quot;,
&amp;quot;Created&amp;quot;: &amp;quot;2013-05-07T14:51:42.041847+02:00&amp;quot;,
&amp;quot;Path&amp;quot;: &amp;quot;date&amp;quot;,
&amp;quot;Args&amp;quot;: [],
&amp;quot;Config&amp;quot;: {
&amp;quot;Hostname&amp;quot;: &amp;quot;4fa6e0f0c678&amp;quot;,
&amp;quot;User&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;Memory&amp;quot;: 0,
&amp;quot;MemorySwap&amp;quot;: 0,
&amp;quot;AttachStdin&amp;quot;: false,
&amp;quot;AttachStdout&amp;quot;: true,
&amp;quot;AttachStderr&amp;quot;: true,
&amp;quot;PortSpecs&amp;quot;: null,
&amp;quot;Tty&amp;quot;: false,
&amp;quot;OpenStdin&amp;quot;: false,
&amp;quot;StdinOnce&amp;quot;: false,
&amp;quot;Env&amp;quot;: null,
&amp;quot;Cmd&amp;quot;: [
&amp;quot;date&amp;quot;
],
&amp;quot;Dns&amp;quot;: null,
&amp;quot;Image&amp;quot;: &amp;quot;ubuntu&amp;quot;,
&amp;quot;Volumes&amp;quot;: {},
&amp;quot;VolumesFrom&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;WorkingDir&amp;quot;: &amp;quot;&amp;quot;
},
&amp;quot;State&amp;quot;: {
&amp;quot;Running&amp;quot;: false,
&amp;quot;Pid&amp;quot;: 0,
&amp;quot;ExitCode&amp;quot;: 0,
&amp;quot;StartedAt&amp;quot;: &amp;quot;2013-05-07T14:51:42.087658+02:01360&amp;quot;,
&amp;quot;Ghost&amp;quot;: false
},
&amp;quot;Image&amp;quot;: &amp;quot;b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc&amp;quot;,
&amp;quot;NetworkSettings&amp;quot;: {
&amp;quot;IpAddress&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;IpPrefixLen&amp;quot;: 0,
&amp;quot;Gateway&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;Bridge&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;PortMapping&amp;quot;: null
},
&amp;quot;SysInitPath&amp;quot;: &amp;quot;/home/kitty/go/src/github.com/docker/docker/bin/docker&amp;quot;,
&amp;quot;ResolvConfPath&amp;quot;: &amp;quot;/etc/resolv.conf&amp;quot;,
&amp;quot;Volumes&amp;quot;: {},
&amp;quot;HostConfig&amp;quot;: {
&amp;quot;Binds&amp;quot;: null,
&amp;quot;ContainerIDFile&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;LxcConf&amp;quot;: [],
&amp;quot;Privileged&amp;quot;: false,
&amp;quot;PortBindings&amp;quot;: {
&amp;quot;80/tcp&amp;quot;: [
{
&amp;quot;HostIp&amp;quot;: &amp;quot;0.0.0.0&amp;quot;,
&amp;quot;HostPort&amp;quot;: &amp;quot;49153&amp;quot;
}
]
},
&amp;quot;Links&amp;quot;: [&amp;quot;/name:alias&amp;quot;],
&amp;quot;PublishAllPorts&amp;quot;: false,
&amp;quot;CapAdd&amp;quot;: [&amp;quot;NET_ADMIN&amp;quot;],
&amp;quot;CapDrop&amp;quot;: [&amp;quot;MKNOD&amp;quot;]
}
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;list-processes-running-inside-a-container&#34;&gt;List processes running inside a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /containers/(id)/top&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;List processes running inside the container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /containers/4fa6e0f0c678/top HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
{
&amp;quot;Titles&amp;quot;: [
&amp;quot;USER&amp;quot;,
&amp;quot;PID&amp;quot;,
&amp;quot;%CPU&amp;quot;,
&amp;quot;%MEM&amp;quot;,
&amp;quot;VSZ&amp;quot;,
&amp;quot;RSS&amp;quot;,
&amp;quot;TTY&amp;quot;,
&amp;quot;STAT&amp;quot;,
&amp;quot;START&amp;quot;,
&amp;quot;TIME&amp;quot;,
&amp;quot;COMMAND&amp;quot;
],
&amp;quot;Processes&amp;quot;: [
[&amp;quot;root&amp;quot;,&amp;quot;20147&amp;quot;,&amp;quot;0.0&amp;quot;,&amp;quot;0.1&amp;quot;,&amp;quot;18060&amp;quot;,&amp;quot;1864&amp;quot;,&amp;quot;pts/4&amp;quot;,&amp;quot;S&amp;quot;,&amp;quot;10:06&amp;quot;,&amp;quot;0:00&amp;quot;,&amp;quot;bash&amp;quot;],
[&amp;quot;root&amp;quot;,&amp;quot;20271&amp;quot;,&amp;quot;0.0&amp;quot;,&amp;quot;0.0&amp;quot;,&amp;quot;4312&amp;quot;,&amp;quot;352&amp;quot;,&amp;quot;pts/4&amp;quot;,&amp;quot;S+&amp;quot;,&amp;quot;10:07&amp;quot;,&amp;quot;0:00&amp;quot;,&amp;quot;sleep&amp;quot;,&amp;quot;10&amp;quot;]
]
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;ps_args&lt;/strong&gt; ps arguments to use (e.g., aux)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;get-container-logs&#34;&gt;Get container logs&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /containers/(id)/logs&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Get stdout and stderr logs from the container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /containers/4fa6e0f0c678/logs?stderr=1&amp;amp;stdout=1&amp;amp;timestamps=1&amp;amp;follow=1&amp;amp;tail=10 HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/vnd.docker.raw-stream
{{ STREAM }}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;follow&lt;/strong&gt; 1/True/true or 0/False/false, return stream. Default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;stdout&lt;/strong&gt; 1/True/true or 0/False/false, show stdout log. Default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;stderr&lt;/strong&gt; 1/True/true or 0/False/false, show stderr log. Default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;timestamps&lt;/strong&gt; 1/True/true or 0/False/false, print timestamps for
every log line. Default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;tail&lt;/strong&gt; Output specified number of lines at the end of logs: &lt;code&gt;all&lt;/code&gt; or &lt;code&gt;&amp;lt;number&amp;gt;&lt;/code&gt;. Default all&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;inspect-changes-on-a-container-s-filesystem&#34;&gt;Inspect changes on a container&amp;rsquo;s filesystem&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /containers/(id)/changes&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Inspect changes on container &lt;code&gt;id&lt;/code&gt;&amp;rsquo;s filesystem&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /containers/4fa6e0f0c678/changes HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
[
{
&amp;quot;Path&amp;quot;: &amp;quot;/dev&amp;quot;,
&amp;quot;Kind&amp;quot;: 0
},
{
&amp;quot;Path&amp;quot;: &amp;quot;/dev/kmsg&amp;quot;,
&amp;quot;Kind&amp;quot;: 1
},
{
&amp;quot;Path&amp;quot;: &amp;quot;/test&amp;quot;,
&amp;quot;Kind&amp;quot;: 1
}
]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;export-a-container&#34;&gt;Export a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /containers/(id)/export&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Export the contents of container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /containers/4fa6e0f0c678/export HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/octet-stream
{{ TAR STREAM }}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;resize-a-container-tty&#34;&gt;Resize a container TTY&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /containers/(id)/resize?h=&amp;lt;height&amp;gt;&amp;amp;w=&amp;lt;width&amp;gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Resize the TTY for container with &lt;code&gt;id&lt;/code&gt;. The container must be restarted for the resize to take effect.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /containers/4fa6e0f0c678/resize?h=40&amp;amp;w=80 HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Length: 0
Content-Type: text/plain; charset=utf-8
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; No such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; Cannot resize container&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;start-a-container&#34;&gt;Start a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /containers/(id)/start&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Start the container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /containers/(id)/start HTTP/1.1
Content-Type: application/json
{
&amp;quot;Binds&amp;quot;: [&amp;quot;/tmp:/tmp&amp;quot;],
&amp;quot;Links&amp;quot;: [&amp;quot;redis3:redis&amp;quot;],
&amp;quot;LxcConf&amp;quot;: {&amp;quot;lxc.utsname&amp;quot;:&amp;quot;docker&amp;quot;},
&amp;quot;PortBindings&amp;quot;: { &amp;quot;22/tcp&amp;quot;: [{ &amp;quot;HostPort&amp;quot;: &amp;quot;11022&amp;quot; }] },
&amp;quot;PublishAllPorts&amp;quot;: false,
&amp;quot;Privileged&amp;quot;: false,
&amp;quot;Dns&amp;quot;: [&amp;quot;8.8.8.8&amp;quot;],
&amp;quot;DnsSearch&amp;quot;: [&amp;quot;&amp;quot;],
&amp;quot;VolumesFrom&amp;quot;: [&amp;quot;parent&amp;quot;, &amp;quot;other:ro&amp;quot;],
&amp;quot;CapAdd&amp;quot;: [&amp;quot;NET_ADMIN&amp;quot;],
&amp;quot;CapDrop&amp;quot;: [&amp;quot;MKNOD&amp;quot;],
&amp;quot;RestartPolicy&amp;quot;: { &amp;quot;Name&amp;quot;: &amp;quot;&amp;quot;, &amp;quot;MaximumRetryCount&amp;quot;: 0 },
&amp;quot;NetworkMode&amp;quot;: &amp;quot;bridge&amp;quot;,
&amp;quot;Devices&amp;quot;: []
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 204 No Content
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Json Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Binds&lt;/strong&gt; A list of volume bindings for this container. Each volume
binding is a string of the form &lt;code&gt;container_path&lt;/code&gt; (to create a new
volume for the container), &lt;code&gt;host_path:container_path&lt;/code&gt; (to bind-mount
a host path into the container), or &lt;code&gt;host_path:container_path:ro&lt;/code&gt;
(to make the bind-mount read-only inside the container).&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Links&lt;/strong&gt; - A list of links for the container. Each link entry should be of
of the form &amp;ldquo;container_name:alias&amp;rdquo;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;LxcConf&lt;/strong&gt; - LXC specific configurations. These configurations will only
work when using the &lt;code&gt;lxc&lt;/code&gt; execution driver.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;PortBindings&lt;/strong&gt; - A map of exposed container ports and the host port they
should map to. It should be specified in the form
&lt;code&gt;{ &amp;lt;port&amp;gt;/&amp;lt;protocol&amp;gt;: [{ &amp;quot;HostPort&amp;quot;: &amp;quot;&amp;lt;port&amp;gt;&amp;quot; }] }&lt;/code&gt;
Take note that &lt;code&gt;port&lt;/code&gt; is specified as a string and not an integer value.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;PublishAllPorts&lt;/strong&gt; - Allocates a random host port for all of a container&amp;rsquo;s
exposed ports. Specified as a boolean value.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Privileged&lt;/strong&gt; - Gives the container full access to the host. Specified as
a boolean value.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Dns&lt;/strong&gt; - A list of dns servers for the container to use.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;DnsSearch&lt;/strong&gt; - A list of DNS search domains&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;VolumesFrom&lt;/strong&gt; - A list of volumes to inherit from another container.
Specified in the form &lt;code&gt;&amp;lt;container name&amp;gt;[:&amp;lt;ro|rw&amp;gt;]&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;CapAdd&lt;/strong&gt; - A list of kernel capabilities to add to the container.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Capdrop&lt;/strong&gt; - A list of kernel capabilities to drop from the container.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;RestartPolicy&lt;/strong&gt; The behavior to apply when the container exits. The
value is an object with a &lt;code&gt;Name&lt;/code&gt; property of either &lt;code&gt;&amp;quot;always&amp;quot;&lt;/code&gt; to
always restart or &lt;code&gt;&amp;quot;on-failure&amp;quot;&lt;/code&gt; to restart only when the container
exit code is non-zero. If &lt;code&gt;on-failure&lt;/code&gt; is used, &lt;code&gt;MaximumRetryCount&lt;/code&gt;
controls the number of times to retry before giving up.
The default is not to restart. (optional)
An ever increasing delay (double the previous delay, starting at 100mS)
is added before each restart to prevent flooding the server.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;NetworkMode&lt;/strong&gt; - Sets the networking mode for the container. Supported
values are: &lt;code&gt;bridge&lt;/code&gt;, &lt;code&gt;host&lt;/code&gt;, and &lt;code&gt;container:&amp;lt;name|id&amp;gt;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Devices&lt;/strong&gt; - A list of devices to add to the container specified in the
form
&lt;code&gt;{ &amp;quot;PathOnHost&amp;quot;: &amp;quot;/dev/deviceName&amp;quot;, &amp;quot;PathInContainer&amp;quot;: &amp;quot;/dev/deviceName&amp;quot;, &amp;quot;CgroupPermissions&amp;quot;: &amp;quot;mrw&amp;quot;}&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;204&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;304&lt;/strong&gt; container already started&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;stop-a-container&#34;&gt;Stop a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /containers/(id)/stop&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Stop the container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /containers/e90e34656806/stop?t=5 HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 204 No Content
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;t&lt;/strong&gt; number of seconds to wait before killing the container&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;204&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;304&lt;/strong&gt; container already stopped&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;restart-a-container&#34;&gt;Restart a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /containers/(id)/restart&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Restart the container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /containers/e90e34656806/restart?t=5 HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 204 No Content
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;t&lt;/strong&gt; number of seconds to wait before killing the container&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;204&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;kill-a-container&#34;&gt;Kill a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /containers/(id)/kill&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Kill the container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /containers/e90e34656806/kill HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 204 No Content
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;signal&lt;/strong&gt; - Signal to send to the container: integer or string like &amp;ldquo;SIGINT&amp;rdquo;.
When not set, SIGKILL is assumed and the call will waits for the container to exit.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;204&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;pause-a-container&#34;&gt;Pause a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /containers/(id)/pause&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Pause the container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /containers/e90e34656806/pause HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 204 No Content
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;204&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;unpause-a-container&#34;&gt;Unpause a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /containers/(id)/unpause&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Unpause the container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /containers/e90e34656806/unpause HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 204 No Content
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;204&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;attach-to-a-container&#34;&gt;Attach to a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /containers/(id)/attach&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Attach to the container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /containers/16253994b7c4/attach?logs=1&amp;amp;stream=0&amp;amp;stdout=1 HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/vnd.docker.raw-stream
{{ STREAM }}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;logs&lt;/strong&gt; 1/True/true or 0/False/false, return logs. Default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;stream&lt;/strong&gt; 1/True/true or 0/False/false, return stream.
Default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;stdin&lt;/strong&gt; 1/True/true or 0/False/false, if stream=true, attach
to stdin. Default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;stdout&lt;/strong&gt; 1/True/true or 0/False/false, if logs=true, return
stdout log, if stream=true, attach to stdout. Default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;stderr&lt;/strong&gt; 1/True/true or 0/False/false, if logs=true, return
stderr log, if stream=true, attach to stderr. Default false&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;400&lt;/strong&gt; bad parameter&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Stream details&lt;/strong&gt;:&lt;/p&gt;
&lt;p&gt;When using the TTY setting is enabled in
&lt;a href=&#34;http://localhost/docker/reference/api/docker_remote_api_v1.9/#create-a-container&#34; title=&#34;POST /containers/create&#34;&gt;&lt;code&gt;POST /containers/create&lt;/code&gt;
&lt;/a&gt;,
the stream is the raw data from the process PTY and client&amp;rsquo;s stdin.
When the TTY is disabled, then the stream is multiplexed to separate
stdout and stderr.&lt;/p&gt;
&lt;p&gt;The format is a &lt;strong&gt;Header&lt;/strong&gt; and a &lt;strong&gt;Payload&lt;/strong&gt; (frame).&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;HEADER&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The header will contain the information on which stream write the
stream (stdout or stderr). It also contain the size of the
associated frame encoded on the last 4 bytes (uint32).&lt;/p&gt;
&lt;p&gt;It is encoded on the first 8 bytes like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;header := [8]byte{STREAM_TYPE, 0, 0, 0, SIZE1, SIZE2, SIZE3, SIZE4}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;STREAM_TYPE&lt;/code&gt; can be:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;0: stdin (will be written on stdout)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;1: stdout&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;2: stderr&lt;/p&gt;
&lt;p&gt;&lt;code&gt;SIZE1, SIZE2, SIZE3, SIZE4&lt;/code&gt; are the 4 bytes of
the uint32 size encoded as big endian.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;PAYLOAD&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The payload is the raw stream.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;IMPLEMENTATION&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The simplest way to implement the Attach protocol is the following:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Read 8 bytes&lt;/li&gt;
&lt;li&gt;chose stdout or stderr depending on the first byte&lt;/li&gt;
&lt;li&gt;Extract the frame size from the last 4 bytes&lt;/li&gt;
&lt;li&gt;Read the extracted size and output it on the correct output&lt;/li&gt;
&lt;li&gt;Goto 1&lt;/li&gt;
&lt;/ol&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;attach-to-a-container-websocket&#34;&gt;Attach to a container (websocket)&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /containers/(id)/attach/ws&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Attach to the container &lt;code&gt;id&lt;/code&gt; via websocket&lt;/p&gt;
&lt;p&gt;Implements websocket protocol handshake according to &lt;a href=&#34;http://tools.ietf.org/html/rfc6455&#34;&gt;RFC 6455&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /containers/e90e34656806/attach/ws?logs=0&amp;amp;stream=1&amp;amp;stdin=1&amp;amp;stdout=1&amp;amp;stderr=1 HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; {{ STREAM }}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;logs&lt;/strong&gt; 1/True/true or 0/False/false, return logs. Default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;stream&lt;/strong&gt; 1/True/true or 0/False/false, return stream.
Default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;stdin&lt;/strong&gt; 1/True/true or 0/False/false, if stream=true, attach
to stdin. Default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;stdout&lt;/strong&gt; 1/True/true or 0/False/false, if logs=true, return
stdout log, if stream=true, attach to stdout. Default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;stderr&lt;/strong&gt; 1/True/true or 0/False/false, if logs=true, return
stderr log, if stream=true, attach to stderr. Default false&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;400&lt;/strong&gt; bad parameter&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;wait-a-container&#34;&gt;Wait a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /containers/(id)/wait&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Block until container &lt;code&gt;id&lt;/code&gt; stops, then returns the exit code&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /containers/16253994b7c4/wait HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
{&amp;quot;StatusCode&amp;quot;: 0}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;remove-a-container&#34;&gt;Remove a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;DELETE /containers/(id)&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Remove the container &lt;code&gt;id&lt;/code&gt; from the filesystem&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; DELETE /containers/16253994b7c4?v=1 HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 204 No Content
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;v&lt;/strong&gt; 1/True/true or 0/False/false, Remove the volumes
associated to the container. Default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;force&lt;/strong&gt; - 1/True/true or 0/False/false, Kill then remove the container.
Default false&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;204&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;400&lt;/strong&gt; bad parameter&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;copy-files-or-folders-from-a-container&#34;&gt;Copy files or folders from a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /containers/(id)/copy&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Copy files or folders of container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /containers/4fa6e0f0c678/copy HTTP/1.1
Content-Type: application/json
{
&amp;quot;Resource&amp;quot;: &amp;quot;test.txt&amp;quot;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/x-tar
{{ TAR STREAM }}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;2-2-images&#34;&gt;2.2 Images&lt;/h2&gt;
&lt;h3 id=&#34;list-images&#34;&gt;List Images&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /images/json&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /images/json?all=0 HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
[
{
&amp;quot;RepoTags&amp;quot;: [
&amp;quot;ubuntu:12.04&amp;quot;,
&amp;quot;ubuntu:precise&amp;quot;,
&amp;quot;ubuntu:latest&amp;quot;
],
&amp;quot;Id&amp;quot;: &amp;quot;8dbd9e392a964056420e5d58ca5cc376ef18e2de93b5cc90e868a1bbc8318c1c&amp;quot;,
&amp;quot;Created&amp;quot;: 1365714795,
&amp;quot;Size&amp;quot;: 131506275,
&amp;quot;VirtualSize&amp;quot;: 131506275
},
{
&amp;quot;RepoTags&amp;quot;: [
&amp;quot;ubuntu:12.10&amp;quot;,
&amp;quot;ubuntu:quantal&amp;quot;
],
&amp;quot;ParentId&amp;quot;: &amp;quot;27cf784147099545&amp;quot;,
&amp;quot;Id&amp;quot;: &amp;quot;b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc&amp;quot;,
&amp;quot;Created&amp;quot;: 1364102658,
&amp;quot;Size&amp;quot;: 24653,
&amp;quot;VirtualSize&amp;quot;: 180116135
}
]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;all&lt;/strong&gt; 1/True/true or 0/False/false, default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;filters&lt;/strong&gt; a json encoded value of the filters (a map[string][]string) to process on the images list. Available filters:
&lt;ul&gt;
&lt;li&gt;dangling=true&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;create-an-image&#34;&gt;Create an image&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /images/create&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Create an image, either by pulling it from the registry or by importing it&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /images/create?fromImage=ubuntu HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
{&amp;quot;status&amp;quot;: &amp;quot;Pulling...&amp;quot;}
{&amp;quot;status&amp;quot;: &amp;quot;Pulling&amp;quot;, &amp;quot;progress&amp;quot;: &amp;quot;1 B/ 100 B&amp;quot;, &amp;quot;progressDetail&amp;quot;: {&amp;quot;current&amp;quot;: 1, &amp;quot;total&amp;quot;: 100}}
{&amp;quot;error&amp;quot;: &amp;quot;Invalid...&amp;quot;}
...
When using this endpoint to pull an image from the registry, the
`X-Registry-Auth` header can be used to include
a base64-encoded AuthConfig object.
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;fromImage&lt;/strong&gt; name of the image to pull&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;fromSrc&lt;/strong&gt; source to import. The value may be a URL from which the image
can be retrieved or &lt;code&gt;-&lt;/code&gt; to read the image from the request body.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;repo&lt;/strong&gt; repository&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;tag&lt;/strong&gt; tag&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;registry&lt;/strong&gt; the registry to pull from&lt;/p&gt;
&lt;p&gt;Request Headers:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;X-Registry-Auth&lt;/strong&gt; base64-encoded AuthConfig object&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;inspect-an-image&#34;&gt;Inspect an image&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /images/(name)/json&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Return low-level information on the image &lt;code&gt;name&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /images/ubuntu/json HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
{
&amp;quot;Created&amp;quot;: &amp;quot;2013-03-23T22:24:18.818426-07:00&amp;quot;,
&amp;quot;Container&amp;quot;: &amp;quot;3d67245a8d72ecf13f33dffac9f79dcdf70f75acb84d308770391510e0c23ad0&amp;quot;,
&amp;quot;ContainerConfig&amp;quot;:
{
&amp;quot;Hostname&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;User&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;Memory&amp;quot;: 0,
&amp;quot;MemorySwap&amp;quot;: 0,
&amp;quot;AttachStdin&amp;quot;: false,
&amp;quot;AttachStdout&amp;quot;: false,
&amp;quot;AttachStderr&amp;quot;: false,
&amp;quot;PortSpecs&amp;quot;: null,
&amp;quot;Tty&amp;quot;: true,
&amp;quot;OpenStdin&amp;quot;: true,
&amp;quot;StdinOnce&amp;quot;: false,
&amp;quot;Env&amp;quot;: null,
&amp;quot;Cmd&amp;quot;: [&amp;quot;/bin/bash&amp;quot;],
&amp;quot;Dns&amp;quot;: null,
&amp;quot;Image&amp;quot;: &amp;quot;ubuntu&amp;quot;,
&amp;quot;Volumes&amp;quot;: null,
&amp;quot;VolumesFrom&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;WorkingDir&amp;quot;: &amp;quot;&amp;quot;
},
&amp;quot;Id&amp;quot;: &amp;quot;b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc&amp;quot;,
&amp;quot;Parent&amp;quot;: &amp;quot;27cf784147099545&amp;quot;,
&amp;quot;Size&amp;quot;: 6824592
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such image&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;get-the-history-of-an-image&#34;&gt;Get the history of an image&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /images/(name)/history&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Return the history of the image &lt;code&gt;name&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /images/ubuntu/history HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
[
{
&amp;quot;Id&amp;quot;: &amp;quot;b750fe79269d&amp;quot;,
&amp;quot;Created&amp;quot;: 1364102658,
&amp;quot;CreatedBy&amp;quot;: &amp;quot;/bin/bash&amp;quot;
},
{
&amp;quot;Id&amp;quot;: &amp;quot;27cf78414709&amp;quot;,
&amp;quot;Created&amp;quot;: 1364068391,
&amp;quot;CreatedBy&amp;quot;: &amp;quot;&amp;quot;
}
]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such image&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;push-an-image-on-the-registry&#34;&gt;Push an image on the registry&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /images/(name)/push&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Push the image &lt;code&gt;name&lt;/code&gt; on the registry&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /images/test/push HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
{&amp;quot;status&amp;quot;: &amp;quot;Pushing...&amp;quot;}
{&amp;quot;status&amp;quot;: &amp;quot;Pushing&amp;quot;, &amp;quot;progress&amp;quot;: &amp;quot;1/? (n/a)&amp;quot;, &amp;quot;progressDetail&amp;quot;: {&amp;quot;current&amp;quot;: 1}}}
{&amp;quot;error&amp;quot;: &amp;quot;Invalid...&amp;quot;}
...
If you wish to push an image on to a private registry, that image must already have been tagged
into a repository which references that registry host name and port. This repository name should
then be used in the URL. This mirrors the flow of the CLI.
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /images/registry.acme.com:5000/test/push HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;tag&lt;/strong&gt; the tag to associate with the image on the registry, optional&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Request Headers:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;X-Registry-Auth&lt;/strong&gt; include a base64-encoded AuthConfig
object.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such image&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;tag-an-image-into-a-repository&#34;&gt;Tag an image into a repository&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /images/(name)/tag&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Tag the image &lt;code&gt;name&lt;/code&gt; into a repository&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /images/test/tag?repo=myrepo&amp;amp;force=0&amp;amp;tag=v42 HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 201 OK
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;repo&lt;/strong&gt; The repository to tag in&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;force&lt;/strong&gt; 1/True/true or 0/False/false, default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;tag&lt;/strong&gt; - The new tag name&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;201&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;400&lt;/strong&gt; bad parameter&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such image&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;409&lt;/strong&gt; conflict&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;remove-an-image&#34;&gt;Remove an image&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;DELETE /images/(name)&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Remove the image &lt;code&gt;name&lt;/code&gt; from the filesystem&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; DELETE /images/test HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-type: application/json
[
{&amp;quot;Untagged&amp;quot;: &amp;quot;3e2f21a89f&amp;quot;},
{&amp;quot;Deleted&amp;quot;: &amp;quot;3e2f21a89f&amp;quot;},
{&amp;quot;Deleted&amp;quot;: &amp;quot;53b4f83ac9&amp;quot;}
]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;force&lt;/strong&gt; 1/True/true or 0/False/false, default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;noprune&lt;/strong&gt; 1/True/true or 0/False/false, default false&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such image&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;409&lt;/strong&gt; conflict&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;search-images&#34;&gt;Search images&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /images/search&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Search for an image on &lt;a href=&#34;https://hub.docker.com&#34;&gt;Docker Hub&lt;/a&gt;.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;:
The response keys have changed from API v1.6 to reflect the JSON
sent by the registry server to the docker daemon&amp;rsquo;s request.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /images/search?term=sshd HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
[
{
&amp;quot;description&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;is_official&amp;quot;: false,
&amp;quot;is_automated&amp;quot;: false,
&amp;quot;name&amp;quot;: &amp;quot;wma55/u1210sshd&amp;quot;,
&amp;quot;star_count&amp;quot;: 0
},
{
&amp;quot;description&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;is_official&amp;quot;: false,
&amp;quot;is_automated&amp;quot;: false,
&amp;quot;name&amp;quot;: &amp;quot;jdswinbank/sshd&amp;quot;,
&amp;quot;star_count&amp;quot;: 0
},
{
&amp;quot;description&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;is_official&amp;quot;: false,
&amp;quot;is_automated&amp;quot;: false,
&amp;quot;name&amp;quot;: &amp;quot;vgauthier/sshd&amp;quot;,
&amp;quot;star_count&amp;quot;: 0
}
...
]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;term&lt;/strong&gt; term to search&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;2-3-misc&#34;&gt;2.3 Misc&lt;/h2&gt;
&lt;h3 id=&#34;build-an-image-from-dockerfile-via-stdin&#34;&gt;Build an image from Dockerfile via stdin&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /build&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Build an image from Dockerfile via stdin&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /build HTTP/1.1
{{ TAR STREAM }}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
{&amp;quot;stream&amp;quot;: &amp;quot;Step 1...&amp;quot;}
{&amp;quot;stream&amp;quot;: &amp;quot;...&amp;quot;}
{&amp;quot;error&amp;quot;: &amp;quot;Error...&amp;quot;, &amp;quot;errorDetail&amp;quot;: {&amp;quot;code&amp;quot;: 123, &amp;quot;message&amp;quot;: &amp;quot;Error...&amp;quot;}}
The stream must be a tar archive compressed with one of the
following algorithms: identity (no compression), gzip, bzip2, xz.
The archive must include a file called `Dockerfile`
at its root. It may include any number of other files,
which will be accessible in the build context (See the [*ADD build
command*](/docker/reference/builder/#dockerbuilder)).
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;t&lt;/strong&gt; repository name (and optionally a tag) to be applied to
the resulting image in case of success&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;remote&lt;/strong&gt; git or HTTP/HTTPS URI build source&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;q&lt;/strong&gt; suppress verbose build output&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;nocache&lt;/strong&gt; do not use the cache when building the image&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;pull&lt;/strong&gt; - attempt to pull the image even if an older image exists locally&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;rm&lt;/strong&gt; - remove intermediate containers after a successful build (default behavior)&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;forcerm&lt;/strong&gt; - always remove intermediate containers (includes rm)&lt;/p&gt;
&lt;p&gt;Request Headers:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Content-type&lt;/strong&gt; should be set to &lt;code&gt;&amp;quot;application/tar&amp;quot;&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;X-Registry-Config&lt;/strong&gt; base64-encoded ConfigFile object&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;check-auth-configuration&#34;&gt;Check auth configuration&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /auth&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Get the default username and email&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /auth HTTP/1.1
Content-Type: application/json
{
&amp;quot;username&amp;quot;:&amp;quot; hannibal&amp;quot;,
&amp;quot;password: &amp;quot;xxxx&amp;quot;,
&amp;quot;email&amp;quot;: &amp;quot;hannibal@a-team.com&amp;quot;,
&amp;quot;serveraddress&amp;quot;: &amp;quot;https://index.docker.io/v1/&amp;quot;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;204&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;display-system-wide-information&#34;&gt;Display system-wide information&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /info&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Display system-wide information&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /info HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
{
&amp;quot;Containers&amp;quot;:11,
&amp;quot;Images&amp;quot;:16,
&amp;quot;Driver&amp;quot;:&amp;quot;btrfs&amp;quot;,
&amp;quot;DriverStatus&amp;quot;: [[&amp;quot;&amp;quot;]],
&amp;quot;ExecutionDriver&amp;quot;:&amp;quot;native-0.1&amp;quot;,
&amp;quot;KernelVersion&amp;quot;:&amp;quot;3.12.0-1-amd64&amp;quot;
&amp;quot;NCPU&amp;quot;:1,
&amp;quot;MemTotal&amp;quot;:2099236864,
&amp;quot;Name&amp;quot;:&amp;quot;prod-server-42&amp;quot;,
&amp;quot;ID&amp;quot;:&amp;quot;7TRN:IPZB:QYBB:VPBQ:UMPP:KARE:6ZNR:XE6T:7EWV:PKF4:ZOJD:TPYS&amp;quot;,
&amp;quot;Debug&amp;quot;:false,
&amp;quot;NFd&amp;quot;: 11,
&amp;quot;NGoroutines&amp;quot;:21,
&amp;quot;NEventsListener&amp;quot;:0,
&amp;quot;InitPath&amp;quot;:&amp;quot;/usr/bin/docker&amp;quot;,
&amp;quot;InitSha1&amp;quot;:&amp;quot;&amp;quot;,
&amp;quot;IndexServerAddress&amp;quot;:[&amp;quot;https://index.docker.io/v1/&amp;quot;],
&amp;quot;MemoryLimit&amp;quot;:true,
&amp;quot;SwapLimit&amp;quot;:false,
&amp;quot;IPv4Forwarding&amp;quot;:true,
&amp;quot;Labels&amp;quot;:[&amp;quot;storage=ssd&amp;quot;],
&amp;quot;DockerRootDir&amp;quot;: &amp;quot;/var/lib/docker&amp;quot;,
&amp;quot;OperatingSystem&amp;quot;: &amp;quot;Boot2Docker&amp;quot;,
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;show-the-docker-version-information&#34;&gt;Show the docker version information&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /version&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Show the docker version information&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /version HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
{
&amp;quot;ApiVersion&amp;quot;: &amp;quot;1.12&amp;quot;,
&amp;quot;Version&amp;quot;: &amp;quot;0.2.2&amp;quot;,
&amp;quot;GitCommit&amp;quot;: &amp;quot;5a2a5cc+CHANGES&amp;quot;,
&amp;quot;GoVersion&amp;quot;: &amp;quot;go1.0.3&amp;quot;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;ping-the-docker-server&#34;&gt;Ping the docker server&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /_ping&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Ping the docker server&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /_ping HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: text/plain
OK
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; - no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; - server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;create-a-new-image-from-a-container-s-changes&#34;&gt;Create a new image from a container&amp;rsquo;s changes&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /commit&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Create a new image from a container&amp;rsquo;s changes&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /commit?container=44c004db4b17&amp;amp;comment=message&amp;amp;repo=myrepo HTTP/1.1
Content-Type: application/json
{
&amp;quot;Hostname&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;Domainname&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;User&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;Memory&amp;quot;: 0,
&amp;quot;MemorySwap&amp;quot;: 0,
&amp;quot;CpuShares&amp;quot;: 512,
&amp;quot;Cpuset&amp;quot;: &amp;quot;0,1&amp;quot;,
&amp;quot;AttachStdin&amp;quot;: false,
&amp;quot;AttachStdout&amp;quot;: true,
&amp;quot;AttachStderr&amp;quot;: true,
&amp;quot;PortSpecs&amp;quot;: null,
&amp;quot;Tty&amp;quot;: false,
&amp;quot;OpenStdin&amp;quot;: false,
&amp;quot;StdinOnce&amp;quot;: false,
&amp;quot;Env&amp;quot;: null,
&amp;quot;Cmd&amp;quot;: [
&amp;quot;date&amp;quot;
],
&amp;quot;Volumes&amp;quot;: {
&amp;quot;/tmp&amp;quot;: {}
},
&amp;quot;WorkingDir&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;NetworkDisabled&amp;quot;: false,
&amp;quot;ExposedPorts&amp;quot;: {
&amp;quot;22/tcp&amp;quot;: {}
}
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 201 Created
Content-Type: application/vnd.docker.raw-stream
{&amp;quot;Id&amp;quot;: &amp;quot;596069db4bf5&amp;quot;}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Json Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;config&lt;/strong&gt; - the container&amp;rsquo;s configuration&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;container&lt;/strong&gt; source container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;repo&lt;/strong&gt; repository&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;tag&lt;/strong&gt; tag&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;comment&lt;/strong&gt; commit message&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;author&lt;/strong&gt; author (e.g., &amp;ldquo;John Hannibal Smith
&amp;lt;&lt;a href=&#34;mailto:hannibal%40a-team.com&#34;&gt;hannibal@a-team.com&lt;/a&gt;&amp;gt;&amp;ldquo;)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;201&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;monitor-docker-s-events&#34;&gt;Monitor Docker&amp;rsquo;s events&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /events&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Get container events from docker, either in real time via streaming, or via
polling (using since).&lt;/p&gt;
&lt;p&gt;Docker containers will report the following events:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;create, destroy, die, export, kill, pause, restart, start, stop, unpause
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;and Docker images will report:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;untag, delete
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /events?since=1374067924
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
{&amp;quot;status&amp;quot;: &amp;quot;create&amp;quot;, &amp;quot;id&amp;quot;: &amp;quot;dfdf82bd3881&amp;quot;,&amp;quot;from&amp;quot;: &amp;quot;ubuntu:latest&amp;quot;, &amp;quot;time&amp;quot;:1374067924}
{&amp;quot;status&amp;quot;: &amp;quot;start&amp;quot;, &amp;quot;id&amp;quot;: &amp;quot;dfdf82bd3881&amp;quot;,&amp;quot;from&amp;quot;: &amp;quot;ubuntu:latest&amp;quot;, &amp;quot;time&amp;quot;:1374067924}
{&amp;quot;status&amp;quot;: &amp;quot;stop&amp;quot;, &amp;quot;id&amp;quot;: &amp;quot;dfdf82bd3881&amp;quot;,&amp;quot;from&amp;quot;: &amp;quot;ubuntu:latest&amp;quot;, &amp;quot;time&amp;quot;:1374067966}
{&amp;quot;status&amp;quot;: &amp;quot;destroy&amp;quot;, &amp;quot;id&amp;quot;: &amp;quot;dfdf82bd3881&amp;quot;,&amp;quot;from&amp;quot;: &amp;quot;ubuntu:latest&amp;quot;, &amp;quot;time&amp;quot;:1374067970}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;since&lt;/strong&gt; timestamp used for polling&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;until&lt;/strong&gt; timestamp used for polling&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;filters&lt;/strong&gt; a json encoded value of the filters (a map[string][]string) to process on the event list. Available filters:
&lt;ul&gt;
&lt;li&gt;event=&amp;lt;string&amp;gt; &amp;ndash; event to filter&lt;/li&gt;
&lt;li&gt;image=&amp;lt;string&amp;gt; &amp;ndash; image to filter&lt;/li&gt;
&lt;li&gt;container=&amp;lt;string&amp;gt; &amp;ndash; container to filter&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;get-a-tarball-containing-all-images-in-a-repository&#34;&gt;Get a tarball containing all images in a repository&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /images/(name)/get&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Get a tarball containing all images and metadata for the repository specified
by &lt;code&gt;name&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;If &lt;code&gt;name&lt;/code&gt; is a specific name and tag (e.g. ubuntu:latest), then only that image
(and its parents) are returned. If &lt;code&gt;name&lt;/code&gt; is an image ID, similarly only that
image (and its parents) are returned, but with the exclusion of the
&amp;lsquo;repositories&amp;rsquo; file in the tarball, as there were no image names referenced.&lt;/p&gt;
&lt;p&gt;See the &lt;a href=&#34;#image-tarball-format&#34;&gt;image tarball format&lt;/a&gt; for more details.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /images/ubuntu/get
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/x-tar
Binary data stream
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;get-a-tarball-containing-all-images&#34;&gt;Get a tarball containing all images.&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /images/get&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Get a tarball containing all images and metadata for one or more repositories.&lt;/p&gt;
&lt;p&gt;For each value of the &lt;code&gt;names&lt;/code&gt; parameter: if it is a specific name and tag (e.g.
ubuntu:latest), then only that image (and its parents) are returned; if it is
an image ID, similarly only that image (and its parents) are returned and there
would be no names referenced in the &amp;lsquo;repositories&amp;rsquo; file for this image ID.&lt;/p&gt;
&lt;p&gt;See the &lt;a href=&#34;#image-tarball-format&#34;&gt;image tarball format&lt;/a&gt; for more details.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /images/get?names=myname%2Fmyapp%3Alatest&amp;amp;names=busybox
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/x-tar
Binary data stream
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;load-a-tarball-with-a-set-of-images-and-tags-into-docker&#34;&gt;Load a tarball with a set of images and tags into docker&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /images/load&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Load a set of images and tags into the docker repository.
See the &lt;a href=&#34;#image-tarball-format&#34;&gt;image tarball format&lt;/a&gt; for more details.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /images/load
Tarball in body
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;image-tarball-format&#34;&gt;Image tarball format&lt;/h3&gt;
&lt;p&gt;An image tarball contains one directory per image layer (named using its long ID),
each containing three files:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;VERSION&lt;/code&gt;: currently &lt;code&gt;1.0&lt;/code&gt; - the file format version&lt;/li&gt;
&lt;li&gt;&lt;code&gt;json&lt;/code&gt;: detailed layer information, similar to &lt;code&gt;docker inspect layer_id&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;layer.tar&lt;/code&gt;: A tarfile containing the filesystem changes in this layer&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The &lt;code&gt;layer.tar&lt;/code&gt; file will contain &lt;code&gt;aufs&lt;/code&gt; style &lt;code&gt;.wh..wh.aufs&lt;/code&gt; files and directories
for storing attribute changes and deletions.&lt;/p&gt;
&lt;p&gt;If the tarball defines a repository, there will also be a &lt;code&gt;repositories&lt;/code&gt; file at
the root that contains a list of repository and tag names mapped to layer IDs.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;{&amp;quot;hello-world&amp;quot;:
{&amp;quot;latest&amp;quot;: &amp;quot;565a9d68a73f6706862bfe8409a7f659776d4d60a8d096eb4a3cbce6999cc2a1&amp;quot;}
}
&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&#34;exec-create&#34;&gt;Exec Create&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /containers/(id)/exec&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Sets up an exec instance in a running container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /containers/e90e34656806/exec HTTP/1.1
Content-Type: application/json
{
&amp;quot;AttachStdin&amp;quot;: false,
&amp;quot;AttachStdout&amp;quot;: true,
&amp;quot;AttachStderr&amp;quot;: true,
&amp;quot;Tty&amp;quot;: false,
&amp;quot;Cmd&amp;quot;: [
&amp;quot;date&amp;quot;
],
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 201 OK
Content-Type: application/json
{
&amp;quot;Id&amp;quot;: &amp;quot;f90e34656806&amp;quot;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Json Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;AttachStdin&lt;/strong&gt; - Boolean value, attaches to stdin of the exec command.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;AttachStdout&lt;/strong&gt; - Boolean value, attaches to stdout of the exec command.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;AttachStderr&lt;/strong&gt; - Boolean value, attaches to stderr of the exec command.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Tty&lt;/strong&gt; - Boolean value to allocate a pseudo-TTY&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Cmd&lt;/strong&gt; - Command to run specified as a string or an array of strings.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;201&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;exec-start&#34;&gt;Exec Start&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /exec/(id)/start&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Starts a previously set up exec instance &lt;code&gt;id&lt;/code&gt;. If &lt;code&gt;detach&lt;/code&gt; is true, this API
returns after starting the &lt;code&gt;exec&lt;/code&gt; command. Otherwise, this API sets up an
interactive session with the &lt;code&gt;exec&lt;/code&gt; command.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /exec/e90e34656806/start HTTP/1.1
Content-Type: application/json
{
&amp;quot;Detach&amp;quot;: false,
&amp;quot;Tty&amp;quot;: false,
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 201 OK
Content-Type: application/json
{{ STREAM }}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Json Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Detach&lt;/strong&gt; - Detach from the exec command&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Tty&lt;/strong&gt; - Boolean value to allocate a pseudo-TTY&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;201&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;404&lt;/strong&gt; no such exec instance&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Stream details&lt;/strong&gt;:
Similar to the stream behavior of &lt;code&gt;POST /container/(id)/attach&lt;/code&gt; API&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;exec-resize&#34;&gt;Exec Resize&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /exec/(id)/resize&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Resizes the tty session used by the exec command &lt;code&gt;id&lt;/code&gt;.
This API is valid only if &lt;code&gt;tty&lt;/code&gt; was specified as part of creating and starting the exec command.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /exec/e90e34656806/resize HTTP/1.1
Content-Type: plain/text
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 201 OK
Content-Type: plain/text
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;h&lt;/strong&gt; height of tty session&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;w&lt;/strong&gt; width&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;201&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such exec instance&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;exec-inspect&#34;&gt;Exec Inspect&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /exec/(id)/json&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Return low-level information about the exec command &lt;code&gt;id&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /exec/11fb006128e8ceb3942e7c58d77750f24210e35f879dd204ac975c184b820b39/json HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: plain/text
{
&amp;quot;ID&amp;quot; : &amp;quot;11fb006128e8ceb3942e7c58d77750f24210e35f879dd204ac975c184b820b39&amp;quot;,
&amp;quot;Running&amp;quot; : false,
&amp;quot;ExitCode&amp;quot; : 2,
&amp;quot;ProcessConfig&amp;quot; : {
&amp;quot;privileged&amp;quot; : false,
&amp;quot;user&amp;quot; : &amp;quot;&amp;quot;,
&amp;quot;tty&amp;quot; : false,
&amp;quot;entrypoint&amp;quot; : &amp;quot;sh&amp;quot;,
&amp;quot;arguments&amp;quot; : [
&amp;quot;-c&amp;quot;,
&amp;quot;exit 2&amp;quot;
]
},
&amp;quot;OpenStdin&amp;quot; : false,
&amp;quot;OpenStderr&amp;quot; : false,
&amp;quot;OpenStdout&amp;quot; : false,
&amp;quot;Container&amp;quot; : {
&amp;quot;State&amp;quot; : {
&amp;quot;Running&amp;quot; : true,
&amp;quot;Paused&amp;quot; : false,
&amp;quot;Restarting&amp;quot; : false,
&amp;quot;OOMKilled&amp;quot; : false,
&amp;quot;Pid&amp;quot; : 3650,
&amp;quot;ExitCode&amp;quot; : 0,
&amp;quot;Error&amp;quot; : &amp;quot;&amp;quot;,
&amp;quot;StartedAt&amp;quot; : &amp;quot;2014-11-17T22:26:03.717657531Z&amp;quot;,
&amp;quot;FinishedAt&amp;quot; : &amp;quot;0001-01-01T00:00:00Z&amp;quot;
},
&amp;quot;ID&amp;quot; : &amp;quot;8f177a186b977fb451136e0fdf182abff5599a08b3c7f6ef0d36a55aaf89634c&amp;quot;,
&amp;quot;Created&amp;quot; : &amp;quot;2014-11-17T22:26:03.626304998Z&amp;quot;,
&amp;quot;Path&amp;quot; : &amp;quot;date&amp;quot;,
&amp;quot;Args&amp;quot; : [],
&amp;quot;Config&amp;quot; : {
&amp;quot;Hostname&amp;quot; : &amp;quot;8f177a186b97&amp;quot;,
&amp;quot;Domainname&amp;quot; : &amp;quot;&amp;quot;,
&amp;quot;User&amp;quot; : &amp;quot;&amp;quot;,
&amp;quot;Memory&amp;quot; : 0,
&amp;quot;MemorySwap&amp;quot; : 0,
&amp;quot;CpuShares&amp;quot; : 0,
&amp;quot;Cpuset&amp;quot; : &amp;quot;&amp;quot;,
&amp;quot;AttachStdin&amp;quot; : false,
&amp;quot;AttachStdout&amp;quot; : false,
&amp;quot;AttachStderr&amp;quot; : false,
&amp;quot;PortSpecs&amp;quot; : null,
&amp;quot;ExposedPorts&amp;quot; : null,
&amp;quot;Tty&amp;quot; : false,
&amp;quot;OpenStdin&amp;quot; : false,
&amp;quot;StdinOnce&amp;quot; : false,
&amp;quot;Env&amp;quot; : [ &amp;quot;PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin&amp;quot; ],
&amp;quot;Cmd&amp;quot; : [
&amp;quot;date&amp;quot;
],
&amp;quot;Image&amp;quot; : &amp;quot;ubuntu&amp;quot;,
&amp;quot;Volumes&amp;quot; : null,
&amp;quot;WorkingDir&amp;quot; : &amp;quot;&amp;quot;,
&amp;quot;Entrypoint&amp;quot; : null,
&amp;quot;NetworkDisabled&amp;quot; : false,
&amp;quot;MacAddress&amp;quot; : &amp;quot;&amp;quot;,
&amp;quot;OnBuild&amp;quot; : null,
&amp;quot;SecurityOpt&amp;quot; : null
},
&amp;quot;Image&amp;quot; : &amp;quot;5506de2b643be1e6febbf3b8a240760c6843244c41e12aa2f60ccbb7153d17f5&amp;quot;,
&amp;quot;NetworkSettings&amp;quot; : {
&amp;quot;IPAddress&amp;quot; : &amp;quot;172.17.0.2&amp;quot;,
&amp;quot;IPPrefixLen&amp;quot; : 16,
&amp;quot;MacAddress&amp;quot; : &amp;quot;02:42:ac:11:00:02&amp;quot;,
&amp;quot;Gateway&amp;quot; : &amp;quot;172.17.42.1&amp;quot;,
&amp;quot;Bridge&amp;quot; : &amp;quot;docker0&amp;quot;,
&amp;quot;PortMapping&amp;quot; : null,
&amp;quot;Ports&amp;quot; : {}
},
&amp;quot;ResolvConfPath&amp;quot; : &amp;quot;/var/lib/docker/containers/8f177a186b977fb451136e0fdf182abff5599a08b3c7f6ef0d36a55aaf89634c/resolv.conf&amp;quot;,
&amp;quot;HostnamePath&amp;quot; : &amp;quot;/var/lib/docker/containers/8f177a186b977fb451136e0fdf182abff5599a08b3c7f6ef0d36a55aaf89634c/hostname&amp;quot;,
&amp;quot;HostsPath&amp;quot; : &amp;quot;/var/lib/docker/containers/8f177a186b977fb451136e0fdf182abff5599a08b3c7f6ef0d36a55aaf89634c/hosts&amp;quot;,
&amp;quot;Name&amp;quot; : &amp;quot;/test&amp;quot;,
&amp;quot;Driver&amp;quot; : &amp;quot;aufs&amp;quot;,
&amp;quot;ExecDriver&amp;quot; : &amp;quot;native-0.2&amp;quot;,
&amp;quot;MountLabel&amp;quot; : &amp;quot;&amp;quot;,
&amp;quot;ProcessLabel&amp;quot; : &amp;quot;&amp;quot;,
&amp;quot;AppArmorProfile&amp;quot; : &amp;quot;&amp;quot;,
&amp;quot;RestartCount&amp;quot; : 0,
&amp;quot;Volumes&amp;quot; : {},
&amp;quot;VolumesRW&amp;quot; : {}
}
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such exec instance&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; - server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h1 id=&#34;3-going-further&#34;&gt;3. Going further&lt;/h1&gt;
&lt;h2 id=&#34;3-1-inside-docker-run&#34;&gt;3.1 Inside &lt;code&gt;docker run&lt;/code&gt;&lt;/h2&gt;
&lt;p&gt;As an example, the &lt;code&gt;docker run&lt;/code&gt; command line makes the following API calls:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Create the container&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If the status code is 404, it means the image doesn&amp;rsquo;t exist:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Try to pull it&lt;/li&gt;
&lt;li&gt;Then retry to create the container&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Start the container&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If you are not in detached mode:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Attach to the container, using logs=1 (to have stdout and
stderr from the container&amp;rsquo;s start) and stream=1&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If in detached mode or only stdin is attached:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Display the container&amp;rsquo;s id&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;3-2-hijacking&#34;&gt;3.2 Hijacking&lt;/h2&gt;
&lt;p&gt;In this version of the API, /attach, uses hijacking to transport stdin,
stdout and stderr on the same socket. This might change in the future.&lt;/p&gt;
&lt;h2 id=&#34;3-3-cors-requests&#34;&gt;3.3 CORS Requests&lt;/h2&gt;
&lt;p&gt;To enable cross origin requests to the remote api add the flag
&amp;ldquo;&amp;ndash;api-enable-cors&amp;rdquo; when running docker in daemon mode.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ docker -d -H=&amp;quot;192.168.1.9:2375&amp;quot; --api-enable-cors
&lt;/code&gt;&lt;/pre&gt;
</description>
</item>
<item>
<title>Remote API v1.17</title>
<link>http://localhost/reference/api/docker_remote_api_v1.17/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>http://localhost/reference/api/docker_remote_api_v1.17/</guid>
<description>
&lt;h1 id=&#34;docker-remote-api-v1-17&#34;&gt;Docker Remote API v1.17&lt;/h1&gt;
&lt;h2 id=&#34;1-brief-introduction&#34;&gt;1. Brief introduction&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;The Remote API has replaced &lt;code&gt;rcli&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The daemon listens on &lt;code&gt;unix:///var/run/docker.sock&lt;/code&gt; but you can
&lt;a href=&#34;http://localhost/articles/basics/#bind-docker-to-another-hostport-or-a-unix-socket&#34;&gt;Bind Docker to another host/port or a Unix socket&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;The API tends to be REST, but for some complex commands, like &lt;code&gt;attach&lt;/code&gt;
or &lt;code&gt;pull&lt;/code&gt;, the HTTP connection is hijacked to transport &lt;code&gt;STDOUT&lt;/code&gt;,
&lt;code&gt;STDIN&lt;/code&gt; and &lt;code&gt;STDERR&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;h1 id=&#34;2-endpoints&#34;&gt;2. Endpoints&lt;/h1&gt;
&lt;h2 id=&#34;2-1-containers&#34;&gt;2.1 Containers&lt;/h2&gt;
&lt;h3 id=&#34;list-containers&#34;&gt;List containers&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /containers/json&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;List containers&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /containers/json?all=1&amp;amp;before=8dfafdbc3a40&amp;amp;size=1 HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
[
{
&amp;quot;Id&amp;quot;: &amp;quot;8dfafdbc3a40&amp;quot;,
&amp;quot;Image&amp;quot;: &amp;quot;ubuntu:latest&amp;quot;,
&amp;quot;Command&amp;quot;: &amp;quot;echo 1&amp;quot;,
&amp;quot;Created&amp;quot;: 1367854155,
&amp;quot;Status&amp;quot;: &amp;quot;Exit 0&amp;quot;,
&amp;quot;Ports&amp;quot;: [{&amp;quot;PrivatePort&amp;quot;: 2222, &amp;quot;PublicPort&amp;quot;: 3333, &amp;quot;Type&amp;quot;: &amp;quot;tcp&amp;quot;}],
&amp;quot;SizeRw&amp;quot;: 12288,
&amp;quot;SizeRootFs&amp;quot;: 0
},
{
&amp;quot;Id&amp;quot;: &amp;quot;9cd87474be90&amp;quot;,
&amp;quot;Image&amp;quot;: &amp;quot;ubuntu:latest&amp;quot;,
&amp;quot;Command&amp;quot;: &amp;quot;echo 222222&amp;quot;,
&amp;quot;Created&amp;quot;: 1367854155,
&amp;quot;Status&amp;quot;: &amp;quot;Exit 0&amp;quot;,
&amp;quot;Ports&amp;quot;: [],
&amp;quot;SizeRw&amp;quot;: 12288,
&amp;quot;SizeRootFs&amp;quot;: 0
},
{
&amp;quot;Id&amp;quot;: &amp;quot;3176a2479c92&amp;quot;,
&amp;quot;Image&amp;quot;: &amp;quot;ubuntu:latest&amp;quot;,
&amp;quot;Command&amp;quot;: &amp;quot;echo 3333333333333333&amp;quot;,
&amp;quot;Created&amp;quot;: 1367854154,
&amp;quot;Status&amp;quot;: &amp;quot;Exit 0&amp;quot;,
&amp;quot;Ports&amp;quot;:[],
&amp;quot;SizeRw&amp;quot;:12288,
&amp;quot;SizeRootFs&amp;quot;:0
},
{
&amp;quot;Id&amp;quot;: &amp;quot;4cb07b47f9fb&amp;quot;,
&amp;quot;Image&amp;quot;: &amp;quot;ubuntu:latest&amp;quot;,
&amp;quot;Command&amp;quot;: &amp;quot;echo 444444444444444444444444444444444&amp;quot;,
&amp;quot;Created&amp;quot;: 1367854152,
&amp;quot;Status&amp;quot;: &amp;quot;Exit 0&amp;quot;,
&amp;quot;Ports&amp;quot;: [],
&amp;quot;SizeRw&amp;quot;: 12288,
&amp;quot;SizeRootFs&amp;quot;: 0
}
]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;all&lt;/strong&gt; 1/True/true or 0/False/false, Show all containers.
Only running containers are shown by default (i.e., this defaults to false)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;limit&lt;/strong&gt; Show &lt;code&gt;limit&lt;/code&gt; last created
containers, include non-running ones.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;since&lt;/strong&gt; Show only containers created since Id, include
non-running ones.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;before&lt;/strong&gt; Show only containers created before Id, include
non-running ones.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;size&lt;/strong&gt; 1/True/true or 0/False/false, Show the containers
sizes&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;filters&lt;/strong&gt; - a json encoded value of the filters (a map[string][]string) to process on the containers list. Available filters:
&lt;ul&gt;
&lt;li&gt;exited=&amp;lt;int&amp;gt; &amp;ndash; containers with exit code of &amp;lt;int&amp;gt;&lt;/li&gt;
&lt;li&gt;status=(restarting|running|paused|exited)&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;400&lt;/strong&gt; bad parameter&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;create-a-container&#34;&gt;Create a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /containers/create&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Create a container&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /containers/create HTTP/1.1
Content-Type: application/json
{
&amp;quot;Hostname&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;Domainname&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;User&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;Memory&amp;quot;: 0,
&amp;quot;MemorySwap&amp;quot;: 0,
&amp;quot;CpuShares&amp;quot;: 512,
&amp;quot;Cpuset&amp;quot;: &amp;quot;0,1&amp;quot;,
&amp;quot;AttachStdin&amp;quot;: false,
&amp;quot;AttachStdout&amp;quot;: true,
&amp;quot;AttachStderr&amp;quot;: true,
&amp;quot;Tty&amp;quot;: false,
&amp;quot;OpenStdin&amp;quot;: false,
&amp;quot;StdinOnce&amp;quot;: false,
&amp;quot;Env&amp;quot;: null,
&amp;quot;Cmd&amp;quot;: [
&amp;quot;date&amp;quot;
],
&amp;quot;Entrypoint&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;Image&amp;quot;: &amp;quot;ubuntu&amp;quot;,
&amp;quot;Volumes&amp;quot;: {
&amp;quot;/tmp&amp;quot;: {}
},
&amp;quot;WorkingDir&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;NetworkDisabled&amp;quot;: false,
&amp;quot;MacAddress&amp;quot;: &amp;quot;12:34:56:78:9a:bc&amp;quot;,
&amp;quot;ExposedPorts&amp;quot;: {
&amp;quot;22/tcp&amp;quot;: {}
},
&amp;quot;HostConfig&amp;quot;: {
&amp;quot;Binds&amp;quot;: [&amp;quot;/tmp:/tmp&amp;quot;],
&amp;quot;Links&amp;quot;: [&amp;quot;redis3:redis&amp;quot;],
&amp;quot;LxcConf&amp;quot;: {&amp;quot;lxc.utsname&amp;quot;:&amp;quot;docker&amp;quot;},
&amp;quot;PortBindings&amp;quot;: { &amp;quot;22/tcp&amp;quot;: [{ &amp;quot;HostPort&amp;quot;: &amp;quot;11022&amp;quot; }] },
&amp;quot;PublishAllPorts&amp;quot;: false,
&amp;quot;Privileged&amp;quot;: false,
&amp;quot;ReadonlyRootfs&amp;quot;: false,
&amp;quot;Dns&amp;quot;: [&amp;quot;8.8.8.8&amp;quot;],
&amp;quot;DnsSearch&amp;quot;: [&amp;quot;&amp;quot;],
&amp;quot;ExtraHosts&amp;quot;: null,
&amp;quot;VolumesFrom&amp;quot;: [&amp;quot;parent&amp;quot;, &amp;quot;other:ro&amp;quot;],
&amp;quot;CapAdd&amp;quot;: [&amp;quot;NET_ADMIN&amp;quot;],
&amp;quot;CapDrop&amp;quot;: [&amp;quot;MKNOD&amp;quot;],
&amp;quot;RestartPolicy&amp;quot;: { &amp;quot;Name&amp;quot;: &amp;quot;&amp;quot;, &amp;quot;MaximumRetryCount&amp;quot;: 0 },
&amp;quot;NetworkMode&amp;quot;: &amp;quot;bridge&amp;quot;,
&amp;quot;Devices&amp;quot;: []
&amp;quot;SecurityOpt&amp;quot;: [&amp;quot;&amp;quot;],
}
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 201 Created
Content-Type: application/json
{
&amp;quot;Id&amp;quot;:&amp;quot;e90e34656806&amp;quot;
&amp;quot;Warnings&amp;quot;:[]
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Json Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Hostname&lt;/strong&gt; - A string value containing the desired hostname to use for the
container.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Domainname&lt;/strong&gt; - A string value containing the desired domain name to use
for the container.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;User&lt;/strong&gt; - A string value containing the user to use inside the container.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Memory&lt;/strong&gt; - Memory limit in bytes.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;MemorySwap&lt;/strong&gt;- Total memory limit (memory + swap); set &lt;code&gt;-1&lt;/code&gt; to disable swap,
always use this with &lt;code&gt;memory&lt;/code&gt;, and make the value larger than &lt;code&gt;memory&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;CpuShares&lt;/strong&gt; - An integer value containing the CPU Shares for container
(ie. the relative weight vs other containers).
&lt;strong&gt;CpuSet&lt;/strong&gt; - String value containing the cgroups Cpuset to use.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;AttachStdin&lt;/strong&gt; - Boolean value, attaches to stdin.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;AttachStdout&lt;/strong&gt; - Boolean value, attaches to stdout.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;AttachStderr&lt;/strong&gt; - Boolean value, attaches to stderr.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Tty&lt;/strong&gt; - Boolean value, Attach standard streams to a tty, including stdin if it is not closed.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;OpenStdin&lt;/strong&gt; - Boolean value, opens stdin,&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;StdinOnce&lt;/strong&gt; - Boolean value, close stdin after the 1 attached client disconnects.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Env&lt;/strong&gt; - A list of environment variables in the form of &lt;code&gt;VAR=value&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Cmd&lt;/strong&gt; - Command to run specified as a string or an array of strings.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Entrypoint&lt;/strong&gt; - Set the entrypoint for the container a a string or an array
of strings&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Image&lt;/strong&gt; - String value containing the image name to use for the container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Volumes&lt;/strong&gt; An object mapping mountpoint paths (strings) inside the
container to empty objects.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;WorkingDir&lt;/strong&gt; - A string value containing the working dir for commands to
run in.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;NetworkDisabled&lt;/strong&gt; - Boolean value, when true disables networking for the
container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;ExposedPorts&lt;/strong&gt; - An object mapping ports to an empty object in the form of:
&lt;code&gt;&amp;quot;ExposedPorts&amp;quot;: { &amp;quot;&amp;lt;port&amp;gt;/&amp;lt;tcp|udp&amp;gt;: {}&amp;quot; }&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;HostConfig&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Binds&lt;/strong&gt; A list of volume bindings for this container. Each volume
binding is a string of the form &lt;code&gt;container_path&lt;/code&gt; (to create a new
volume for the container), &lt;code&gt;host_path:container_path&lt;/code&gt; (to bind-mount
a host path into the container), or &lt;code&gt;host_path:container_path:ro&lt;/code&gt;
(to make the bind-mount read-only inside the container).&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Links&lt;/strong&gt; - A list of links for the container. Each link entry should be
in the form of &amp;ldquo;container_name:alias&amp;rdquo;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;LxcConf&lt;/strong&gt; - LXC specific configurations. These configurations will only
work when using the &lt;code&gt;lxc&lt;/code&gt; execution driver.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;PortBindings&lt;/strong&gt; - A map of exposed container ports and the host port they
should map to. It should be specified in the form
&lt;code&gt;{ &amp;lt;port&amp;gt;/&amp;lt;protocol&amp;gt;: [{ &amp;quot;HostPort&amp;quot;: &amp;quot;&amp;lt;port&amp;gt;&amp;quot; }] }&lt;/code&gt;
Take note that &lt;code&gt;port&lt;/code&gt; is specified as a string and not an integer value.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;PublishAllPorts&lt;/strong&gt; - Allocates a random host port for all of a container&amp;rsquo;s
exposed ports. Specified as a boolean value.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Privileged&lt;/strong&gt; - Gives the container full access to the host. Specified as
a boolean value.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;ReadonlyRootfs&lt;/strong&gt; - Mount the container&amp;rsquo;s root filesystem as read only.
Specified as a boolean value.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Dns&lt;/strong&gt; - A list of dns servers for the container to use.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;DnsSearch&lt;/strong&gt; - A list of DNS search domains&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;ExtraHosts&lt;/strong&gt; - A list of hostnames/IP mappings to be added to the
container&amp;rsquo;s &lt;code&gt;/etc/hosts&lt;/code&gt; file. Specified in the form &lt;code&gt;[&amp;quot;hostname:IP&amp;quot;]&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;VolumesFrom&lt;/strong&gt; - A list of volumes to inherit from another container.
Specified in the form &lt;code&gt;&amp;lt;container name&amp;gt;[:&amp;lt;ro|rw&amp;gt;]&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;CapAdd&lt;/strong&gt; - A list of kernel capabilities to add to the container.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Capdrop&lt;/strong&gt; - A list of kernel capabilities to drop from the container.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;RestartPolicy&lt;/strong&gt; The behavior to apply when the container exits. The
value is an object with a &lt;code&gt;Name&lt;/code&gt; property of either &lt;code&gt;&amp;quot;always&amp;quot;&lt;/code&gt; to
always restart or &lt;code&gt;&amp;quot;on-failure&amp;quot;&lt;/code&gt; to restart only when the container
exit code is non-zero. If &lt;code&gt;on-failure&lt;/code&gt; is used, &lt;code&gt;MaximumRetryCount&lt;/code&gt;
controls the number of times to retry before giving up.
The default is not to restart. (optional)
An ever increasing delay (double the previous delay, starting at 100mS)
is added before each restart to prevent flooding the server.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;NetworkMode&lt;/strong&gt; - Sets the networking mode for the container. Supported
values are: &lt;code&gt;bridge&lt;/code&gt;, &lt;code&gt;host&lt;/code&gt;, and &lt;code&gt;container:&amp;lt;name|id&amp;gt;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Devices&lt;/strong&gt; - A list of devices to add to the container specified in the
form
&lt;code&gt;{ &amp;quot;PathOnHost&amp;quot;: &amp;quot;/dev/deviceName&amp;quot;, &amp;quot;PathInContainer&amp;quot;: &amp;quot;/dev/deviceName&amp;quot;, &amp;quot;CgroupPermissions&amp;quot;: &amp;quot;mrw&amp;quot;}&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;SecurityOpt&lt;/strong&gt;: A list of string values to customize labels for MLS
systems, such as SELinux.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;name&lt;/strong&gt; Assign the specified name to the container. Must
match &lt;code&gt;/?[a-zA-Z0-9_-]+&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;201&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;406&lt;/strong&gt; impossible to attach (container not running)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;inspect-a-container&#34;&gt;Inspect a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /containers/(id)/json&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Return low-level information on the container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /containers/4fa6e0f0c678/json HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
{
&amp;quot;AppArmorProfile&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;Args&amp;quot;: [
&amp;quot;-c&amp;quot;,
&amp;quot;exit 9&amp;quot;
],
&amp;quot;Config&amp;quot;: {
&amp;quot;AttachStderr&amp;quot;: true,
&amp;quot;AttachStdin&amp;quot;: false,
&amp;quot;AttachStdout&amp;quot;: true,
&amp;quot;Cmd&amp;quot;: [
&amp;quot;/bin/sh&amp;quot;,
&amp;quot;-c&amp;quot;,
&amp;quot;exit 9&amp;quot;
],
&amp;quot;CpuShares&amp;quot;: 0,
&amp;quot;Cpuset&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;Domainname&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;Entrypoint&amp;quot;: null,
&amp;quot;Env&amp;quot;: [
&amp;quot;PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin&amp;quot;
],
&amp;quot;ExposedPorts&amp;quot;: null,
&amp;quot;Hostname&amp;quot;: &amp;quot;ba033ac44011&amp;quot;,
&amp;quot;Image&amp;quot;: &amp;quot;ubuntu&amp;quot;,
&amp;quot;MacAddress&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;Memory&amp;quot;: 0,
&amp;quot;MemorySwap&amp;quot;: 0,
&amp;quot;NetworkDisabled&amp;quot;: false,
&amp;quot;OnBuild&amp;quot;: null,
&amp;quot;OpenStdin&amp;quot;: false,
&amp;quot;PortSpecs&amp;quot;: null,
&amp;quot;StdinOnce&amp;quot;: false,
&amp;quot;Tty&amp;quot;: false,
&amp;quot;User&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;Volumes&amp;quot;: null,
&amp;quot;WorkingDir&amp;quot;: &amp;quot;&amp;quot;
},
&amp;quot;Created&amp;quot;: &amp;quot;2015-01-06T15:47:31.485331387Z&amp;quot;,
&amp;quot;Driver&amp;quot;: &amp;quot;devicemapper&amp;quot;,
&amp;quot;ExecDriver&amp;quot;: &amp;quot;native-0.2&amp;quot;,
&amp;quot;ExecIDs&amp;quot;: null,
&amp;quot;HostConfig&amp;quot;: {
&amp;quot;Binds&amp;quot;: null,
&amp;quot;CapAdd&amp;quot;: null,
&amp;quot;CapDrop&amp;quot;: null,
&amp;quot;ContainerIDFile&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;Devices&amp;quot;: [],
&amp;quot;Dns&amp;quot;: null,
&amp;quot;DnsSearch&amp;quot;: null,
&amp;quot;ExtraHosts&amp;quot;: null,
&amp;quot;IpcMode&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;Links&amp;quot;: null,
&amp;quot;LxcConf&amp;quot;: [],
&amp;quot;NetworkMode&amp;quot;: &amp;quot;bridge&amp;quot;,
&amp;quot;PortBindings&amp;quot;: {},
&amp;quot;Privileged&amp;quot;: false,
&amp;quot;ReadonlyRootfs&amp;quot;: false,
&amp;quot;PublishAllPorts&amp;quot;: false,
&amp;quot;RestartPolicy&amp;quot;: {
&amp;quot;MaximumRetryCount&amp;quot;: 2,
&amp;quot;Name&amp;quot;: &amp;quot;on-failure&amp;quot;
},
&amp;quot;SecurityOpt&amp;quot;: null,
&amp;quot;VolumesFrom&amp;quot;: null
},
&amp;quot;HostnamePath&amp;quot;: &amp;quot;/var/lib/docker/containers/ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39/hostname&amp;quot;,
&amp;quot;HostsPath&amp;quot;: &amp;quot;/var/lib/docker/containers/ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39/hosts&amp;quot;,
&amp;quot;Id&amp;quot;: &amp;quot;ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39&amp;quot;,
&amp;quot;Image&amp;quot;: &amp;quot;04c5d3b7b0656168630d3ba35d8889bd0e9caafcaeb3004d2bfbc47e7c5d35d2&amp;quot;,
&amp;quot;MountLabel&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;Name&amp;quot;: &amp;quot;/boring_euclid&amp;quot;,
&amp;quot;NetworkSettings&amp;quot;: {
&amp;quot;Bridge&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;Gateway&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;IPAddress&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;IPPrefixLen&amp;quot;: 0,
&amp;quot;MacAddress&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;PortMapping&amp;quot;: null,
&amp;quot;Ports&amp;quot;: null
},
&amp;quot;Path&amp;quot;: &amp;quot;/bin/sh&amp;quot;,
&amp;quot;ProcessLabel&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;ResolvConfPath&amp;quot;: &amp;quot;/var/lib/docker/containers/ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39/resolv.conf&amp;quot;,
&amp;quot;RestartCount&amp;quot;: 1,
&amp;quot;State&amp;quot;: {
&amp;quot;Error&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;ExitCode&amp;quot;: 9,
&amp;quot;FinishedAt&amp;quot;: &amp;quot;2015-01-06T15:47:32.080254511Z&amp;quot;,
&amp;quot;OOMKilled&amp;quot;: false,
&amp;quot;Paused&amp;quot;: false,
&amp;quot;Pid&amp;quot;: 0,
&amp;quot;Restarting&amp;quot;: false,
&amp;quot;Running&amp;quot;: false,
&amp;quot;StartedAt&amp;quot;: &amp;quot;2015-01-06T15:47:32.072697474Z&amp;quot;
},
&amp;quot;Volumes&amp;quot;: {},
&amp;quot;VolumesRW&amp;quot;: {}
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;list-processes-running-inside-a-container&#34;&gt;List processes running inside a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /containers/(id)/top&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;List processes running inside the container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /containers/4fa6e0f0c678/top HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
{
&amp;quot;Titles&amp;quot;: [
&amp;quot;USER&amp;quot;,
&amp;quot;PID&amp;quot;,
&amp;quot;%CPU&amp;quot;,
&amp;quot;%MEM&amp;quot;,
&amp;quot;VSZ&amp;quot;,
&amp;quot;RSS&amp;quot;,
&amp;quot;TTY&amp;quot;,
&amp;quot;STAT&amp;quot;,
&amp;quot;START&amp;quot;,
&amp;quot;TIME&amp;quot;,
&amp;quot;COMMAND&amp;quot;
],
&amp;quot;Processes&amp;quot;: [
[&amp;quot;root&amp;quot;,&amp;quot;20147&amp;quot;,&amp;quot;0.0&amp;quot;,&amp;quot;0.1&amp;quot;,&amp;quot;18060&amp;quot;,&amp;quot;1864&amp;quot;,&amp;quot;pts/4&amp;quot;,&amp;quot;S&amp;quot;,&amp;quot;10:06&amp;quot;,&amp;quot;0:00&amp;quot;,&amp;quot;bash&amp;quot;],
[&amp;quot;root&amp;quot;,&amp;quot;20271&amp;quot;,&amp;quot;0.0&amp;quot;,&amp;quot;0.0&amp;quot;,&amp;quot;4312&amp;quot;,&amp;quot;352&amp;quot;,&amp;quot;pts/4&amp;quot;,&amp;quot;S+&amp;quot;,&amp;quot;10:07&amp;quot;,&amp;quot;0:00&amp;quot;,&amp;quot;sleep&amp;quot;,&amp;quot;10&amp;quot;]
]
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;ps_args&lt;/strong&gt; ps arguments to use (e.g., aux)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;get-container-logs&#34;&gt;Get container logs&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /containers/(id)/logs&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Get stdout and stderr logs from the container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /containers/4fa6e0f0c678/logs?stderr=1&amp;amp;stdout=1&amp;amp;timestamps=1&amp;amp;follow=1&amp;amp;tail=10 HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 101 UPGRADED
Content-Type: application/vnd.docker.raw-stream
Connection: Upgrade
Upgrade: tcp
{{ STREAM }}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;follow&lt;/strong&gt; 1/True/true or 0/False/false, return stream. Default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;stdout&lt;/strong&gt; 1/True/true or 0/False/false, show stdout log. Default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;stderr&lt;/strong&gt; 1/True/true or 0/False/false, show stderr log. Default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;timestamps&lt;/strong&gt; 1/True/true or 0/False/false, print timestamps for
every log line. Default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;tail&lt;/strong&gt; Output specified number of lines at the end of logs: &lt;code&gt;all&lt;/code&gt; or &lt;code&gt;&amp;lt;number&amp;gt;&lt;/code&gt;. Default all&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;101&lt;/strong&gt; no error, hints proxy about hijacking&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error, no upgrade header found&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;inspect-changes-on-a-container-s-filesystem&#34;&gt;Inspect changes on a container&amp;rsquo;s filesystem&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /containers/(id)/changes&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Inspect changes on container &lt;code&gt;id&lt;/code&gt;&amp;rsquo;s filesystem&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /containers/4fa6e0f0c678/changes HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
[
{
&amp;quot;Path&amp;quot;: &amp;quot;/dev&amp;quot;,
&amp;quot;Kind&amp;quot;: 0
},
{
&amp;quot;Path&amp;quot;: &amp;quot;/dev/kmsg&amp;quot;,
&amp;quot;Kind&amp;quot;: 1
},
{
&amp;quot;Path&amp;quot;: &amp;quot;/test&amp;quot;,
&amp;quot;Kind&amp;quot;: 1
}
]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;export-a-container&#34;&gt;Export a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /containers/(id)/export&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Export the contents of container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /containers/4fa6e0f0c678/export HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/octet-stream
{{ TAR STREAM }}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;get-container-stats-based-on-resource-usage&#34;&gt;Get container stats based on resource usage&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /containers/(id)/stats&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;This endpoint returns a live stream of a container&amp;rsquo;s resource usage statistics.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /containers/redis1/stats HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
{
&amp;quot;read&amp;quot; : &amp;quot;2015-01-08T22:57:31.547920715Z&amp;quot;,
&amp;quot;network&amp;quot; : {
&amp;quot;rx_dropped&amp;quot; : 0,
&amp;quot;rx_bytes&amp;quot; : 648,
&amp;quot;rx_errors&amp;quot; : 0,
&amp;quot;tx_packets&amp;quot; : 8,
&amp;quot;tx_dropped&amp;quot; : 0,
&amp;quot;rx_packets&amp;quot; : 8,
&amp;quot;tx_errors&amp;quot; : 0,
&amp;quot;tx_bytes&amp;quot; : 648
},
&amp;quot;memory_stats&amp;quot; : {
&amp;quot;stats&amp;quot; : {
&amp;quot;total_pgmajfault&amp;quot; : 0,
&amp;quot;cache&amp;quot; : 0,
&amp;quot;mapped_file&amp;quot; : 0,
&amp;quot;total_inactive_file&amp;quot; : 0,
&amp;quot;pgpgout&amp;quot; : 414,
&amp;quot;rss&amp;quot; : 6537216,
&amp;quot;total_mapped_file&amp;quot; : 0,
&amp;quot;writeback&amp;quot; : 0,
&amp;quot;unevictable&amp;quot; : 0,
&amp;quot;pgpgin&amp;quot; : 477,
&amp;quot;total_unevictable&amp;quot; : 0,
&amp;quot;pgmajfault&amp;quot; : 0,
&amp;quot;total_rss&amp;quot; : 6537216,
&amp;quot;total_rss_huge&amp;quot; : 6291456,
&amp;quot;total_writeback&amp;quot; : 0,
&amp;quot;total_inactive_anon&amp;quot; : 0,
&amp;quot;rss_huge&amp;quot; : 6291456,
&amp;quot;hierarchical_memory_limit&amp;quot; : 67108864,
&amp;quot;total_pgfault&amp;quot; : 964,
&amp;quot;total_active_file&amp;quot; : 0,
&amp;quot;active_anon&amp;quot; : 6537216,
&amp;quot;total_active_anon&amp;quot; : 6537216,
&amp;quot;total_pgpgout&amp;quot; : 414,
&amp;quot;total_cache&amp;quot; : 0,
&amp;quot;inactive_anon&amp;quot; : 0,
&amp;quot;active_file&amp;quot; : 0,
&amp;quot;pgfault&amp;quot; : 964,
&amp;quot;inactive_file&amp;quot; : 0,
&amp;quot;total_pgpgin&amp;quot; : 477
},
&amp;quot;max_usage&amp;quot; : 6651904,
&amp;quot;usage&amp;quot; : 6537216,
&amp;quot;failcnt&amp;quot; : 0,
&amp;quot;limit&amp;quot; : 67108864
},
&amp;quot;blkio_stats&amp;quot; : {},
&amp;quot;cpu_stats&amp;quot; : {
&amp;quot;cpu_usage&amp;quot; : {
&amp;quot;percpu_usage&amp;quot; : [
16970827,
1839451,
7107380,
10571290
],
&amp;quot;usage_in_usermode&amp;quot; : 10000000,
&amp;quot;total_usage&amp;quot; : 36488948,
&amp;quot;usage_in_kernelmode&amp;quot; : 20000000
},
&amp;quot;system_cpu_usage&amp;quot; : 20091722000000000,
&amp;quot;throttling_data&amp;quot; : {}
}
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;resize-a-container-tty&#34;&gt;Resize a container TTY&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /containers/(id)/resize?h=&amp;lt;height&amp;gt;&amp;amp;w=&amp;lt;width&amp;gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Resize the TTY for container with &lt;code&gt;id&lt;/code&gt;. The container must be restarted for the resize to take effect.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /containers/4fa6e0f0c678/resize?h=40&amp;amp;w=80 HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Length: 0
Content-Type: text/plain; charset=utf-8
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; No such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; Cannot resize container&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;start-a-container&#34;&gt;Start a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /containers/(id)/start&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Start the container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /containers/(id)/start HTTP/1.1
Content-Type: application/json
{
&amp;quot;Binds&amp;quot;: [&amp;quot;/tmp:/tmp&amp;quot;],
&amp;quot;Links&amp;quot;: [&amp;quot;redis3:redis&amp;quot;],
&amp;quot;LxcConf&amp;quot;: {&amp;quot;lxc.utsname&amp;quot;:&amp;quot;docker&amp;quot;},
&amp;quot;PortBindings&amp;quot;: { &amp;quot;22/tcp&amp;quot;: [{ &amp;quot;HostPort&amp;quot;: &amp;quot;11022&amp;quot; }] },
&amp;quot;PublishAllPorts&amp;quot;: false,
&amp;quot;Privileged&amp;quot;: false,
&amp;quot;ReadonlyRootfs&amp;quot;: false,
&amp;quot;Dns&amp;quot;: [&amp;quot;8.8.8.8&amp;quot;],
&amp;quot;DnsSearch&amp;quot;: [&amp;quot;&amp;quot;],
&amp;quot;VolumesFrom&amp;quot;: [&amp;quot;parent&amp;quot;, &amp;quot;other:ro&amp;quot;],
&amp;quot;CapAdd&amp;quot;: [&amp;quot;NET_ADMIN&amp;quot;],
&amp;quot;CapDrop&amp;quot;: [&amp;quot;MKNOD&amp;quot;],
&amp;quot;RestartPolicy&amp;quot;: { &amp;quot;Name&amp;quot;: &amp;quot;&amp;quot;, &amp;quot;MaximumRetryCount&amp;quot;: 0 },
&amp;quot;NetworkMode&amp;quot;: &amp;quot;bridge&amp;quot;,
&amp;quot;Devices&amp;quot;: []
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 204 No Content
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Json Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Binds&lt;/strong&gt; A list of volume bindings for this container. Each volume
binding is a string of the form &lt;code&gt;container_path&lt;/code&gt; (to create a new
volume for the container), &lt;code&gt;host_path:container_path&lt;/code&gt; (to bind-mount
a host path into the container), or &lt;code&gt;host_path:container_path:ro&lt;/code&gt;
(to make the bind-mount read-only inside the container).&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Links&lt;/strong&gt; - A list of links for the container. Each link entry should be of
of the form &amp;ldquo;container_name:alias&amp;rdquo;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;LxcConf&lt;/strong&gt; - LXC specific configurations. These configurations will only
work when using the &lt;code&gt;lxc&lt;/code&gt; execution driver.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;PortBindings&lt;/strong&gt; - A map of exposed container ports and the host port they
should map to. It should be specified in the form
&lt;code&gt;{ &amp;lt;port&amp;gt;/&amp;lt;protocol&amp;gt;: [{ &amp;quot;HostPort&amp;quot;: &amp;quot;&amp;lt;port&amp;gt;&amp;quot; }] }&lt;/code&gt;
Take note that &lt;code&gt;port&lt;/code&gt; is specified as a string and not an integer value.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;PublishAllPorts&lt;/strong&gt; - Allocates a random host port for all of a container&amp;rsquo;s
exposed ports. Specified as a boolean value.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Privileged&lt;/strong&gt; - Gives the container full access to the host. Specified as
a boolean value.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;ReadonlyRootfs&lt;/strong&gt; - Mount the container&amp;rsquo;s root filesystem as read only.
Specified as a boolean value.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Dns&lt;/strong&gt; - A list of dns servers for the container to use.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;DnsSearch&lt;/strong&gt; - A list of DNS search domains&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;VolumesFrom&lt;/strong&gt; - A list of volumes to inherit from another container.
Specified in the form &lt;code&gt;&amp;lt;container name&amp;gt;[:&amp;lt;ro|rw&amp;gt;]&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;CapAdd&lt;/strong&gt; - A list of kernel capabilities to add to the container.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Capdrop&lt;/strong&gt; - A list of kernel capabilities to drop from the container.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;RestartPolicy&lt;/strong&gt; The behavior to apply when the container exits. The
value is an object with a &lt;code&gt;Name&lt;/code&gt; property of either &lt;code&gt;&amp;quot;always&amp;quot;&lt;/code&gt; to
always restart or &lt;code&gt;&amp;quot;on-failure&amp;quot;&lt;/code&gt; to restart only when the container
exit code is non-zero. If &lt;code&gt;on-failure&lt;/code&gt; is used, &lt;code&gt;MaximumRetryCount&lt;/code&gt;
controls the number of times to retry before giving up.
The default is not to restart. (optional)
An ever increasing delay (double the previous delay, starting at 100mS)
is added before each restart to prevent flooding the server.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;NetworkMode&lt;/strong&gt; - Sets the networking mode for the container. Supported
values are: &lt;code&gt;bridge&lt;/code&gt;, &lt;code&gt;host&lt;/code&gt;, and &lt;code&gt;container:&amp;lt;name|id&amp;gt;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Devices&lt;/strong&gt; - A list of devices to add to the container specified in the
form
&lt;code&gt;{ &amp;quot;PathOnHost&amp;quot;: &amp;quot;/dev/deviceName&amp;quot;, &amp;quot;PathInContainer&amp;quot;: &amp;quot;/dev/deviceName&amp;quot;, &amp;quot;CgroupPermissions&amp;quot;: &amp;quot;mrw&amp;quot;}&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;204&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;304&lt;/strong&gt; container already started&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;stop-a-container&#34;&gt;Stop a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /containers/(id)/stop&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Stop the container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /containers/e90e34656806/stop?t=5 HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 204 No Content
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;t&lt;/strong&gt; number of seconds to wait before killing the container&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;204&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;304&lt;/strong&gt; container already stopped&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;restart-a-container&#34;&gt;Restart a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /containers/(id)/restart&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Restart the container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /containers/e90e34656806/restart?t=5 HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 204 No Content
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;t&lt;/strong&gt; number of seconds to wait before killing the container&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;204&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;kill-a-container&#34;&gt;Kill a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /containers/(id)/kill&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Kill the container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /containers/e90e34656806/kill HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 204 No Content
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;signal&lt;/strong&gt; - Signal to send to the container: integer or string like &amp;ldquo;SIGINT&amp;rdquo;.
When not set, SIGKILL is assumed and the call will waits for the container to exit.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;204&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;rename-a-container&#34;&gt;Rename a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /containers/(id)/rename&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Rename the container &lt;code&gt;id&lt;/code&gt; to a &lt;code&gt;new_name&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /containers/e90e34656806/rename?name=new_name HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 204 No Content
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;name&lt;/strong&gt; new name for the container&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;204&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;409&lt;/strong&gt; - conflict name already assigned&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;pause-a-container&#34;&gt;Pause a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /containers/(id)/pause&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Pause the container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /containers/e90e34656806/pause HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 204 No Content
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;204&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;unpause-a-container&#34;&gt;Unpause a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /containers/(id)/unpause&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Unpause the container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /containers/e90e34656806/unpause HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 204 No Content
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;204&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;attach-to-a-container&#34;&gt;Attach to a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /containers/(id)/attach&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Attach to the container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /containers/16253994b7c4/attach?logs=1&amp;amp;stream=0&amp;amp;stdout=1 HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 101 UPGRADED
Content-Type: application/vnd.docker.raw-stream
Connection: Upgrade
Upgrade: tcp
{{ STREAM }}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;logs&lt;/strong&gt; 1/True/true or 0/False/false, return logs. Default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;stream&lt;/strong&gt; 1/True/true or 0/False/false, return stream.
Default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;stdin&lt;/strong&gt; 1/True/true or 0/False/false, if stream=true, attach
to stdin. Default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;stdout&lt;/strong&gt; 1/True/true or 0/False/false, if logs=true, return
stdout log, if stream=true, attach to stdout. Default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;stderr&lt;/strong&gt; 1/True/true or 0/False/false, if logs=true, return
stderr log, if stream=true, attach to stderr. Default false&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;101&lt;/strong&gt; no error, hints proxy about hijacking&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error, no upgrade header found&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;400&lt;/strong&gt; bad parameter&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Stream details&lt;/strong&gt;:&lt;/p&gt;
&lt;p&gt;When using the TTY setting is enabled in
&lt;a href=&#34;http://localhost/docker/reference/api/docker_remote_api_v1.9/#create-a-container&#34; title=&#34;POST /containers/create&#34;&gt;&lt;code&gt;POST /containers/create&lt;/code&gt;
&lt;/a&gt;,
the stream is the raw data from the process PTY and client&amp;rsquo;s stdin.
When the TTY is disabled, then the stream is multiplexed to separate
stdout and stderr.&lt;/p&gt;
&lt;p&gt;The format is a &lt;strong&gt;Header&lt;/strong&gt; and a &lt;strong&gt;Payload&lt;/strong&gt; (frame).&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;HEADER&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The header will contain the information on which stream write the
stream (stdout or stderr). It also contain the size of the
associated frame encoded on the last 4 bytes (uint32).&lt;/p&gt;
&lt;p&gt;It is encoded on the first 8 bytes like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;header := [8]byte{STREAM_TYPE, 0, 0, 0, SIZE1, SIZE2, SIZE3, SIZE4}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;STREAM_TYPE&lt;/code&gt; can be:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;0: stdin (will be written on stdout)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;1: stdout&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;2: stderr&lt;/p&gt;
&lt;p&gt;&lt;code&gt;SIZE1, SIZE2, SIZE3, SIZE4&lt;/code&gt; are the 4 bytes of
the uint32 size encoded as big endian.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;PAYLOAD&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The payload is the raw stream.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;IMPLEMENTATION&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The simplest way to implement the Attach protocol is the following:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Read 8 bytes&lt;/li&gt;
&lt;li&gt;chose stdout or stderr depending on the first byte&lt;/li&gt;
&lt;li&gt;Extract the frame size from the last 4 bytes&lt;/li&gt;
&lt;li&gt;Read the extracted size and output it on the correct output&lt;/li&gt;
&lt;li&gt;Goto 1&lt;/li&gt;
&lt;/ol&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;attach-to-a-container-websocket&#34;&gt;Attach to a container (websocket)&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /containers/(id)/attach/ws&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Attach to the container &lt;code&gt;id&lt;/code&gt; via websocket&lt;/p&gt;
&lt;p&gt;Implements websocket protocol handshake according to &lt;a href=&#34;http://tools.ietf.org/html/rfc6455&#34;&gt;RFC 6455&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /containers/e90e34656806/attach/ws?logs=0&amp;amp;stream=1&amp;amp;stdin=1&amp;amp;stdout=1&amp;amp;stderr=1 HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; {{ STREAM }}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;logs&lt;/strong&gt; 1/True/true or 0/False/false, return logs. Default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;stream&lt;/strong&gt; 1/True/true or 0/False/false, return stream.
Default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;stdin&lt;/strong&gt; 1/True/true or 0/False/false, if stream=true, attach
to stdin. Default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;stdout&lt;/strong&gt; 1/True/true or 0/False/false, if logs=true, return
stdout log, if stream=true, attach to stdout. Default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;stderr&lt;/strong&gt; 1/True/true or 0/False/false, if logs=true, return
stderr log, if stream=true, attach to stderr. Default false&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;400&lt;/strong&gt; bad parameter&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;wait-a-container&#34;&gt;Wait a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /containers/(id)/wait&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Block until container &lt;code&gt;id&lt;/code&gt; stops, then returns the exit code&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /containers/16253994b7c4/wait HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
{&amp;quot;StatusCode&amp;quot;: 0}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;remove-a-container&#34;&gt;Remove a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;DELETE /containers/(id)&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Remove the container &lt;code&gt;id&lt;/code&gt; from the filesystem&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; DELETE /containers/16253994b7c4?v=1 HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 204 No Content
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;v&lt;/strong&gt; 1/True/true or 0/False/false, Remove the volumes
associated to the container. Default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;force&lt;/strong&gt; - 1/True/true or 0/False/false, Kill then remove the container.
Default false&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;204&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;400&lt;/strong&gt; bad parameter&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;copy-files-or-folders-from-a-container&#34;&gt;Copy files or folders from a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /containers/(id)/copy&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Copy files or folders of container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /containers/4fa6e0f0c678/copy HTTP/1.1
Content-Type: application/json
{
&amp;quot;Resource&amp;quot;: &amp;quot;test.txt&amp;quot;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/x-tar
{{ TAR STREAM }}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;2-2-images&#34;&gt;2.2 Images&lt;/h2&gt;
&lt;h3 id=&#34;list-images&#34;&gt;List Images&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /images/json&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /images/json?all=0 HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
[
{
&amp;quot;RepoTags&amp;quot;: [
&amp;quot;ubuntu:12.04&amp;quot;,
&amp;quot;ubuntu:precise&amp;quot;,
&amp;quot;ubuntu:latest&amp;quot;
],
&amp;quot;Id&amp;quot;: &amp;quot;8dbd9e392a964056420e5d58ca5cc376ef18e2de93b5cc90e868a1bbc8318c1c&amp;quot;,
&amp;quot;Created&amp;quot;: 1365714795,
&amp;quot;Size&amp;quot;: 131506275,
&amp;quot;VirtualSize&amp;quot;: 131506275
},
{
&amp;quot;RepoTags&amp;quot;: [
&amp;quot;ubuntu:12.10&amp;quot;,
&amp;quot;ubuntu:quantal&amp;quot;
],
&amp;quot;ParentId&amp;quot;: &amp;quot;27cf784147099545&amp;quot;,
&amp;quot;Id&amp;quot;: &amp;quot;b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc&amp;quot;,
&amp;quot;Created&amp;quot;: 1364102658,
&amp;quot;Size&amp;quot;: 24653,
&amp;quot;VirtualSize&amp;quot;: 180116135
}
]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;all&lt;/strong&gt; 1/True/true or 0/False/false, default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;filters&lt;/strong&gt; a json encoded value of the filters (a map[string][]string) to process on the images list. Available filters:
&lt;ul&gt;
&lt;li&gt;dangling=true&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;build-image-from-a-dockerfile&#34;&gt;Build image from a Dockerfile&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /build&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Build an image from a Dockerfile&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /build HTTP/1.1
{{ TAR STREAM }}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
{&amp;quot;stream&amp;quot;: &amp;quot;Step 1...&amp;quot;}
{&amp;quot;stream&amp;quot;: &amp;quot;...&amp;quot;}
{&amp;quot;error&amp;quot;: &amp;quot;Error...&amp;quot;, &amp;quot;errorDetail&amp;quot;: {&amp;quot;code&amp;quot;: 123, &amp;quot;message&amp;quot;: &amp;quot;Error...&amp;quot;}}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The input stream must be a tar archive compressed with one of the
following algorithms: identity (no compression), gzip, bzip2, xz.&lt;/p&gt;
&lt;p&gt;The archive must include a build instructions file, typically called
&lt;code&gt;Dockerfile&lt;/code&gt; at the root of the archive. The &lt;code&gt;dockerfile&lt;/code&gt; parameter may be
used to specify a different build instructions file by having its value be
the path to the alternate build instructions file to use.&lt;/p&gt;
&lt;p&gt;The archive may include any number of other files,
which will be accessible in the build context (See the &lt;a href=&#34;http://localhost/docker/reference/builder/#dockerbuilder&#34;&gt;&lt;em&gt;ADD build
command&lt;/em&gt;&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;dockerfile&lt;/strong&gt; - path within the build context to the Dockerfile&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;t&lt;/strong&gt; repository name (and optionally a tag) to be applied to
the resulting image in case of success&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;remote&lt;/strong&gt; git or HTTP/HTTPS URI build source&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;q&lt;/strong&gt; suppress verbose build output&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;nocache&lt;/strong&gt; do not use the cache when building the image&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;pull&lt;/strong&gt; - attempt to pull the image even if an older image exists locally&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;rm&lt;/strong&gt; - remove intermediate containers after a successful build (default behavior)&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;forcerm&lt;/strong&gt; - always remove intermediate containers (includes rm)&lt;/p&gt;
&lt;p&gt;Request Headers:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Content-type&lt;/strong&gt; should be set to &lt;code&gt;&amp;quot;application/tar&amp;quot;&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;X-Registry-Config&lt;/strong&gt; base64-encoded ConfigFile object&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;create-an-image&#34;&gt;Create an image&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /images/create&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Create an image, either by pulling it from the registry or by importing it&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /images/create?fromImage=ubuntu HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
{&amp;quot;status&amp;quot;: &amp;quot;Pulling...&amp;quot;}
{&amp;quot;status&amp;quot;: &amp;quot;Pulling&amp;quot;, &amp;quot;progress&amp;quot;: &amp;quot;1 B/ 100 B&amp;quot;, &amp;quot;progressDetail&amp;quot;: {&amp;quot;current&amp;quot;: 1, &amp;quot;total&amp;quot;: 100}}
{&amp;quot;error&amp;quot;: &amp;quot;Invalid...&amp;quot;}
...
When using this endpoint to pull an image from the registry, the
`X-Registry-Auth` header can be used to include
a base64-encoded AuthConfig object.
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;fromImage&lt;/strong&gt; name of the image to pull&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;fromSrc&lt;/strong&gt; source to import. The value may be a URL from which the image
can be retrieved or &lt;code&gt;-&lt;/code&gt; to read the image from the request body.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;repo&lt;/strong&gt; repository&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;tag&lt;/strong&gt; tag&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;registry&lt;/strong&gt; the registry to pull from&lt;/p&gt;
&lt;p&gt;Request Headers:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;X-Registry-Auth&lt;/strong&gt; base64-encoded AuthConfig object&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;inspect-an-image&#34;&gt;Inspect an image&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /images/(name)/json&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Return low-level information on the image &lt;code&gt;name&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /images/ubuntu/json HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
{
&amp;quot;Created&amp;quot;: &amp;quot;2013-03-23T22:24:18.818426-07:00&amp;quot;,
&amp;quot;Container&amp;quot;: &amp;quot;3d67245a8d72ecf13f33dffac9f79dcdf70f75acb84d308770391510e0c23ad0&amp;quot;,
&amp;quot;ContainerConfig&amp;quot;:
{
&amp;quot;Hostname&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;User&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;Memory&amp;quot;: 0,
&amp;quot;MemorySwap&amp;quot;: 0,
&amp;quot;AttachStdin&amp;quot;: false,
&amp;quot;AttachStdout&amp;quot;: false,
&amp;quot;AttachStderr&amp;quot;: false,
&amp;quot;PortSpecs&amp;quot;: null,
&amp;quot;Tty&amp;quot;: true,
&amp;quot;OpenStdin&amp;quot;: true,
&amp;quot;StdinOnce&amp;quot;: false,
&amp;quot;Env&amp;quot;: null,
&amp;quot;Cmd&amp;quot;: [&amp;quot;/bin/bash&amp;quot;],
&amp;quot;Dns&amp;quot;: null,
&amp;quot;Image&amp;quot;: &amp;quot;ubuntu&amp;quot;,
&amp;quot;Volumes&amp;quot;: null,
&amp;quot;VolumesFrom&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;WorkingDir&amp;quot;: &amp;quot;&amp;quot;
},
&amp;quot;Id&amp;quot;: &amp;quot;b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc&amp;quot;,
&amp;quot;Parent&amp;quot;: &amp;quot;27cf784147099545&amp;quot;,
&amp;quot;Size&amp;quot;: 6824592
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such image&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;get-the-history-of-an-image&#34;&gt;Get the history of an image&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /images/(name)/history&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Return the history of the image &lt;code&gt;name&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /images/ubuntu/history HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
[
{
&amp;quot;Id&amp;quot;: &amp;quot;b750fe79269d&amp;quot;,
&amp;quot;Created&amp;quot;: 1364102658,
&amp;quot;CreatedBy&amp;quot;: &amp;quot;/bin/bash&amp;quot;
},
{
&amp;quot;Id&amp;quot;: &amp;quot;27cf78414709&amp;quot;,
&amp;quot;Created&amp;quot;: 1364068391,
&amp;quot;CreatedBy&amp;quot;: &amp;quot;&amp;quot;
}
]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such image&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;push-an-image-on-the-registry&#34;&gt;Push an image on the registry&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /images/(name)/push&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Push the image &lt;code&gt;name&lt;/code&gt; on the registry&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /images/test/push HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
{&amp;quot;status&amp;quot;: &amp;quot;Pushing...&amp;quot;}
{&amp;quot;status&amp;quot;: &amp;quot;Pushing&amp;quot;, &amp;quot;progress&amp;quot;: &amp;quot;1/? (n/a)&amp;quot;, &amp;quot;progressDetail&amp;quot;: {&amp;quot;current&amp;quot;: 1}}}
{&amp;quot;error&amp;quot;: &amp;quot;Invalid...&amp;quot;}
...
If you wish to push an image on to a private registry, that image must already have been tagged
into a repository which references that registry host name and port. This repository name should
then be used in the URL. This mirrors the flow of the CLI.
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /images/registry.acme.com:5000/test/push HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;tag&lt;/strong&gt; the tag to associate with the image on the registry, optional&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Request Headers:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;X-Registry-Auth&lt;/strong&gt; include a base64-encoded AuthConfig
object.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such image&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;tag-an-image-into-a-repository&#34;&gt;Tag an image into a repository&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /images/(name)/tag&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Tag the image &lt;code&gt;name&lt;/code&gt; into a repository&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /images/test/tag?repo=myrepo&amp;amp;force=0&amp;amp;tag=v42 HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 201 OK
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;repo&lt;/strong&gt; The repository to tag in&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;force&lt;/strong&gt; 1/True/true or 0/False/false, default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;tag&lt;/strong&gt; - The new tag name&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;201&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;400&lt;/strong&gt; bad parameter&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such image&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;409&lt;/strong&gt; conflict&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;remove-an-image&#34;&gt;Remove an image&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;DELETE /images/(name)&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Remove the image &lt;code&gt;name&lt;/code&gt; from the filesystem&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; DELETE /images/test HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-type: application/json
[
{&amp;quot;Untagged&amp;quot;: &amp;quot;3e2f21a89f&amp;quot;},
{&amp;quot;Deleted&amp;quot;: &amp;quot;3e2f21a89f&amp;quot;},
{&amp;quot;Deleted&amp;quot;: &amp;quot;53b4f83ac9&amp;quot;}
]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;force&lt;/strong&gt; 1/True/true or 0/False/false, default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;noprune&lt;/strong&gt; 1/True/true or 0/False/false, default false&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such image&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;409&lt;/strong&gt; conflict&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;search-images&#34;&gt;Search images&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /images/search&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Search for an image on &lt;a href=&#34;https://hub.docker.com&#34;&gt;Docker Hub&lt;/a&gt;.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;:
The response keys have changed from API v1.6 to reflect the JSON
sent by the registry server to the docker daemon&amp;rsquo;s request.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /images/search?term=sshd HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
[
{
&amp;quot;description&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;is_official&amp;quot;: false,
&amp;quot;is_automated&amp;quot;: false,
&amp;quot;name&amp;quot;: &amp;quot;wma55/u1210sshd&amp;quot;,
&amp;quot;star_count&amp;quot;: 0
},
{
&amp;quot;description&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;is_official&amp;quot;: false,
&amp;quot;is_automated&amp;quot;: false,
&amp;quot;name&amp;quot;: &amp;quot;jdswinbank/sshd&amp;quot;,
&amp;quot;star_count&amp;quot;: 0
},
{
&amp;quot;description&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;is_official&amp;quot;: false,
&amp;quot;is_automated&amp;quot;: false,
&amp;quot;name&amp;quot;: &amp;quot;vgauthier/sshd&amp;quot;,
&amp;quot;star_count&amp;quot;: 0
}
...
]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;term&lt;/strong&gt; term to search&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;2-3-misc&#34;&gt;2.3 Misc&lt;/h2&gt;
&lt;h3 id=&#34;check-auth-configuration&#34;&gt;Check auth configuration&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /auth&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Get the default username and email&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /auth HTTP/1.1
Content-Type: application/json
{
&amp;quot;username&amp;quot;:&amp;quot; hannibal&amp;quot;,
&amp;quot;password: &amp;quot;xxxx&amp;quot;,
&amp;quot;email&amp;quot;: &amp;quot;hannibal@a-team.com&amp;quot;,
&amp;quot;serveraddress&amp;quot;: &amp;quot;https://index.docker.io/v1/&amp;quot;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;204&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;display-system-wide-information&#34;&gt;Display system-wide information&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /info&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Display system-wide information&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /info HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
{
&amp;quot;Containers&amp;quot;:11,
&amp;quot;Images&amp;quot;:16,
&amp;quot;Driver&amp;quot;:&amp;quot;btrfs&amp;quot;,
&amp;quot;DriverStatus&amp;quot;: [[&amp;quot;&amp;quot;]],
&amp;quot;ExecutionDriver&amp;quot;:&amp;quot;native-0.1&amp;quot;,
&amp;quot;KernelVersion&amp;quot;:&amp;quot;3.12.0-1-amd64&amp;quot;
&amp;quot;NCPU&amp;quot;:1,
&amp;quot;MemTotal&amp;quot;:2099236864,
&amp;quot;Name&amp;quot;:&amp;quot;prod-server-42&amp;quot;,
&amp;quot;ID&amp;quot;:&amp;quot;7TRN:IPZB:QYBB:VPBQ:UMPP:KARE:6ZNR:XE6T:7EWV:PKF4:ZOJD:TPYS&amp;quot;,
&amp;quot;Debug&amp;quot;:false,
&amp;quot;NFd&amp;quot;: 11,
&amp;quot;NGoroutines&amp;quot;:21,
&amp;quot;NEventsListener&amp;quot;:0,
&amp;quot;InitPath&amp;quot;:&amp;quot;/usr/bin/docker&amp;quot;,
&amp;quot;InitSha1&amp;quot;:&amp;quot;&amp;quot;,
&amp;quot;IndexServerAddress&amp;quot;:[&amp;quot;https://index.docker.io/v1/&amp;quot;],
&amp;quot;MemoryLimit&amp;quot;:true,
&amp;quot;SwapLimit&amp;quot;:false,
&amp;quot;IPv4Forwarding&amp;quot;:true,
&amp;quot;Labels&amp;quot;:[&amp;quot;storage=ssd&amp;quot;],
&amp;quot;DockerRootDir&amp;quot;: &amp;quot;/var/lib/docker&amp;quot;,
&amp;quot;OperatingSystem&amp;quot;: &amp;quot;Boot2Docker&amp;quot;,
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;show-the-docker-version-information&#34;&gt;Show the docker version information&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /version&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Show the docker version information&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /version HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
{
&amp;quot;ApiVersion&amp;quot;: &amp;quot;1.12&amp;quot;,
&amp;quot;Version&amp;quot;: &amp;quot;0.2.2&amp;quot;,
&amp;quot;GitCommit&amp;quot;: &amp;quot;5a2a5cc+CHANGES&amp;quot;,
&amp;quot;GoVersion&amp;quot;: &amp;quot;go1.0.3&amp;quot;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;ping-the-docker-server&#34;&gt;Ping the docker server&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /_ping&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Ping the docker server&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /_ping HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: text/plain
OK
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; - no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; - server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;create-a-new-image-from-a-container-s-changes&#34;&gt;Create a new image from a container&amp;rsquo;s changes&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /commit&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Create a new image from a container&amp;rsquo;s changes&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /commit?container=44c004db4b17&amp;amp;comment=message&amp;amp;repo=myrepo HTTP/1.1
Content-Type: application/json
{
&amp;quot;Hostname&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;Domainname&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;User&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;Memory&amp;quot;: 0,
&amp;quot;MemorySwap&amp;quot;: 0,
&amp;quot;CpuShares&amp;quot;: 512,
&amp;quot;Cpuset&amp;quot;: &amp;quot;0,1&amp;quot;,
&amp;quot;AttachStdin&amp;quot;: false,
&amp;quot;AttachStdout&amp;quot;: true,
&amp;quot;AttachStderr&amp;quot;: true,
&amp;quot;PortSpecs&amp;quot;: null,
&amp;quot;Tty&amp;quot;: false,
&amp;quot;OpenStdin&amp;quot;: false,
&amp;quot;StdinOnce&amp;quot;: false,
&amp;quot;Env&amp;quot;: null,
&amp;quot;Cmd&amp;quot;: [
&amp;quot;date&amp;quot;
],
&amp;quot;Volumes&amp;quot;: {
&amp;quot;/tmp&amp;quot;: {}
},
&amp;quot;WorkingDir&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;NetworkDisabled&amp;quot;: false,
&amp;quot;ExposedPorts&amp;quot;: {
&amp;quot;22/tcp&amp;quot;: {}
}
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 201 Created
Content-Type: application/vnd.docker.raw-stream
{&amp;quot;Id&amp;quot;: &amp;quot;596069db4bf5&amp;quot;}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Json Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;config&lt;/strong&gt; - the container&amp;rsquo;s configuration&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;container&lt;/strong&gt; source container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;repo&lt;/strong&gt; repository&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;tag&lt;/strong&gt; tag&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;comment&lt;/strong&gt; commit message&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;author&lt;/strong&gt; author (e.g., &amp;ldquo;John Hannibal Smith
&amp;lt;&lt;a href=&#34;mailto:hannibal%40a-team.com&#34;&gt;hannibal@a-team.com&lt;/a&gt;&amp;gt;&amp;ldquo;)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;201&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;monitor-docker-s-events&#34;&gt;Monitor Docker&amp;rsquo;s events&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /events&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Get container events from docker, either in real time via streaming, or via
polling (using since).&lt;/p&gt;
&lt;p&gt;Docker containers will report the following events:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;create, destroy, die, exec_create, exec_start, export, kill, oom, pause, restart, start, stop, unpause
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;and Docker images will report:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;untag, delete
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /events?since=1374067924
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
{&amp;quot;status&amp;quot;: &amp;quot;create&amp;quot;, &amp;quot;id&amp;quot;: &amp;quot;dfdf82bd3881&amp;quot;,&amp;quot;from&amp;quot;: &amp;quot;ubuntu:latest&amp;quot;, &amp;quot;time&amp;quot;:1374067924}
{&amp;quot;status&amp;quot;: &amp;quot;start&amp;quot;, &amp;quot;id&amp;quot;: &amp;quot;dfdf82bd3881&amp;quot;,&amp;quot;from&amp;quot;: &amp;quot;ubuntu:latest&amp;quot;, &amp;quot;time&amp;quot;:1374067924}
{&amp;quot;status&amp;quot;: &amp;quot;stop&amp;quot;, &amp;quot;id&amp;quot;: &amp;quot;dfdf82bd3881&amp;quot;,&amp;quot;from&amp;quot;: &amp;quot;ubuntu:latest&amp;quot;, &amp;quot;time&amp;quot;:1374067966}
{&amp;quot;status&amp;quot;: &amp;quot;destroy&amp;quot;, &amp;quot;id&amp;quot;: &amp;quot;dfdf82bd3881&amp;quot;,&amp;quot;from&amp;quot;: &amp;quot;ubuntu:latest&amp;quot;, &amp;quot;time&amp;quot;:1374067970}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;since&lt;/strong&gt; timestamp used for polling&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;until&lt;/strong&gt; timestamp used for polling&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;filters&lt;/strong&gt; a json encoded value of the filters (a map[string][]string) to process on the event list. Available filters:
&lt;ul&gt;
&lt;li&gt;event=&amp;lt;string&amp;gt; &amp;ndash; event to filter&lt;/li&gt;
&lt;li&gt;image=&amp;lt;string&amp;gt; &amp;ndash; image to filter&lt;/li&gt;
&lt;li&gt;container=&amp;lt;string&amp;gt; &amp;ndash; container to filter&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;get-a-tarball-containing-all-images-in-a-repository&#34;&gt;Get a tarball containing all images in a repository&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /images/(name)/get&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Get a tarball containing all images and metadata for the repository specified
by &lt;code&gt;name&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;If &lt;code&gt;name&lt;/code&gt; is a specific name and tag (e.g. ubuntu:latest), then only that image
(and its parents) are returned. If &lt;code&gt;name&lt;/code&gt; is an image ID, similarly only that
image (and its parents) are returned, but with the exclusion of the
&amp;lsquo;repositories&amp;rsquo; file in the tarball, as there were no image names referenced.&lt;/p&gt;
&lt;p&gt;See the &lt;a href=&#34;#image-tarball-format&#34;&gt;image tarball format&lt;/a&gt; for more details.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /images/ubuntu/get
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/x-tar
Binary data stream
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;get-a-tarball-containing-all-images&#34;&gt;Get a tarball containing all images.&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /images/get&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Get a tarball containing all images and metadata for one or more repositories.&lt;/p&gt;
&lt;p&gt;For each value of the &lt;code&gt;names&lt;/code&gt; parameter: if it is a specific name and tag (e.g.
ubuntu:latest), then only that image (and its parents) are returned; if it is
an image ID, similarly only that image (and its parents) are returned and there
would be no names referenced in the &amp;lsquo;repositories&amp;rsquo; file for this image ID.&lt;/p&gt;
&lt;p&gt;See the &lt;a href=&#34;#image-tarball-format&#34;&gt;image tarball format&lt;/a&gt; for more details.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /images/get?names=myname%2Fmyapp%3Alatest&amp;amp;names=busybox
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/x-tar
Binary data stream
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;load-a-tarball-with-a-set-of-images-and-tags-into-docker&#34;&gt;Load a tarball with a set of images and tags into docker&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /images/load&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Load a set of images and tags into the docker repository.
See the &lt;a href=&#34;#image-tarball-format&#34;&gt;image tarball format&lt;/a&gt; for more details.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /images/load
Tarball in body
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;image-tarball-format&#34;&gt;Image tarball format&lt;/h3&gt;
&lt;p&gt;An image tarball contains one directory per image layer (named using its long ID),
each containing three files:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;VERSION&lt;/code&gt;: currently &lt;code&gt;1.0&lt;/code&gt; - the file format version&lt;/li&gt;
&lt;li&gt;&lt;code&gt;json&lt;/code&gt;: detailed layer information, similar to &lt;code&gt;docker inspect layer_id&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;layer.tar&lt;/code&gt;: A tarfile containing the filesystem changes in this layer&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The &lt;code&gt;layer.tar&lt;/code&gt; file will contain &lt;code&gt;aufs&lt;/code&gt; style &lt;code&gt;.wh..wh.aufs&lt;/code&gt; files and directories
for storing attribute changes and deletions.&lt;/p&gt;
&lt;p&gt;If the tarball defines a repository, there will also be a &lt;code&gt;repositories&lt;/code&gt; file at
the root that contains a list of repository and tag names mapped to layer IDs.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;{&amp;quot;hello-world&amp;quot;:
{&amp;quot;latest&amp;quot;: &amp;quot;565a9d68a73f6706862bfe8409a7f659776d4d60a8d096eb4a3cbce6999cc2a1&amp;quot;}
}
&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&#34;exec-create&#34;&gt;Exec Create&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /containers/(id)/exec&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Sets up an exec instance in a running container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /containers/e90e34656806/exec HTTP/1.1
Content-Type: application/json
{
&amp;quot;AttachStdin&amp;quot;: false,
&amp;quot;AttachStdout&amp;quot;: true,
&amp;quot;AttachStderr&amp;quot;: true,
&amp;quot;Tty&amp;quot;: false,
&amp;quot;Cmd&amp;quot;: [
&amp;quot;date&amp;quot;
],
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 201 OK
Content-Type: application/json
{
&amp;quot;Id&amp;quot;: &amp;quot;f90e34656806&amp;quot;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Json Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;AttachStdin&lt;/strong&gt; - Boolean value, attaches to stdin of the exec command.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;AttachStdout&lt;/strong&gt; - Boolean value, attaches to stdout of the exec command.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;AttachStderr&lt;/strong&gt; - Boolean value, attaches to stderr of the exec command.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Tty&lt;/strong&gt; - Boolean value to allocate a pseudo-TTY&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Cmd&lt;/strong&gt; - Command to run specified as a string or an array of strings.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;201&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;exec-start&#34;&gt;Exec Start&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /exec/(id)/start&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Starts a previously set up exec instance &lt;code&gt;id&lt;/code&gt;. If &lt;code&gt;detach&lt;/code&gt; is true, this API
returns after starting the &lt;code&gt;exec&lt;/code&gt; command. Otherwise, this API sets up an
interactive session with the &lt;code&gt;exec&lt;/code&gt; command.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /exec/e90e34656806/start HTTP/1.1
Content-Type: application/json
{
&amp;quot;Detach&amp;quot;: false,
&amp;quot;Tty&amp;quot;: false,
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 201 OK
Content-Type: application/json
{{ STREAM }}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Json Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Detach&lt;/strong&gt; - Detach from the exec command&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Tty&lt;/strong&gt; - Boolean value to allocate a pseudo-TTY&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;201&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;404&lt;/strong&gt; no such exec instance&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Stream details&lt;/strong&gt;:
Similar to the stream behavior of &lt;code&gt;POST /container/(id)/attach&lt;/code&gt; API&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;exec-resize&#34;&gt;Exec Resize&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /exec/(id)/resize&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Resizes the tty session used by the exec command &lt;code&gt;id&lt;/code&gt;.
This API is valid only if &lt;code&gt;tty&lt;/code&gt; was specified as part of creating and starting the exec command.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /exec/e90e34656806/resize HTTP/1.1
Content-Type: text/plain
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 201 OK
Content-Type: text/plain
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;h&lt;/strong&gt; height of tty session&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;w&lt;/strong&gt; width&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;201&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such exec instance&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;exec-inspect&#34;&gt;Exec Inspect&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /exec/(id)/json&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Return low-level information about the exec command &lt;code&gt;id&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /exec/11fb006128e8ceb3942e7c58d77750f24210e35f879dd204ac975c184b820b39/json HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: plain/text
{
&amp;quot;ID&amp;quot; : &amp;quot;11fb006128e8ceb3942e7c58d77750f24210e35f879dd204ac975c184b820b39&amp;quot;,
&amp;quot;Running&amp;quot; : false,
&amp;quot;ExitCode&amp;quot; : 2,
&amp;quot;ProcessConfig&amp;quot; : {
&amp;quot;privileged&amp;quot; : false,
&amp;quot;user&amp;quot; : &amp;quot;&amp;quot;,
&amp;quot;tty&amp;quot; : false,
&amp;quot;entrypoint&amp;quot; : &amp;quot;sh&amp;quot;,
&amp;quot;arguments&amp;quot; : [
&amp;quot;-c&amp;quot;,
&amp;quot;exit 2&amp;quot;
]
},
&amp;quot;OpenStdin&amp;quot; : false,
&amp;quot;OpenStderr&amp;quot; : false,
&amp;quot;OpenStdout&amp;quot; : false,
&amp;quot;Container&amp;quot; : {
&amp;quot;State&amp;quot; : {
&amp;quot;Running&amp;quot; : true,
&amp;quot;Paused&amp;quot; : false,
&amp;quot;Restarting&amp;quot; : false,
&amp;quot;OOMKilled&amp;quot; : false,
&amp;quot;Pid&amp;quot; : 3650,
&amp;quot;ExitCode&amp;quot; : 0,
&amp;quot;Error&amp;quot; : &amp;quot;&amp;quot;,
&amp;quot;StartedAt&amp;quot; : &amp;quot;2014-11-17T22:26:03.717657531Z&amp;quot;,
&amp;quot;FinishedAt&amp;quot; : &amp;quot;0001-01-01T00:00:00Z&amp;quot;
},
&amp;quot;ID&amp;quot; : &amp;quot;8f177a186b977fb451136e0fdf182abff5599a08b3c7f6ef0d36a55aaf89634c&amp;quot;,
&amp;quot;Created&amp;quot; : &amp;quot;2014-11-17T22:26:03.626304998Z&amp;quot;,
&amp;quot;Path&amp;quot; : &amp;quot;date&amp;quot;,
&amp;quot;Args&amp;quot; : [],
&amp;quot;Config&amp;quot; : {
&amp;quot;Hostname&amp;quot; : &amp;quot;8f177a186b97&amp;quot;,
&amp;quot;Domainname&amp;quot; : &amp;quot;&amp;quot;,
&amp;quot;User&amp;quot; : &amp;quot;&amp;quot;,
&amp;quot;Memory&amp;quot; : 0,
&amp;quot;MemorySwap&amp;quot; : 0,
&amp;quot;CpuShares&amp;quot; : 0,
&amp;quot;Cpuset&amp;quot; : &amp;quot;&amp;quot;,
&amp;quot;AttachStdin&amp;quot; : false,
&amp;quot;AttachStdout&amp;quot; : false,
&amp;quot;AttachStderr&amp;quot; : false,
&amp;quot;PortSpecs&amp;quot; : null,
&amp;quot;ExposedPorts&amp;quot; : null,
&amp;quot;Tty&amp;quot; : false,
&amp;quot;OpenStdin&amp;quot; : false,
&amp;quot;StdinOnce&amp;quot; : false,
&amp;quot;Env&amp;quot; : [ &amp;quot;PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin&amp;quot; ],
&amp;quot;Cmd&amp;quot; : [
&amp;quot;date&amp;quot;
],
&amp;quot;Image&amp;quot; : &amp;quot;ubuntu&amp;quot;,
&amp;quot;Volumes&amp;quot; : null,
&amp;quot;WorkingDir&amp;quot; : &amp;quot;&amp;quot;,
&amp;quot;Entrypoint&amp;quot; : null,
&amp;quot;NetworkDisabled&amp;quot; : false,
&amp;quot;MacAddress&amp;quot; : &amp;quot;&amp;quot;,
&amp;quot;OnBuild&amp;quot; : null,
&amp;quot;SecurityOpt&amp;quot; : null
},
&amp;quot;Image&amp;quot; : &amp;quot;5506de2b643be1e6febbf3b8a240760c6843244c41e12aa2f60ccbb7153d17f5&amp;quot;,
&amp;quot;NetworkSettings&amp;quot; : {
&amp;quot;IPAddress&amp;quot; : &amp;quot;172.17.0.2&amp;quot;,
&amp;quot;IPPrefixLen&amp;quot; : 16,
&amp;quot;MacAddress&amp;quot; : &amp;quot;02:42:ac:11:00:02&amp;quot;,
&amp;quot;Gateway&amp;quot; : &amp;quot;172.17.42.1&amp;quot;,
&amp;quot;Bridge&amp;quot; : &amp;quot;docker0&amp;quot;,
&amp;quot;PortMapping&amp;quot; : null,
&amp;quot;Ports&amp;quot; : {}
},
&amp;quot;ResolvConfPath&amp;quot; : &amp;quot;/var/lib/docker/containers/8f177a186b977fb451136e0fdf182abff5599a08b3c7f6ef0d36a55aaf89634c/resolv.conf&amp;quot;,
&amp;quot;HostnamePath&amp;quot; : &amp;quot;/var/lib/docker/containers/8f177a186b977fb451136e0fdf182abff5599a08b3c7f6ef0d36a55aaf89634c/hostname&amp;quot;,
&amp;quot;HostsPath&amp;quot; : &amp;quot;/var/lib/docker/containers/8f177a186b977fb451136e0fdf182abff5599a08b3c7f6ef0d36a55aaf89634c/hosts&amp;quot;,
&amp;quot;Name&amp;quot; : &amp;quot;/test&amp;quot;,
&amp;quot;Driver&amp;quot; : &amp;quot;aufs&amp;quot;,
&amp;quot;ExecDriver&amp;quot; : &amp;quot;native-0.2&amp;quot;,
&amp;quot;MountLabel&amp;quot; : &amp;quot;&amp;quot;,
&amp;quot;ProcessLabel&amp;quot; : &amp;quot;&amp;quot;,
&amp;quot;AppArmorProfile&amp;quot; : &amp;quot;&amp;quot;,
&amp;quot;RestartCount&amp;quot; : 0,
&amp;quot;Volumes&amp;quot; : {},
&amp;quot;VolumesRW&amp;quot; : {}
}
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such exec instance&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; - server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h1 id=&#34;3-going-further&#34;&gt;3. Going further&lt;/h1&gt;
&lt;h2 id=&#34;3-1-inside-docker-run&#34;&gt;3.1 Inside &lt;code&gt;docker run&lt;/code&gt;&lt;/h2&gt;
&lt;p&gt;As an example, the &lt;code&gt;docker run&lt;/code&gt; command line makes the following API calls:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Create the container&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If the status code is 404, it means the image doesn&amp;rsquo;t exist:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Try to pull it&lt;/li&gt;
&lt;li&gt;Then retry to create the container&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Start the container&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If you are not in detached mode:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Attach to the container, using logs=1 (to have stdout and
stderr from the container&amp;rsquo;s start) and stream=1&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If in detached mode or only stdin is attached:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Display the container&amp;rsquo;s id&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;3-2-hijacking&#34;&gt;3.2 Hijacking&lt;/h2&gt;
&lt;p&gt;In this version of the API, /attach, uses hijacking to transport stdin,
stdout and stderr on the same socket.&lt;/p&gt;
&lt;p&gt;To hint potential proxies about connection hijacking, Docker client sends
connection upgrade headers similarly to websocket.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Upgrade: tcp
Connection: Upgrade
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;When Docker daemon detects the &lt;code&gt;Upgrade&lt;/code&gt; header, it will switch its status code
from &lt;strong&gt;200 OK&lt;/strong&gt; to &lt;strong&gt;101 UPGRADED&lt;/strong&gt; and resend the same headers.&lt;/p&gt;
&lt;p&gt;This might change in the future.&lt;/p&gt;
&lt;h2 id=&#34;3-3-cors-requests&#34;&gt;3.3 CORS Requests&lt;/h2&gt;
&lt;p&gt;To set cross origin requests to the remote api, please add flag &amp;ldquo;&amp;ndash;api-enable-cors&amp;rdquo;
when running docker in daemon mode.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ docker -d -H=&amp;quot;192.168.1.9:2375&amp;quot; --api-enable-cors
&lt;/code&gt;&lt;/pre&gt;
</description>
</item>
<item>
<title>Remote API v1.18</title>
<link>http://localhost/reference/api/docker_remote_api_v1.18/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>http://localhost/reference/api/docker_remote_api_v1.18/</guid>
<description>
&lt;h1 id=&#34;docker-remote-api-v1-18&#34;&gt;Docker Remote API v1.18&lt;/h1&gt;
&lt;h2 id=&#34;1-brief-introduction&#34;&gt;1. Brief introduction&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;The Remote API has replaced &lt;code&gt;rcli&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The daemon listens on &lt;code&gt;unix:///var/run/docker.sock&lt;/code&gt; but you can
&lt;a href=&#34;http://localhost/articles/basics/#bind-docker-to-another-hostport-or-a-unix-socket&#34;&gt;Bind Docker to another host/port or a Unix socket&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;The API tends to be REST, but for some complex commands, like &lt;code&gt;attach&lt;/code&gt;
or &lt;code&gt;pull&lt;/code&gt;, the HTTP connection is hijacked to transport &lt;code&gt;STDOUT&lt;/code&gt;,
&lt;code&gt;STDIN&lt;/code&gt; and &lt;code&gt;STDERR&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;h1 id=&#34;2-endpoints&#34;&gt;2. Endpoints&lt;/h1&gt;
&lt;h2 id=&#34;2-1-containers&#34;&gt;2.1 Containers&lt;/h2&gt;
&lt;h3 id=&#34;list-containers&#34;&gt;List containers&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /containers/json&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;List containers&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /containers/json?all=1&amp;amp;before=8dfafdbc3a40&amp;amp;size=1 HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
[
{
&amp;quot;Id&amp;quot;: &amp;quot;8dfafdbc3a40&amp;quot;,
&amp;quot;Image&amp;quot;: &amp;quot;ubuntu:latest&amp;quot;,
&amp;quot;Command&amp;quot;: &amp;quot;echo 1&amp;quot;,
&amp;quot;Created&amp;quot;: 1367854155,
&amp;quot;Status&amp;quot;: &amp;quot;Exit 0&amp;quot;,
&amp;quot;Ports&amp;quot;: [{&amp;quot;PrivatePort&amp;quot;: 2222, &amp;quot;PublicPort&amp;quot;: 3333, &amp;quot;Type&amp;quot;: &amp;quot;tcp&amp;quot;}],
&amp;quot;SizeRw&amp;quot;: 12288,
&amp;quot;SizeRootFs&amp;quot;: 0
},
{
&amp;quot;Id&amp;quot;: &amp;quot;9cd87474be90&amp;quot;,
&amp;quot;Image&amp;quot;: &amp;quot;ubuntu:latest&amp;quot;,
&amp;quot;Command&amp;quot;: &amp;quot;echo 222222&amp;quot;,
&amp;quot;Created&amp;quot;: 1367854155,
&amp;quot;Status&amp;quot;: &amp;quot;Exit 0&amp;quot;,
&amp;quot;Ports&amp;quot;: [],
&amp;quot;SizeRw&amp;quot;: 12288,
&amp;quot;SizeRootFs&amp;quot;: 0
},
{
&amp;quot;Id&amp;quot;: &amp;quot;3176a2479c92&amp;quot;,
&amp;quot;Image&amp;quot;: &amp;quot;ubuntu:latest&amp;quot;,
&amp;quot;Command&amp;quot;: &amp;quot;echo 3333333333333333&amp;quot;,
&amp;quot;Created&amp;quot;: 1367854154,
&amp;quot;Status&amp;quot;: &amp;quot;Exit 0&amp;quot;,
&amp;quot;Ports&amp;quot;:[],
&amp;quot;SizeRw&amp;quot;:12288,
&amp;quot;SizeRootFs&amp;quot;:0
},
{
&amp;quot;Id&amp;quot;: &amp;quot;4cb07b47f9fb&amp;quot;,
&amp;quot;Image&amp;quot;: &amp;quot;ubuntu:latest&amp;quot;,
&amp;quot;Command&amp;quot;: &amp;quot;echo 444444444444444444444444444444444&amp;quot;,
&amp;quot;Created&amp;quot;: 1367854152,
&amp;quot;Status&amp;quot;: &amp;quot;Exit 0&amp;quot;,
&amp;quot;Ports&amp;quot;: [],
&amp;quot;SizeRw&amp;quot;: 12288,
&amp;quot;SizeRootFs&amp;quot;: 0
}
]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;all&lt;/strong&gt; 1/True/true or 0/False/false, Show all containers.
Only running containers are shown by default (i.e., this defaults to false)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;limit&lt;/strong&gt; Show &lt;code&gt;limit&lt;/code&gt; last created
containers, include non-running ones.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;since&lt;/strong&gt; Show only containers created since Id, include
non-running ones.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;before&lt;/strong&gt; Show only containers created before Id, include
non-running ones.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;size&lt;/strong&gt; 1/True/true or 0/False/false, Show the containers
sizes&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;filters&lt;/strong&gt; - a json encoded value of the filters (a map[string][]string) to process on the containers list. Available filters:
&lt;ul&gt;
&lt;li&gt;exited=&amp;lt;int&amp;gt; &amp;ndash; containers with exit code of &amp;lt;int&amp;gt;&lt;/li&gt;
&lt;li&gt;status=(restarting|running|paused|exited)&lt;/li&gt;
&lt;li&gt;label=&lt;code&gt;key&lt;/code&gt; or &lt;code&gt;key=value&lt;/code&gt; of a container label&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;400&lt;/strong&gt; bad parameter&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;create-a-container&#34;&gt;Create a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /containers/create&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Create a container&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /containers/create HTTP/1.1
Content-Type: application/json
{
&amp;quot;Hostname&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;Domainname&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;User&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;AttachStdin&amp;quot;: false,
&amp;quot;AttachStdout&amp;quot;: true,
&amp;quot;AttachStderr&amp;quot;: true,
&amp;quot;Tty&amp;quot;: false,
&amp;quot;OpenStdin&amp;quot;: false,
&amp;quot;StdinOnce&amp;quot;: false,
&amp;quot;Env&amp;quot;: null,
&amp;quot;Cmd&amp;quot;: [
&amp;quot;date&amp;quot;
],
&amp;quot;Entrypoint&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;Image&amp;quot;: &amp;quot;ubuntu&amp;quot;,
&amp;quot;Labels&amp;quot;: {
&amp;quot;com.example.vendor&amp;quot;: &amp;quot;Acme&amp;quot;,
&amp;quot;com.example.license&amp;quot;: &amp;quot;GPL&amp;quot;,
&amp;quot;com.example.version&amp;quot;: &amp;quot;1.0&amp;quot;
},
&amp;quot;Volumes&amp;quot;: {
&amp;quot;/tmp&amp;quot;: {}
},
&amp;quot;WorkingDir&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;NetworkDisabled&amp;quot;: false,
&amp;quot;MacAddress&amp;quot;: &amp;quot;12:34:56:78:9a:bc&amp;quot;,
&amp;quot;ExposedPorts&amp;quot;: {
&amp;quot;22/tcp&amp;quot;: {}
},
&amp;quot;HostConfig&amp;quot;: {
&amp;quot;Binds&amp;quot;: [&amp;quot;/tmp:/tmp&amp;quot;],
&amp;quot;Links&amp;quot;: [&amp;quot;redis3:redis&amp;quot;],
&amp;quot;LxcConf&amp;quot;: {&amp;quot;lxc.utsname&amp;quot;:&amp;quot;docker&amp;quot;},
&amp;quot;Memory&amp;quot;: 0,
&amp;quot;MemorySwap&amp;quot;: 0,
&amp;quot;CpuShares&amp;quot;: 512,
&amp;quot;CpusetCpus&amp;quot;: &amp;quot;0,1&amp;quot;,
&amp;quot;PortBindings&amp;quot;: { &amp;quot;22/tcp&amp;quot;: [{ &amp;quot;HostPort&amp;quot;: &amp;quot;11022&amp;quot; }] },
&amp;quot;PublishAllPorts&amp;quot;: false,
&amp;quot;Privileged&amp;quot;: false,
&amp;quot;ReadonlyRootfs&amp;quot;: false,
&amp;quot;Dns&amp;quot;: [&amp;quot;8.8.8.8&amp;quot;],
&amp;quot;DnsSearch&amp;quot;: [&amp;quot;&amp;quot;],
&amp;quot;ExtraHosts&amp;quot;: null,
&amp;quot;VolumesFrom&amp;quot;: [&amp;quot;parent&amp;quot;, &amp;quot;other:ro&amp;quot;],
&amp;quot;CapAdd&amp;quot;: [&amp;quot;NET_ADMIN&amp;quot;],
&amp;quot;CapDrop&amp;quot;: [&amp;quot;MKNOD&amp;quot;],
&amp;quot;RestartPolicy&amp;quot;: { &amp;quot;Name&amp;quot;: &amp;quot;&amp;quot;, &amp;quot;MaximumRetryCount&amp;quot;: 0 },
&amp;quot;NetworkMode&amp;quot;: &amp;quot;bridge&amp;quot;,
&amp;quot;Devices&amp;quot;: [],
&amp;quot;Ulimits&amp;quot;: [{}],
&amp;quot;LogConfig&amp;quot;: { &amp;quot;Type&amp;quot;: &amp;quot;json-file&amp;quot;, Config: {} },
&amp;quot;SecurityOpt&amp;quot;: [&amp;quot;&amp;quot;],
&amp;quot;CgroupParent&amp;quot;: &amp;quot;&amp;quot;
}
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 201 Created
Content-Type: application/json
{
&amp;quot;Id&amp;quot;:&amp;quot;e90e34656806&amp;quot;
&amp;quot;Warnings&amp;quot;:[]
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Json Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Hostname&lt;/strong&gt; - A string value containing the desired hostname to use for the
container.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Domainname&lt;/strong&gt; - A string value containing the desired domain name to use
for the container.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;User&lt;/strong&gt; - A string value containing the user to use inside the container.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Memory&lt;/strong&gt; - Memory limit in bytes.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;MemorySwap&lt;/strong&gt;- Total memory limit (memory + swap); set &lt;code&gt;-1&lt;/code&gt; to disable swap,
always use this with &lt;code&gt;memory&lt;/code&gt;, and make the value larger than &lt;code&gt;memory&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;CpuShares&lt;/strong&gt; - An integer value containing the CPU Shares for container
(ie. the relative weight vs other containers).&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Cpuset&lt;/strong&gt; - The same as CpusetCpus, but deprecated, please don&amp;rsquo;t use.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;CpusetCpus&lt;/strong&gt; - String value containing the cgroups CpusetCpus to use.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;AttachStdin&lt;/strong&gt; - Boolean value, attaches to stdin.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;AttachStdout&lt;/strong&gt; - Boolean value, attaches to stdout.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;AttachStderr&lt;/strong&gt; - Boolean value, attaches to stderr.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Tty&lt;/strong&gt; - Boolean value, Attach standard streams to a tty, including stdin if it is not closed.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;OpenStdin&lt;/strong&gt; - Boolean value, opens stdin,&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;StdinOnce&lt;/strong&gt; - Boolean value, close stdin after the 1 attached client disconnects.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Env&lt;/strong&gt; - A list of environment variables in the form of &lt;code&gt;VAR=value&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Labels&lt;/strong&gt; - Adds a map of labels that to a container. To specify a map: &lt;code&gt;{&amp;quot;key&amp;quot;:&amp;quot;value&amp;quot;[,&amp;quot;key2&amp;quot;:&amp;quot;value2&amp;quot;]}&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Cmd&lt;/strong&gt; - Command to run specified as a string or an array of strings.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Entrypoint&lt;/strong&gt; - Set the entrypoint for the container a a string or an array
of strings&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Image&lt;/strong&gt; - String value containing the image name to use for the container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Volumes&lt;/strong&gt; An object mapping mountpoint paths (strings) inside the
container to empty objects.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;WorkingDir&lt;/strong&gt; - A string value containing the working dir for commands to
run in.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;NetworkDisabled&lt;/strong&gt; - Boolean value, when true disables networking for the
container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;ExposedPorts&lt;/strong&gt; - An object mapping ports to an empty object in the form of:
&lt;code&gt;&amp;quot;ExposedPorts&amp;quot;: { &amp;quot;&amp;lt;port&amp;gt;/&amp;lt;tcp|udp&amp;gt;: {}&amp;quot; }&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;HostConfig&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Binds&lt;/strong&gt; A list of volume bindings for this container. Each volume
binding is a string of the form &lt;code&gt;container_path&lt;/code&gt; (to create a new
volume for the container), &lt;code&gt;host_path:container_path&lt;/code&gt; (to bind-mount
a host path into the container), or &lt;code&gt;host_path:container_path:ro&lt;/code&gt;
(to make the bind-mount read-only inside the container).&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Links&lt;/strong&gt; - A list of links for the container. Each link entry should be
in the form of &lt;code&gt;container_name:alias&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;LxcConf&lt;/strong&gt; - LXC specific configurations. These configurations will only
work when using the &lt;code&gt;lxc&lt;/code&gt; execution driver.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;PortBindings&lt;/strong&gt; - A map of exposed container ports and the host port they
should map to. It should be specified in the form
&lt;code&gt;{ &amp;lt;port&amp;gt;/&amp;lt;protocol&amp;gt;: [{ &amp;quot;HostPort&amp;quot;: &amp;quot;&amp;lt;port&amp;gt;&amp;quot; }] }&lt;/code&gt;
Take note that &lt;code&gt;port&lt;/code&gt; is specified as a string and not an integer value.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;PublishAllPorts&lt;/strong&gt; - Allocates a random host port for all of a container&amp;rsquo;s
exposed ports. Specified as a boolean value.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Privileged&lt;/strong&gt; - Gives the container full access to the host. Specified as
a boolean value.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;ReadonlyRootfs&lt;/strong&gt; - Mount the container&amp;rsquo;s root filesystem as read only.
Specified as a boolean value.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Dns&lt;/strong&gt; - A list of dns servers for the container to use.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;DnsSearch&lt;/strong&gt; - A list of DNS search domains&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;ExtraHosts&lt;/strong&gt; - A list of hostnames/IP mappings to be added to the
container&amp;rsquo;s &lt;code&gt;/etc/hosts&lt;/code&gt; file. Specified in the form &lt;code&gt;[&amp;quot;hostname:IP&amp;quot;]&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;VolumesFrom&lt;/strong&gt; - A list of volumes to inherit from another container.
Specified in the form &lt;code&gt;&amp;lt;container name&amp;gt;[:&amp;lt;ro|rw&amp;gt;]&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;CapAdd&lt;/strong&gt; - A list of kernel capabilities to add to the container.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Capdrop&lt;/strong&gt; - A list of kernel capabilities to drop from the container.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;RestartPolicy&lt;/strong&gt; The behavior to apply when the container exits. The
value is an object with a &lt;code&gt;Name&lt;/code&gt; property of either &lt;code&gt;&amp;quot;always&amp;quot;&lt;/code&gt; to
always restart or &lt;code&gt;&amp;quot;on-failure&amp;quot;&lt;/code&gt; to restart only when the container
exit code is non-zero. If &lt;code&gt;on-failure&lt;/code&gt; is used, &lt;code&gt;MaximumRetryCount&lt;/code&gt;
controls the number of times to retry before giving up.
The default is not to restart. (optional)
An ever increasing delay (double the previous delay, starting at 100mS)
is added before each restart to prevent flooding the server.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;NetworkMode&lt;/strong&gt; - Sets the networking mode for the container. Supported
values are: &lt;code&gt;bridge&lt;/code&gt;, &lt;code&gt;host&lt;/code&gt;, and &lt;code&gt;container:&amp;lt;name|id&amp;gt;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Devices&lt;/strong&gt; - A list of devices to add to the container specified in the
form
&lt;code&gt;{ &amp;quot;PathOnHost&amp;quot;: &amp;quot;/dev/deviceName&amp;quot;, &amp;quot;PathInContainer&amp;quot;: &amp;quot;/dev/deviceName&amp;quot;, &amp;quot;CgroupPermissions&amp;quot;: &amp;quot;mrw&amp;quot;}&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Ulimits&lt;/strong&gt; - A list of ulimits to be set in the container, specified as
&lt;code&gt;{ &amp;quot;Name&amp;quot;: &amp;lt;name&amp;gt;, &amp;quot;Soft&amp;quot;: &amp;lt;soft limit&amp;gt;, &amp;quot;Hard&amp;quot;: &amp;lt;hard limit&amp;gt; }&lt;/code&gt;, for example:
&lt;code&gt;Ulimits: { &amp;quot;Name&amp;quot;: &amp;quot;nofile&amp;quot;, &amp;quot;Soft&amp;quot;: 1024, &amp;quot;Hard&amp;quot;, 2048 }}&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;SecurityOpt&lt;/strong&gt;: A list of string values to customize labels for MLS
systems, such as SELinux.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;LogConfig&lt;/strong&gt; - Log configuration for the container, specified as
&lt;code&gt;{ &amp;quot;Type&amp;quot;: &amp;quot;&amp;lt;driver_name&amp;gt;&amp;quot;, &amp;quot;Config&amp;quot;: {&amp;quot;key1&amp;quot;: &amp;quot;val1&amp;quot;}}&lt;/code&gt;.
Available types: &lt;code&gt;json-file&lt;/code&gt;, &lt;code&gt;syslog&lt;/code&gt;, &lt;code&gt;none&lt;/code&gt;.
&lt;code&gt;json-file&lt;/code&gt; logging driver.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;CgroupParent&lt;/strong&gt; - Path to cgroups under which the cgroup for the container will be created. If the path is not absolute, the path is considered to be relative to the cgroups path of the init process. Cgroups will be created if they do not already exist.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;name&lt;/strong&gt; Assign the specified name to the container. Must
match &lt;code&gt;/?[a-zA-Z0-9_-]+&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;201&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;406&lt;/strong&gt; impossible to attach (container not running)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;inspect-a-container&#34;&gt;Inspect a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /containers/(id)/json&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Return low-level information on the container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /containers/4fa6e0f0c678/json HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
{
&amp;quot;AppArmorProfile&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;Args&amp;quot;: [
&amp;quot;-c&amp;quot;,
&amp;quot;exit 9&amp;quot;
],
&amp;quot;Config&amp;quot;: {
&amp;quot;AttachStderr&amp;quot;: true,
&amp;quot;AttachStdin&amp;quot;: false,
&amp;quot;AttachStdout&amp;quot;: true,
&amp;quot;Cmd&amp;quot;: [
&amp;quot;/bin/sh&amp;quot;,
&amp;quot;-c&amp;quot;,
&amp;quot;exit 9&amp;quot;
],
&amp;quot;Domainname&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;Entrypoint&amp;quot;: null,
&amp;quot;Env&amp;quot;: [
&amp;quot;PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin&amp;quot;
],
&amp;quot;ExposedPorts&amp;quot;: null,
&amp;quot;Hostname&amp;quot;: &amp;quot;ba033ac44011&amp;quot;,
&amp;quot;Image&amp;quot;: &amp;quot;ubuntu&amp;quot;,
&amp;quot;Labels&amp;quot;: {
&amp;quot;com.example.vendor&amp;quot;: &amp;quot;Acme&amp;quot;,
&amp;quot;com.example.license&amp;quot;: &amp;quot;GPL&amp;quot;,
&amp;quot;com.example.version&amp;quot;: &amp;quot;1.0&amp;quot;
},
&amp;quot;MacAddress&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;NetworkDisabled&amp;quot;: false,
&amp;quot;OnBuild&amp;quot;: null,
&amp;quot;OpenStdin&amp;quot;: false,
&amp;quot;PortSpecs&amp;quot;: null,
&amp;quot;StdinOnce&amp;quot;: false,
&amp;quot;Tty&amp;quot;: false,
&amp;quot;User&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;Volumes&amp;quot;: null,
&amp;quot;WorkingDir&amp;quot;: &amp;quot;&amp;quot;
},
&amp;quot;Created&amp;quot;: &amp;quot;2015-01-06T15:47:31.485331387Z&amp;quot;,
&amp;quot;Driver&amp;quot;: &amp;quot;devicemapper&amp;quot;,
&amp;quot;ExecDriver&amp;quot;: &amp;quot;native-0.2&amp;quot;,
&amp;quot;ExecIDs&amp;quot;: null,
&amp;quot;HostConfig&amp;quot;: {
&amp;quot;Binds&amp;quot;: null,
&amp;quot;CapAdd&amp;quot;: null,
&amp;quot;CapDrop&amp;quot;: null,
&amp;quot;ContainerIDFile&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;CpusetCpus&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;CpuShares&amp;quot;: 0,
&amp;quot;Devices&amp;quot;: [],
&amp;quot;Dns&amp;quot;: null,
&amp;quot;DnsSearch&amp;quot;: null,
&amp;quot;ExtraHosts&amp;quot;: null,
&amp;quot;IpcMode&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;Links&amp;quot;: null,
&amp;quot;LxcConf&amp;quot;: [],
&amp;quot;Memory&amp;quot;: 0,
&amp;quot;MemorySwap&amp;quot;: 0,
&amp;quot;NetworkMode&amp;quot;: &amp;quot;bridge&amp;quot;,
&amp;quot;PortBindings&amp;quot;: {},
&amp;quot;Privileged&amp;quot;: false,
&amp;quot;ReadonlyRootfs&amp;quot;: false,
&amp;quot;PublishAllPorts&amp;quot;: false,
&amp;quot;RestartPolicy&amp;quot;: {
&amp;quot;MaximumRetryCount&amp;quot;: 2,
&amp;quot;Name&amp;quot;: &amp;quot;on-failure&amp;quot;
},
&amp;quot;LogConfig&amp;quot;: {
&amp;quot;Config&amp;quot;: null,
&amp;quot;Type&amp;quot;: &amp;quot;json-file&amp;quot;
},
&amp;quot;SecurityOpt&amp;quot;: null,
&amp;quot;VolumesFrom&amp;quot;: null,
&amp;quot;Ulimits&amp;quot;: [{}]
},
&amp;quot;HostnamePath&amp;quot;: &amp;quot;/var/lib/docker/containers/ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39/hostname&amp;quot;,
&amp;quot;HostsPath&amp;quot;: &amp;quot;/var/lib/docker/containers/ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39/hosts&amp;quot;,
&amp;quot;LogPath&amp;quot;: &amp;quot;/var/lib/docker/containers/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b-json.log&amp;quot;,
&amp;quot;Id&amp;quot;: &amp;quot;ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39&amp;quot;,
&amp;quot;Image&amp;quot;: &amp;quot;04c5d3b7b0656168630d3ba35d8889bd0e9caafcaeb3004d2bfbc47e7c5d35d2&amp;quot;,
&amp;quot;MountLabel&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;Name&amp;quot;: &amp;quot;/boring_euclid&amp;quot;,
&amp;quot;NetworkSettings&amp;quot;: {
&amp;quot;Bridge&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;Gateway&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;IPAddress&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;IPPrefixLen&amp;quot;: 0,
&amp;quot;MacAddress&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;PortMapping&amp;quot;: null,
&amp;quot;Ports&amp;quot;: null
},
&amp;quot;Path&amp;quot;: &amp;quot;/bin/sh&amp;quot;,
&amp;quot;ProcessLabel&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;ResolvConfPath&amp;quot;: &amp;quot;/var/lib/docker/containers/ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39/resolv.conf&amp;quot;,
&amp;quot;RestartCount&amp;quot;: 1,
&amp;quot;State&amp;quot;: {
&amp;quot;Error&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;ExitCode&amp;quot;: 9,
&amp;quot;FinishedAt&amp;quot;: &amp;quot;2015-01-06T15:47:32.080254511Z&amp;quot;,
&amp;quot;OOMKilled&amp;quot;: false,
&amp;quot;Paused&amp;quot;: false,
&amp;quot;Pid&amp;quot;: 0,
&amp;quot;Restarting&amp;quot;: false,
&amp;quot;Running&amp;quot;: false,
&amp;quot;StartedAt&amp;quot;: &amp;quot;2015-01-06T15:47:32.072697474Z&amp;quot;
},
&amp;quot;Volumes&amp;quot;: {},
&amp;quot;VolumesRW&amp;quot;: {}
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;list-processes-running-inside-a-container&#34;&gt;List processes running inside a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /containers/(id)/top&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;List processes running inside the container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /containers/4fa6e0f0c678/top HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
{
&amp;quot;Titles&amp;quot;: [
&amp;quot;USER&amp;quot;,
&amp;quot;PID&amp;quot;,
&amp;quot;%CPU&amp;quot;,
&amp;quot;%MEM&amp;quot;,
&amp;quot;VSZ&amp;quot;,
&amp;quot;RSS&amp;quot;,
&amp;quot;TTY&amp;quot;,
&amp;quot;STAT&amp;quot;,
&amp;quot;START&amp;quot;,
&amp;quot;TIME&amp;quot;,
&amp;quot;COMMAND&amp;quot;
],
&amp;quot;Processes&amp;quot;: [
[&amp;quot;root&amp;quot;,&amp;quot;20147&amp;quot;,&amp;quot;0.0&amp;quot;,&amp;quot;0.1&amp;quot;,&amp;quot;18060&amp;quot;,&amp;quot;1864&amp;quot;,&amp;quot;pts/4&amp;quot;,&amp;quot;S&amp;quot;,&amp;quot;10:06&amp;quot;,&amp;quot;0:00&amp;quot;,&amp;quot;bash&amp;quot;],
[&amp;quot;root&amp;quot;,&amp;quot;20271&amp;quot;,&amp;quot;0.0&amp;quot;,&amp;quot;0.0&amp;quot;,&amp;quot;4312&amp;quot;,&amp;quot;352&amp;quot;,&amp;quot;pts/4&amp;quot;,&amp;quot;S+&amp;quot;,&amp;quot;10:07&amp;quot;,&amp;quot;0:00&amp;quot;,&amp;quot;sleep&amp;quot;,&amp;quot;10&amp;quot;]
]
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;ps_args&lt;/strong&gt; ps arguments to use (e.g., aux)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;get-container-logs&#34;&gt;Get container logs&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /containers/(id)/logs&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Get stdout and stderr logs from the container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;:
This endpoint works only for containers with &lt;code&gt;json-file&lt;/code&gt; logging driver.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /containers/4fa6e0f0c678/logs?stderr=1&amp;amp;stdout=1&amp;amp;timestamps=1&amp;amp;follow=1&amp;amp;tail=10 HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 101 UPGRADED
Content-Type: application/vnd.docker.raw-stream
Connection: Upgrade
Upgrade: tcp
{{ STREAM }}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;follow&lt;/strong&gt; 1/True/true or 0/False/false, return stream. Default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;stdout&lt;/strong&gt; 1/True/true or 0/False/false, show stdout log. Default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;stderr&lt;/strong&gt; 1/True/true or 0/False/false, show stderr log. Default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;timestamps&lt;/strong&gt; 1/True/true or 0/False/false, print timestamps for
every log line. Default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;tail&lt;/strong&gt; Output specified number of lines at the end of logs: &lt;code&gt;all&lt;/code&gt; or &lt;code&gt;&amp;lt;number&amp;gt;&lt;/code&gt;. Default all&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;101&lt;/strong&gt; no error, hints proxy about hijacking&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error, no upgrade header found&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;inspect-changes-on-a-container-s-filesystem&#34;&gt;Inspect changes on a container&amp;rsquo;s filesystem&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /containers/(id)/changes&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Inspect changes on container &lt;code&gt;id&lt;/code&gt;&amp;rsquo;s filesystem&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /containers/4fa6e0f0c678/changes HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
[
{
&amp;quot;Path&amp;quot;: &amp;quot;/dev&amp;quot;,
&amp;quot;Kind&amp;quot;: 0
},
{
&amp;quot;Path&amp;quot;: &amp;quot;/dev/kmsg&amp;quot;,
&amp;quot;Kind&amp;quot;: 1
},
{
&amp;quot;Path&amp;quot;: &amp;quot;/test&amp;quot;,
&amp;quot;Kind&amp;quot;: 1
}
]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Values for &lt;code&gt;Kind&lt;/code&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;0&lt;/code&gt;: Modify&lt;/li&gt;
&lt;li&gt;&lt;code&gt;1&lt;/code&gt;: Add&lt;/li&gt;
&lt;li&gt;&lt;code&gt;2&lt;/code&gt;: Delete&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;export-a-container&#34;&gt;Export a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /containers/(id)/export&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Export the contents of container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /containers/4fa6e0f0c678/export HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/octet-stream
{{ TAR STREAM }}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;get-container-stats-based-on-resource-usage&#34;&gt;Get container stats based on resource usage&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /containers/(id)/stats&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;This endpoint returns a live stream of a container&amp;rsquo;s resource usage statistics.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: this functionality currently only works when using the &lt;em&gt;libcontainer&lt;/em&gt; exec-driver.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /containers/redis1/stats HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
{
&amp;quot;read&amp;quot; : &amp;quot;2015-01-08T22:57:31.547920715Z&amp;quot;,
&amp;quot;network&amp;quot; : {
&amp;quot;rx_dropped&amp;quot; : 0,
&amp;quot;rx_bytes&amp;quot; : 648,
&amp;quot;rx_errors&amp;quot; : 0,
&amp;quot;tx_packets&amp;quot; : 8,
&amp;quot;tx_dropped&amp;quot; : 0,
&amp;quot;rx_packets&amp;quot; : 8,
&amp;quot;tx_errors&amp;quot; : 0,
&amp;quot;tx_bytes&amp;quot; : 648
},
&amp;quot;memory_stats&amp;quot; : {
&amp;quot;stats&amp;quot; : {
&amp;quot;total_pgmajfault&amp;quot; : 0,
&amp;quot;cache&amp;quot; : 0,
&amp;quot;mapped_file&amp;quot; : 0,
&amp;quot;total_inactive_file&amp;quot; : 0,
&amp;quot;pgpgout&amp;quot; : 414,
&amp;quot;rss&amp;quot; : 6537216,
&amp;quot;total_mapped_file&amp;quot; : 0,
&amp;quot;writeback&amp;quot; : 0,
&amp;quot;unevictable&amp;quot; : 0,
&amp;quot;pgpgin&amp;quot; : 477,
&amp;quot;total_unevictable&amp;quot; : 0,
&amp;quot;pgmajfault&amp;quot; : 0,
&amp;quot;total_rss&amp;quot; : 6537216,
&amp;quot;total_rss_huge&amp;quot; : 6291456,
&amp;quot;total_writeback&amp;quot; : 0,
&amp;quot;total_inactive_anon&amp;quot; : 0,
&amp;quot;rss_huge&amp;quot; : 6291456,
&amp;quot;hierarchical_memory_limit&amp;quot; : 67108864,
&amp;quot;total_pgfault&amp;quot; : 964,
&amp;quot;total_active_file&amp;quot; : 0,
&amp;quot;active_anon&amp;quot; : 6537216,
&amp;quot;total_active_anon&amp;quot; : 6537216,
&amp;quot;total_pgpgout&amp;quot; : 414,
&amp;quot;total_cache&amp;quot; : 0,
&amp;quot;inactive_anon&amp;quot; : 0,
&amp;quot;active_file&amp;quot; : 0,
&amp;quot;pgfault&amp;quot; : 964,
&amp;quot;inactive_file&amp;quot; : 0,
&amp;quot;total_pgpgin&amp;quot; : 477
},
&amp;quot;max_usage&amp;quot; : 6651904,
&amp;quot;usage&amp;quot; : 6537216,
&amp;quot;failcnt&amp;quot; : 0,
&amp;quot;limit&amp;quot; : 67108864
},
&amp;quot;blkio_stats&amp;quot; : {},
&amp;quot;cpu_stats&amp;quot; : {
&amp;quot;cpu_usage&amp;quot; : {
&amp;quot;percpu_usage&amp;quot; : [
16970827,
1839451,
7107380,
10571290
],
&amp;quot;usage_in_usermode&amp;quot; : 10000000,
&amp;quot;total_usage&amp;quot; : 36488948,
&amp;quot;usage_in_kernelmode&amp;quot; : 20000000
},
&amp;quot;system_cpu_usage&amp;quot; : 20091722000000000,
&amp;quot;throttling_data&amp;quot; : {}
}
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;resize-a-container-tty&#34;&gt;Resize a container TTY&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /containers/(id)/resize?h=&amp;lt;height&amp;gt;&amp;amp;w=&amp;lt;width&amp;gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Resize the TTY for container with &lt;code&gt;id&lt;/code&gt;. The container must be restarted for the resize to take effect.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /containers/4fa6e0f0c678/resize?h=40&amp;amp;w=80 HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Length: 0
Content-Type: text/plain; charset=utf-8
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; No such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; Cannot resize container&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;start-a-container&#34;&gt;Start a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /containers/(id)/start&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Start the container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /containers/(id)/start HTTP/1.1
Content-Type: application/json
{
&amp;quot;Binds&amp;quot;: [&amp;quot;/tmp:/tmp&amp;quot;],
&amp;quot;Links&amp;quot;: [&amp;quot;redis3:redis&amp;quot;],
&amp;quot;LxcConf&amp;quot;: {&amp;quot;lxc.utsname&amp;quot;:&amp;quot;docker&amp;quot;},
&amp;quot;Memory&amp;quot;: 0,
&amp;quot;MemorySwap&amp;quot;: 0,
&amp;quot;CpuShares&amp;quot;: 512,
&amp;quot;CpusetCpus&amp;quot;: &amp;quot;0,1&amp;quot;,
&amp;quot;PortBindings&amp;quot;: { &amp;quot;22/tcp&amp;quot;: [{ &amp;quot;HostPort&amp;quot;: &amp;quot;11022&amp;quot; }] },
&amp;quot;PublishAllPorts&amp;quot;: false,
&amp;quot;Privileged&amp;quot;: false,
&amp;quot;ReadonlyRootfs&amp;quot;: false,
&amp;quot;Dns&amp;quot;: [&amp;quot;8.8.8.8&amp;quot;],
&amp;quot;DnsSearch&amp;quot;: [&amp;quot;&amp;quot;],
&amp;quot;ExtraHosts&amp;quot;: null,
&amp;quot;VolumesFrom&amp;quot;: [&amp;quot;parent&amp;quot;, &amp;quot;other:ro&amp;quot;],
&amp;quot;CapAdd&amp;quot;: [&amp;quot;NET_ADMIN&amp;quot;],
&amp;quot;CapDrop&amp;quot;: [&amp;quot;MKNOD&amp;quot;],
&amp;quot;RestartPolicy&amp;quot;: { &amp;quot;Name&amp;quot;: &amp;quot;&amp;quot;, &amp;quot;MaximumRetryCount&amp;quot;: 0 },
&amp;quot;NetworkMode&amp;quot;: &amp;quot;bridge&amp;quot;,
&amp;quot;Devices&amp;quot;: [],
&amp;quot;Ulimits&amp;quot;: [{}],
&amp;quot;LogConfig&amp;quot;: { &amp;quot;Type&amp;quot;: &amp;quot;json-file&amp;quot;, Config: {} },
&amp;quot;SecurityOpt&amp;quot;: [&amp;quot;&amp;quot;],
&amp;quot;CgroupParent&amp;quot;: &amp;quot;&amp;quot;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 204 No Content
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Json Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Binds&lt;/strong&gt; A list of volume bindings for this container. Each volume
binding is a string of the form &lt;code&gt;container_path&lt;/code&gt; (to create a new
volume for the container), &lt;code&gt;host_path:container_path&lt;/code&gt; (to bind-mount
a host path into the container), or &lt;code&gt;host_path:container_path:ro&lt;/code&gt;
(to make the bind-mount read-only inside the container).&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Links&lt;/strong&gt; - A list of links for the container. Each link entry should be of
of the form &lt;code&gt;container_name:alias&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;LxcConf&lt;/strong&gt; - LXC specific configurations. These configurations will only
work when using the &lt;code&gt;lxc&lt;/code&gt; execution driver.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;PortBindings&lt;/strong&gt; - A map of exposed container ports and the host port they
should map to. It should be specified in the form
&lt;code&gt;{ &amp;lt;port&amp;gt;/&amp;lt;protocol&amp;gt;: [{ &amp;quot;HostPort&amp;quot;: &amp;quot;&amp;lt;port&amp;gt;&amp;quot; }] }&lt;/code&gt;
Take note that &lt;code&gt;port&lt;/code&gt; is specified as a string and not an integer value.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;PublishAllPorts&lt;/strong&gt; - Allocates a random host port for all of a container&amp;rsquo;s
exposed ports. Specified as a boolean value.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Privileged&lt;/strong&gt; - Gives the container full access to the host. Specified as
a boolean value.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;ReadonlyRootfs&lt;/strong&gt; - Mount the container&amp;rsquo;s root filesystem as read only.
Specified as a boolean value.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Dns&lt;/strong&gt; - A list of dns servers for the container to use.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;DnsSearch&lt;/strong&gt; - A list of DNS search domains&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;ExtraHosts&lt;/strong&gt; - A list of hostnames/IP mappings to be added to the
container&amp;rsquo;s &lt;code&gt;/etc/hosts&lt;/code&gt; file. Specified in the form &lt;code&gt;[&amp;quot;hostname:IP&amp;quot;]&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;VolumesFrom&lt;/strong&gt; - A list of volumes to inherit from another container.
Specified in the form &lt;code&gt;&amp;lt;container name&amp;gt;[:&amp;lt;ro|rw&amp;gt;]&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;CapAdd&lt;/strong&gt; - A list of kernel capabilities to add to the container.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Capdrop&lt;/strong&gt; - A list of kernel capabilities to drop from the container.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;RestartPolicy&lt;/strong&gt; The behavior to apply when the container exits. The
value is an object with a &lt;code&gt;Name&lt;/code&gt; property of either &lt;code&gt;&amp;quot;always&amp;quot;&lt;/code&gt; to
always restart or &lt;code&gt;&amp;quot;on-failure&amp;quot;&lt;/code&gt; to restart only when the container
exit code is non-zero. If &lt;code&gt;on-failure&lt;/code&gt; is used, &lt;code&gt;MaximumRetryCount&lt;/code&gt;
controls the number of times to retry before giving up.
The default is not to restart. (optional)
An ever increasing delay (double the previous delay, starting at 100mS)
is added before each restart to prevent flooding the server.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;NetworkMode&lt;/strong&gt; - Sets the networking mode for the container. Supported
values are: &lt;code&gt;bridge&lt;/code&gt;, &lt;code&gt;host&lt;/code&gt;, and &lt;code&gt;container:&amp;lt;name|id&amp;gt;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Devices&lt;/strong&gt; - A list of devices to add to the container specified in the
form
&lt;code&gt;{ &amp;quot;PathOnHost&amp;quot;: &amp;quot;/dev/deviceName&amp;quot;, &amp;quot;PathInContainer&amp;quot;: &amp;quot;/dev/deviceName&amp;quot;, &amp;quot;CgroupPermissions&amp;quot;: &amp;quot;mrw&amp;quot;}&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Ulimits&lt;/strong&gt; - A list of ulimits to be set in the container, specified as
&lt;code&gt;{ &amp;quot;Name&amp;quot;: &amp;lt;name&amp;gt;, &amp;quot;Soft&amp;quot;: &amp;lt;soft limit&amp;gt;, &amp;quot;Hard&amp;quot;: &amp;lt;hard limit&amp;gt; }&lt;/code&gt;, for example:
&lt;code&gt;Ulimits: { &amp;quot;Name&amp;quot;: &amp;quot;nofile&amp;quot;, &amp;quot;Soft&amp;quot;: 1024, &amp;quot;Hard&amp;quot;, 2048 }}&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;SecurityOpt&lt;/strong&gt;: A list of string values to customize labels for MLS
systems, such as SELinux.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;LogConfig&lt;/strong&gt; - Log configuration for the container, specified as
&lt;code&gt;{ &amp;quot;Type&amp;quot;: &amp;quot;&amp;lt;driver_name&amp;gt;&amp;quot;, &amp;quot;Config&amp;quot;: {&amp;quot;key1&amp;quot;: &amp;quot;val1&amp;quot;}}&lt;/code&gt;.
Available types: &lt;code&gt;json-file&lt;/code&gt;, &lt;code&gt;syslog&lt;/code&gt;, &lt;code&gt;none&lt;/code&gt;.
&lt;code&gt;json-file&lt;/code&gt; logging driver.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;CgroupParent&lt;/strong&gt; - Path to cgroups under which the cgroup for the container will be created. If the path is not absolute, the path is considered to be relative to the cgroups path of the init process. Cgroups will be created if they do not already exist.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;204&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;304&lt;/strong&gt; container already started&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;stop-a-container&#34;&gt;Stop a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /containers/(id)/stop&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Stop the container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /containers/e90e34656806/stop?t=5 HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 204 No Content
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;t&lt;/strong&gt; number of seconds to wait before killing the container&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;204&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;304&lt;/strong&gt; container already stopped&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;restart-a-container&#34;&gt;Restart a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /containers/(id)/restart&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Restart the container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /containers/e90e34656806/restart?t=5 HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 204 No Content
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;t&lt;/strong&gt; number of seconds to wait before killing the container&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;204&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;kill-a-container&#34;&gt;Kill a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /containers/(id)/kill&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Kill the container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /containers/e90e34656806/kill HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 204 No Content
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;signal&lt;/strong&gt; - Signal to send to the container: integer or string like &amp;ldquo;SIGINT&amp;rdquo;.
When not set, SIGKILL is assumed and the call will waits for the container to exit.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;204&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;rename-a-container&#34;&gt;Rename a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /containers/(id)/rename&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Rename the container &lt;code&gt;id&lt;/code&gt; to a &lt;code&gt;new_name&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /containers/e90e34656806/rename?name=new_name HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 204 No Content
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;name&lt;/strong&gt; new name for the container&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;204&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;409&lt;/strong&gt; - conflict name already assigned&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;pause-a-container&#34;&gt;Pause a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /containers/(id)/pause&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Pause the container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /containers/e90e34656806/pause HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 204 No Content
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;204&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;unpause-a-container&#34;&gt;Unpause a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /containers/(id)/unpause&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Unpause the container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /containers/e90e34656806/unpause HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 204 No Content
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;204&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;attach-to-a-container&#34;&gt;Attach to a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /containers/(id)/attach&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Attach to the container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /containers/16253994b7c4/attach?logs=1&amp;amp;stream=0&amp;amp;stdout=1 HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 101 UPGRADED
Content-Type: application/vnd.docker.raw-stream
Connection: Upgrade
Upgrade: tcp
{{ STREAM }}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;logs&lt;/strong&gt; 1/True/true or 0/False/false, return logs. Default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;stream&lt;/strong&gt; 1/True/true or 0/False/false, return stream.
Default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;stdin&lt;/strong&gt; 1/True/true or 0/False/false, if stream=true, attach
to stdin. Default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;stdout&lt;/strong&gt; 1/True/true or 0/False/false, if logs=true, return
stdout log, if stream=true, attach to stdout. Default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;stderr&lt;/strong&gt; 1/True/true or 0/False/false, if logs=true, return
stderr log, if stream=true, attach to stderr. Default false&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;101&lt;/strong&gt; no error, hints proxy about hijacking&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error, no upgrade header found&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;400&lt;/strong&gt; bad parameter&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Stream details&lt;/strong&gt;:&lt;/p&gt;
&lt;p&gt;When using the TTY setting is enabled in
&lt;a href=&#34;http://localhost/docker/reference/api/docker_remote_api_v1.9/#create-a-container&#34; title=&#34;POST /containers/create&#34;&gt;&lt;code&gt;POST /containers/create&lt;/code&gt;
&lt;/a&gt;,
the stream is the raw data from the process PTY and client&amp;rsquo;s stdin.
When the TTY is disabled, then the stream is multiplexed to separate
stdout and stderr.&lt;/p&gt;
&lt;p&gt;The format is a &lt;strong&gt;Header&lt;/strong&gt; and a &lt;strong&gt;Payload&lt;/strong&gt; (frame).&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;HEADER&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The header will contain the information on which stream write the
stream (stdout or stderr). It also contain the size of the
associated frame encoded on the last 4 bytes (uint32).&lt;/p&gt;
&lt;p&gt;It is encoded on the first 8 bytes like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;header := [8]byte{STREAM_TYPE, 0, 0, 0, SIZE1, SIZE2, SIZE3, SIZE4}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;STREAM_TYPE&lt;/code&gt; can be:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;0: stdin (will be written on stdout)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;1: stdout&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;2: stderr&lt;/p&gt;
&lt;p&gt;&lt;code&gt;SIZE1, SIZE2, SIZE3, SIZE4&lt;/code&gt; are the 4 bytes of
the uint32 size encoded as big endian.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;PAYLOAD&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The payload is the raw stream.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;IMPLEMENTATION&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The simplest way to implement the Attach protocol is the following:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Read 8 bytes&lt;/li&gt;
&lt;li&gt;chose stdout or stderr depending on the first byte&lt;/li&gt;
&lt;li&gt;Extract the frame size from the last 4 bytes&lt;/li&gt;
&lt;li&gt;Read the extracted size and output it on the correct output&lt;/li&gt;
&lt;li&gt;Goto 1&lt;/li&gt;
&lt;/ol&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;attach-to-a-container-websocket&#34;&gt;Attach to a container (websocket)&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /containers/(id)/attach/ws&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Attach to the container &lt;code&gt;id&lt;/code&gt; via websocket&lt;/p&gt;
&lt;p&gt;Implements websocket protocol handshake according to &lt;a href=&#34;http://tools.ietf.org/html/rfc6455&#34;&gt;RFC 6455&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /containers/e90e34656806/attach/ws?logs=0&amp;amp;stream=1&amp;amp;stdin=1&amp;amp;stdout=1&amp;amp;stderr=1 HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; {{ STREAM }}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;logs&lt;/strong&gt; 1/True/true or 0/False/false, return logs. Default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;stream&lt;/strong&gt; 1/True/true or 0/False/false, return stream.
Default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;stdin&lt;/strong&gt; 1/True/true or 0/False/false, if stream=true, attach
to stdin. Default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;stdout&lt;/strong&gt; 1/True/true or 0/False/false, if logs=true, return
stdout log, if stream=true, attach to stdout. Default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;stderr&lt;/strong&gt; 1/True/true or 0/False/false, if logs=true, return
stderr log, if stream=true, attach to stderr. Default false&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;400&lt;/strong&gt; bad parameter&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;wait-a-container&#34;&gt;Wait a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /containers/(id)/wait&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Block until container &lt;code&gt;id&lt;/code&gt; stops, then returns the exit code&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /containers/16253994b7c4/wait HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
{&amp;quot;StatusCode&amp;quot;: 0}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;remove-a-container&#34;&gt;Remove a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;DELETE /containers/(id)&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Remove the container &lt;code&gt;id&lt;/code&gt; from the filesystem&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; DELETE /containers/16253994b7c4?v=1 HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 204 No Content
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;v&lt;/strong&gt; 1/True/true or 0/False/false, Remove the volumes
associated to the container. Default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;force&lt;/strong&gt; - 1/True/true or 0/False/false, Kill then remove the container.
Default false&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;204&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;400&lt;/strong&gt; bad parameter&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;copy-files-or-folders-from-a-container&#34;&gt;Copy files or folders from a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /containers/(id)/copy&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Copy files or folders of container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /containers/4fa6e0f0c678/copy HTTP/1.1
Content-Type: application/json
{
&amp;quot;Resource&amp;quot;: &amp;quot;test.txt&amp;quot;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/x-tar
{{ TAR STREAM }}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;2-2-images&#34;&gt;2.2 Images&lt;/h2&gt;
&lt;h3 id=&#34;list-images&#34;&gt;List Images&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /images/json&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /images/json?all=0 HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
[
{
&amp;quot;RepoTags&amp;quot;: [
&amp;quot;ubuntu:12.04&amp;quot;,
&amp;quot;ubuntu:precise&amp;quot;,
&amp;quot;ubuntu:latest&amp;quot;
],
&amp;quot;Id&amp;quot;: &amp;quot;8dbd9e392a964056420e5d58ca5cc376ef18e2de93b5cc90e868a1bbc8318c1c&amp;quot;,
&amp;quot;Created&amp;quot;: 1365714795,
&amp;quot;Size&amp;quot;: 131506275,
&amp;quot;VirtualSize&amp;quot;: 131506275
},
{
&amp;quot;RepoTags&amp;quot;: [
&amp;quot;ubuntu:12.10&amp;quot;,
&amp;quot;ubuntu:quantal&amp;quot;
],
&amp;quot;ParentId&amp;quot;: &amp;quot;27cf784147099545&amp;quot;,
&amp;quot;Id&amp;quot;: &amp;quot;b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc&amp;quot;,
&amp;quot;Created&amp;quot;: 1364102658,
&amp;quot;Size&amp;quot;: 24653,
&amp;quot;VirtualSize&amp;quot;: 180116135
}
]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example request, with digest information&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /images/json?digests=1 HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response, with digest information&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
[
{
&amp;quot;Created&amp;quot;: 1420064636,
&amp;quot;Id&amp;quot;: &amp;quot;4986bf8c15363d1c5d15512d5266f8777bfba4974ac56e3270e7760f6f0a8125&amp;quot;,
&amp;quot;ParentId&amp;quot;: &amp;quot;ea13149945cb6b1e746bf28032f02e9b5a793523481a0a18645fc77ad53c4ea2&amp;quot;,
&amp;quot;RepoDigests&amp;quot;: [
&amp;quot;localhost:5000/test/busybox@sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf&amp;quot;
],
&amp;quot;RepoTags&amp;quot;: [
&amp;quot;localhost:5000/test/busybox:latest&amp;quot;,
&amp;quot;playdate:latest&amp;quot;
],
&amp;quot;Size&amp;quot;: 0,
&amp;quot;VirtualSize&amp;quot;: 2429728
}
]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The response shows a single image &lt;code&gt;Id&lt;/code&gt; associated with two repositories
(&lt;code&gt;RepoTags&lt;/code&gt;): &lt;code&gt;localhost:5000/test/busybox&lt;/code&gt;: and &lt;code&gt;playdate&lt;/code&gt;. A caller can use
either of the &lt;code&gt;RepoTags&lt;/code&gt; values &lt;code&gt;localhost:5000/test/busybox:latest&lt;/code&gt; or
&lt;code&gt;playdate:latest&lt;/code&gt; to reference the image.&lt;/p&gt;
&lt;p&gt;You can also use &lt;code&gt;RepoDigests&lt;/code&gt; values to reference an image. In this response,
the array has only one reference and that is to the
&lt;code&gt;localhost:5000/test/busybox&lt;/code&gt; repository; the &lt;code&gt;playdate&lt;/code&gt; repository has no
digest. You can reference this digest using the value:
&lt;code&gt;localhost:5000/test/busybox@sha256:cbbf2f9a99b47fc460d...&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;See the &lt;code&gt;docker run&lt;/code&gt; and &lt;code&gt;docker build&lt;/code&gt; commands for examples of digest and tag
references on the command line.&lt;/p&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;all&lt;/strong&gt; 1/True/true or 0/False/false, default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;filters&lt;/strong&gt; a json encoded value of the filters (a map[string][]string) to process on the images list. Available filters:
&lt;ul&gt;
&lt;li&gt;dangling=true&lt;/li&gt;
&lt;li&gt;label=&lt;code&gt;key&lt;/code&gt; or &lt;code&gt;key=value&lt;/code&gt; of an image label&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;build-image-from-a-dockerfile&#34;&gt;Build image from a Dockerfile&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /build&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Build an image from a Dockerfile&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /build HTTP/1.1
{{ TAR STREAM }}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
{&amp;quot;stream&amp;quot;: &amp;quot;Step 1...&amp;quot;}
{&amp;quot;stream&amp;quot;: &amp;quot;...&amp;quot;}
{&amp;quot;error&amp;quot;: &amp;quot;Error...&amp;quot;, &amp;quot;errorDetail&amp;quot;: {&amp;quot;code&amp;quot;: 123, &amp;quot;message&amp;quot;: &amp;quot;Error...&amp;quot;}}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The input stream must be a tar archive compressed with one of the
following algorithms: identity (no compression), gzip, bzip2, xz.&lt;/p&gt;
&lt;p&gt;The archive must include a build instructions file, typically called
&lt;code&gt;Dockerfile&lt;/code&gt; at the root of the archive. The &lt;code&gt;dockerfile&lt;/code&gt; parameter may be
used to specify a different build instructions file by having its value be
the path to the alternate build instructions file to use.&lt;/p&gt;
&lt;p&gt;The archive may include any number of other files,
which will be accessible in the build context (See the &lt;a href=&#34;http://localhost/docker/reference/builder/#dockerbuilder&#34;&gt;&lt;em&gt;ADD build
command&lt;/em&gt;&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;The build will also be canceled if the client drops the connection by quitting
or being killed.&lt;/p&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;dockerfile&lt;/strong&gt; - path within the build context to the Dockerfile. This is
ignored if &lt;code&gt;remote&lt;/code&gt; is specified and points to an individual filename.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;t&lt;/strong&gt; repository name (and optionally a tag) to be applied to
the resulting image in case of success&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;remote&lt;/strong&gt; A Git repository URI or HTTP/HTTPS URI build source. If the
URI specifies a filename, the file&amp;rsquo;s contents are placed into a file
called &lt;code&gt;Dockerfile&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;q&lt;/strong&gt; suppress verbose build output&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;nocache&lt;/strong&gt; do not use the cache when building the image&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;pull&lt;/strong&gt; - attempt to pull the image even if an older image exists locally&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;rm&lt;/strong&gt; - remove intermediate containers after a successful build (default behavior)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;forcerm&lt;/strong&gt; - always remove intermediate containers (includes rm)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;memory&lt;/strong&gt; - set memory limit for build&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;memswap&lt;/strong&gt; - Total memory (memory + swap), &lt;code&gt;-1&lt;/code&gt; to disable swap&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;cpushares&lt;/strong&gt; - CPU shares (relative weight)&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;cpusetcpus&lt;/strong&gt; - CPUs in which to allow execution, e.g., &lt;code&gt;0-3&lt;/code&gt;, &lt;code&gt;0,1&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Request Headers:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Content-type&lt;/strong&gt; should be set to &lt;code&gt;&amp;quot;application/tar&amp;quot;&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;X-Registry-Config&lt;/strong&gt; base64-encoded ConfigFile object&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;create-an-image&#34;&gt;Create an image&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /images/create&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Create an image, either by pulling it from the registry or by importing it&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /images/create?fromImage=ubuntu HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
{&amp;quot;status&amp;quot;: &amp;quot;Pulling...&amp;quot;}
{&amp;quot;status&amp;quot;: &amp;quot;Pulling&amp;quot;, &amp;quot;progress&amp;quot;: &amp;quot;1 B/ 100 B&amp;quot;, &amp;quot;progressDetail&amp;quot;: {&amp;quot;current&amp;quot;: 1, &amp;quot;total&amp;quot;: 100}}
{&amp;quot;error&amp;quot;: &amp;quot;Invalid...&amp;quot;}
...
When using this endpoint to pull an image from the registry, the
`X-Registry-Auth` header can be used to include
a base64-encoded AuthConfig object.
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;fromImage&lt;/strong&gt; name of the image to pull&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;fromSrc&lt;/strong&gt; source to import. The value may be a URL from which the image
can be retrieved or &lt;code&gt;-&lt;/code&gt; to read the image from the request body.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;repo&lt;/strong&gt; repository&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;tag&lt;/strong&gt; tag&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;registry&lt;/strong&gt; the registry to pull from&lt;/p&gt;
&lt;p&gt;Request Headers:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;X-Registry-Auth&lt;/strong&gt; base64-encoded AuthConfig object&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;inspect-an-image&#34;&gt;Inspect an image&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /images/(name)/json&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Return low-level information on the image &lt;code&gt;name&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /images/ubuntu/json HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
{
&amp;quot;Created&amp;quot;: &amp;quot;2013-03-23T22:24:18.818426-07:00&amp;quot;,
&amp;quot;Container&amp;quot;: &amp;quot;3d67245a8d72ecf13f33dffac9f79dcdf70f75acb84d308770391510e0c23ad0&amp;quot;,
&amp;quot;ContainerConfig&amp;quot;:
{
&amp;quot;Hostname&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;User&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;AttachStdin&amp;quot;: false,
&amp;quot;AttachStdout&amp;quot;: false,
&amp;quot;AttachStderr&amp;quot;: false,
&amp;quot;PortSpecs&amp;quot;: null,
&amp;quot;Tty&amp;quot;: true,
&amp;quot;OpenStdin&amp;quot;: true,
&amp;quot;StdinOnce&amp;quot;: false,
&amp;quot;Env&amp;quot;: null,
&amp;quot;Cmd&amp;quot;: [&amp;quot;/bin/bash&amp;quot;],
&amp;quot;Dns&amp;quot;: null,
&amp;quot;Image&amp;quot;: &amp;quot;ubuntu&amp;quot;,
&amp;quot;Labels&amp;quot;: {
&amp;quot;com.example.vendor&amp;quot;: &amp;quot;Acme&amp;quot;,
&amp;quot;com.example.license&amp;quot;: &amp;quot;GPL&amp;quot;,
&amp;quot;com.example.version&amp;quot;: &amp;quot;1.0&amp;quot;
},
&amp;quot;Volumes&amp;quot;: null,
&amp;quot;VolumesFrom&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;WorkingDir&amp;quot;: &amp;quot;&amp;quot;
},
&amp;quot;Id&amp;quot;: &amp;quot;b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc&amp;quot;,
&amp;quot;Parent&amp;quot;: &amp;quot;27cf784147099545&amp;quot;,
&amp;quot;Size&amp;quot;: 6824592
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such image&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;get-the-history-of-an-image&#34;&gt;Get the history of an image&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /images/(name)/history&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Return the history of the image &lt;code&gt;name&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /images/ubuntu/history HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
[
{
&amp;quot;Id&amp;quot;: &amp;quot;b750fe79269d&amp;quot;,
&amp;quot;Created&amp;quot;: 1364102658,
&amp;quot;CreatedBy&amp;quot;: &amp;quot;/bin/bash&amp;quot;
},
{
&amp;quot;Id&amp;quot;: &amp;quot;27cf78414709&amp;quot;,
&amp;quot;Created&amp;quot;: 1364068391,
&amp;quot;CreatedBy&amp;quot;: &amp;quot;&amp;quot;
}
]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such image&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;push-an-image-on-the-registry&#34;&gt;Push an image on the registry&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /images/(name)/push&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Push the image &lt;code&gt;name&lt;/code&gt; on the registry&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /images/test/push HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
{&amp;quot;status&amp;quot;: &amp;quot;Pushing...&amp;quot;}
{&amp;quot;status&amp;quot;: &amp;quot;Pushing&amp;quot;, &amp;quot;progress&amp;quot;: &amp;quot;1/? (n/a)&amp;quot;, &amp;quot;progressDetail&amp;quot;: {&amp;quot;current&amp;quot;: 1}}}
{&amp;quot;error&amp;quot;: &amp;quot;Invalid...&amp;quot;}
...
If you wish to push an image on to a private registry, that image must already have been tagged
into a repository which references that registry host name and port. This repository name should
then be used in the URL. This mirrors the flow of the CLI.
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /images/registry.acme.com:5000/test/push HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;tag&lt;/strong&gt; the tag to associate with the image on the registry, optional&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Request Headers:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;X-Registry-Auth&lt;/strong&gt; include a base64-encoded AuthConfig
object.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such image&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;tag-an-image-into-a-repository&#34;&gt;Tag an image into a repository&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /images/(name)/tag&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Tag the image &lt;code&gt;name&lt;/code&gt; into a repository&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /images/test/tag?repo=myrepo&amp;amp;force=0&amp;amp;tag=v42 HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 201 OK
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;repo&lt;/strong&gt; The repository to tag in&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;force&lt;/strong&gt; 1/True/true or 0/False/false, default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;tag&lt;/strong&gt; - The new tag name&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;201&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;400&lt;/strong&gt; bad parameter&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such image&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;409&lt;/strong&gt; conflict&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;remove-an-image&#34;&gt;Remove an image&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;DELETE /images/(name)&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Remove the image &lt;code&gt;name&lt;/code&gt; from the filesystem&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; DELETE /images/test HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-type: application/json
[
{&amp;quot;Untagged&amp;quot;: &amp;quot;3e2f21a89f&amp;quot;},
{&amp;quot;Deleted&amp;quot;: &amp;quot;3e2f21a89f&amp;quot;},
{&amp;quot;Deleted&amp;quot;: &amp;quot;53b4f83ac9&amp;quot;}
]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;force&lt;/strong&gt; 1/True/true or 0/False/false, default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;noprune&lt;/strong&gt; 1/True/true or 0/False/false, default false&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such image&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;409&lt;/strong&gt; conflict&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;search-images&#34;&gt;Search images&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /images/search&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Search for an image on &lt;a href=&#34;https://hub.docker.com&#34;&gt;Docker Hub&lt;/a&gt;.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;:
The response keys have changed from API v1.6 to reflect the JSON
sent by the registry server to the docker daemon&amp;rsquo;s request.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /images/search?term=sshd HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
[
{
&amp;quot;description&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;is_official&amp;quot;: false,
&amp;quot;is_automated&amp;quot;: false,
&amp;quot;name&amp;quot;: &amp;quot;wma55/u1210sshd&amp;quot;,
&amp;quot;star_count&amp;quot;: 0
},
{
&amp;quot;description&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;is_official&amp;quot;: false,
&amp;quot;is_automated&amp;quot;: false,
&amp;quot;name&amp;quot;: &amp;quot;jdswinbank/sshd&amp;quot;,
&amp;quot;star_count&amp;quot;: 0
},
{
&amp;quot;description&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;is_official&amp;quot;: false,
&amp;quot;is_automated&amp;quot;: false,
&amp;quot;name&amp;quot;: &amp;quot;vgauthier/sshd&amp;quot;,
&amp;quot;star_count&amp;quot;: 0
}
...
]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;term&lt;/strong&gt; term to search&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;2-3-misc&#34;&gt;2.3 Misc&lt;/h2&gt;
&lt;h3 id=&#34;check-auth-configuration&#34;&gt;Check auth configuration&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /auth&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Get the default username and email&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /auth HTTP/1.1
Content-Type: application/json
{
&amp;quot;username&amp;quot;:&amp;quot; hannibal&amp;quot;,
&amp;quot;password: &amp;quot;xxxx&amp;quot;,
&amp;quot;email&amp;quot;: &amp;quot;hannibal@a-team.com&amp;quot;,
&amp;quot;serveraddress&amp;quot;: &amp;quot;https://index.docker.io/v1/&amp;quot;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;204&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;display-system-wide-information&#34;&gt;Display system-wide information&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /info&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Display system-wide information&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /info HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
{
&amp;quot;Containers&amp;quot;: 11,
&amp;quot;Debug&amp;quot;: 0,
&amp;quot;DockerRootDir&amp;quot;: &amp;quot;/var/lib/docker&amp;quot;,
&amp;quot;Driver&amp;quot;: &amp;quot;btrfs&amp;quot;,
&amp;quot;DriverStatus&amp;quot;: [[&amp;quot;&amp;quot;]],
&amp;quot;ExecutionDriver&amp;quot;: &amp;quot;native-0.1&amp;quot;,
&amp;quot;HttpProxy&amp;quot;: &amp;quot;http://test:test@localhost:8080&amp;quot;,
&amp;quot;HttpsProxy&amp;quot;: &amp;quot;https://test:test@localhost:8080&amp;quot;,
&amp;quot;ID&amp;quot;: &amp;quot;7TRN:IPZB:QYBB:VPBQ:UMPP:KARE:6ZNR:XE6T:7EWV:PKF4:ZOJD:TPYS&amp;quot;,
&amp;quot;IPv4Forwarding&amp;quot;: 1,
&amp;quot;Images&amp;quot;: 16,
&amp;quot;IndexServerAddress&amp;quot;: &amp;quot;https://index.docker.io/v1/&amp;quot;,
&amp;quot;InitPath&amp;quot;: &amp;quot;/usr/bin/docker&amp;quot;,
&amp;quot;InitSha1&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;KernelVersion&amp;quot;: &amp;quot;3.12.0-1-amd64&amp;quot;,
&amp;quot;Labels&amp;quot;: [
&amp;quot;storage=ssd&amp;quot;
],
&amp;quot;MemTotal&amp;quot;: 2099236864,
&amp;quot;MemoryLimit&amp;quot;: 1,
&amp;quot;NCPU&amp;quot;: 1,
&amp;quot;NEventsListener&amp;quot;: 0,
&amp;quot;NFd&amp;quot;: 11,
&amp;quot;NGoroutines&amp;quot;: 21,
&amp;quot;Name&amp;quot;: &amp;quot;prod-server-42&amp;quot;,
&amp;quot;NoProxy&amp;quot;: &amp;quot;9.81.1.160&amp;quot;,
&amp;quot;OperatingSystem&amp;quot;: &amp;quot;Boot2Docker&amp;quot;,
&amp;quot;RegistryConfig&amp;quot;: {
&amp;quot;IndexConfigs&amp;quot;: {
&amp;quot;docker.io&amp;quot;: {
&amp;quot;Mirrors&amp;quot;: null,
&amp;quot;Name&amp;quot;: &amp;quot;docker.io&amp;quot;,
&amp;quot;Official&amp;quot;: true,
&amp;quot;Secure&amp;quot;: true
}
},
&amp;quot;InsecureRegistryCIDRs&amp;quot;: [
&amp;quot;127.0.0.0/8&amp;quot;
]
},
&amp;quot;SwapLimit&amp;quot;: 0,
&amp;quot;SystemTime&amp;quot;: &amp;quot;2015-03-10T11:11:23.730591467-07:00&amp;quot;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;show-the-docker-version-information&#34;&gt;Show the docker version information&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /version&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Show the docker version information&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /version HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
{
&amp;quot;Version&amp;quot;: &amp;quot;1.5.0&amp;quot;,
&amp;quot;Os&amp;quot;: &amp;quot;linux&amp;quot;,
&amp;quot;KernelVersion&amp;quot;: &amp;quot;3.18.5-tinycore64&amp;quot;,
&amp;quot;GoVersion&amp;quot;: &amp;quot;go1.4.1&amp;quot;,
&amp;quot;GitCommit&amp;quot;: &amp;quot;a8a31ef&amp;quot;,
&amp;quot;Arch&amp;quot;: &amp;quot;amd64&amp;quot;,
&amp;quot;ApiVersion&amp;quot;: &amp;quot;1.18&amp;quot;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;ping-the-docker-server&#34;&gt;Ping the docker server&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /_ping&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Ping the docker server&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /_ping HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: text/plain
OK
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; - no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; - server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;create-a-new-image-from-a-container-s-changes&#34;&gt;Create a new image from a container&amp;rsquo;s changes&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /commit&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Create a new image from a container&amp;rsquo;s changes&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /commit?container=44c004db4b17&amp;amp;comment=message&amp;amp;repo=myrepo HTTP/1.1
Content-Type: application/json
{
&amp;quot;Hostname&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;Domainname&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;User&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;AttachStdin&amp;quot;: false,
&amp;quot;AttachStdout&amp;quot;: true,
&amp;quot;AttachStderr&amp;quot;: true,
&amp;quot;PortSpecs&amp;quot;: null,
&amp;quot;Tty&amp;quot;: false,
&amp;quot;OpenStdin&amp;quot;: false,
&amp;quot;StdinOnce&amp;quot;: false,
&amp;quot;Env&amp;quot;: null,
&amp;quot;Cmd&amp;quot;: [
&amp;quot;date&amp;quot;
],
&amp;quot;Volumes&amp;quot;: {
&amp;quot;/tmp&amp;quot;: {}
},
&amp;quot;WorkingDir&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;NetworkDisabled&amp;quot;: false,
&amp;quot;ExposedPorts&amp;quot;: {
&amp;quot;22/tcp&amp;quot;: {}
}
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 201 Created
Content-Type: application/vnd.docker.raw-stream
{&amp;quot;Id&amp;quot;: &amp;quot;596069db4bf5&amp;quot;}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Json Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;config&lt;/strong&gt; - the container&amp;rsquo;s configuration&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;container&lt;/strong&gt; source container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;repo&lt;/strong&gt; repository&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;tag&lt;/strong&gt; tag&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;comment&lt;/strong&gt; commit message&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;author&lt;/strong&gt; author (e.g., &amp;ldquo;John Hannibal Smith
&amp;lt;&lt;a href=&#34;mailto:hannibal%40a-team.com&#34;&gt;hannibal@a-team.com&lt;/a&gt;&amp;gt;&amp;ldquo;)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;201&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;monitor-docker-s-events&#34;&gt;Monitor Docker&amp;rsquo;s events&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /events&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Get container events from docker, either in real time via streaming, or via
polling (using since).&lt;/p&gt;
&lt;p&gt;Docker containers will report the following events:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;create, destroy, die, exec_create, exec_start, export, kill, oom, pause, restart, start, stop, unpause
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;and Docker images will report:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;untag, delete
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /events?since=1374067924
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
{&amp;quot;status&amp;quot;: &amp;quot;create&amp;quot;, &amp;quot;id&amp;quot;: &amp;quot;dfdf82bd3881&amp;quot;,&amp;quot;from&amp;quot;: &amp;quot;ubuntu:latest&amp;quot;, &amp;quot;time&amp;quot;:1374067924}
{&amp;quot;status&amp;quot;: &amp;quot;start&amp;quot;, &amp;quot;id&amp;quot;: &amp;quot;dfdf82bd3881&amp;quot;,&amp;quot;from&amp;quot;: &amp;quot;ubuntu:latest&amp;quot;, &amp;quot;time&amp;quot;:1374067924}
{&amp;quot;status&amp;quot;: &amp;quot;stop&amp;quot;, &amp;quot;id&amp;quot;: &amp;quot;dfdf82bd3881&amp;quot;,&amp;quot;from&amp;quot;: &amp;quot;ubuntu:latest&amp;quot;, &amp;quot;time&amp;quot;:1374067966}
{&amp;quot;status&amp;quot;: &amp;quot;destroy&amp;quot;, &amp;quot;id&amp;quot;: &amp;quot;dfdf82bd3881&amp;quot;,&amp;quot;from&amp;quot;: &amp;quot;ubuntu:latest&amp;quot;, &amp;quot;time&amp;quot;:1374067970}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;since&lt;/strong&gt; timestamp used for polling&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;until&lt;/strong&gt; timestamp used for polling&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;filters&lt;/strong&gt; a json encoded value of the filters (a map[string][]string) to process on the event list. Available filters:
&lt;ul&gt;
&lt;li&gt;event=&amp;lt;string&amp;gt; &amp;ndash; event to filter&lt;/li&gt;
&lt;li&gt;image=&amp;lt;string&amp;gt; &amp;ndash; image to filter&lt;/li&gt;
&lt;li&gt;container=&amp;lt;string&amp;gt; &amp;ndash; container to filter&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;get-a-tarball-containing-all-images-in-a-repository&#34;&gt;Get a tarball containing all images in a repository&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /images/(name)/get&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Get a tarball containing all images and metadata for the repository specified
by &lt;code&gt;name&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;If &lt;code&gt;name&lt;/code&gt; is a specific name and tag (e.g. ubuntu:latest), then only that image
(and its parents) are returned. If &lt;code&gt;name&lt;/code&gt; is an image ID, similarly only that
image (and its parents) are returned, but with the exclusion of the
&amp;lsquo;repositories&amp;rsquo; file in the tarball, as there were no image names referenced.&lt;/p&gt;
&lt;p&gt;See the &lt;a href=&#34;#image-tarball-format&#34;&gt;image tarball format&lt;/a&gt; for more details.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /images/ubuntu/get
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/x-tar
Binary data stream
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;get-a-tarball-containing-all-images&#34;&gt;Get a tarball containing all images.&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /images/get&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Get a tarball containing all images and metadata for one or more repositories.&lt;/p&gt;
&lt;p&gt;For each value of the &lt;code&gt;names&lt;/code&gt; parameter: if it is a specific name and tag (e.g.
ubuntu:latest), then only that image (and its parents) are returned; if it is
an image ID, similarly only that image (and its parents) are returned and there
would be no names referenced in the &amp;lsquo;repositories&amp;rsquo; file for this image ID.&lt;/p&gt;
&lt;p&gt;See the &lt;a href=&#34;#image-tarball-format&#34;&gt;image tarball format&lt;/a&gt; for more details.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /images/get?names=myname%2Fmyapp%3Alatest&amp;amp;names=busybox
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/x-tar
Binary data stream
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;load-a-tarball-with-a-set-of-images-and-tags-into-docker&#34;&gt;Load a tarball with a set of images and tags into docker&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /images/load&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Load a set of images and tags into the docker repository.
See the &lt;a href=&#34;#image-tarball-format&#34;&gt;image tarball format&lt;/a&gt; for more details.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /images/load
Tarball in body
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;image-tarball-format&#34;&gt;Image tarball format&lt;/h3&gt;
&lt;p&gt;An image tarball contains one directory per image layer (named using its long ID),
each containing three files:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;VERSION&lt;/code&gt;: currently &lt;code&gt;1.0&lt;/code&gt; - the file format version&lt;/li&gt;
&lt;li&gt;&lt;code&gt;json&lt;/code&gt;: detailed layer information, similar to &lt;code&gt;docker inspect layer_id&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;layer.tar&lt;/code&gt;: A tarfile containing the filesystem changes in this layer&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The &lt;code&gt;layer.tar&lt;/code&gt; file will contain &lt;code&gt;aufs&lt;/code&gt; style &lt;code&gt;.wh..wh.aufs&lt;/code&gt; files and directories
for storing attribute changes and deletions.&lt;/p&gt;
&lt;p&gt;If the tarball defines a repository, there will also be a &lt;code&gt;repositories&lt;/code&gt; file at
the root that contains a list of repository and tag names mapped to layer IDs.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;{&amp;quot;hello-world&amp;quot;:
{&amp;quot;latest&amp;quot;: &amp;quot;565a9d68a73f6706862bfe8409a7f659776d4d60a8d096eb4a3cbce6999cc2a1&amp;quot;}
}
&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&#34;exec-create&#34;&gt;Exec Create&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /containers/(id)/exec&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Sets up an exec instance in a running container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /containers/e90e34656806/exec HTTP/1.1
Content-Type: application/json
{
&amp;quot;AttachStdin&amp;quot;: false,
&amp;quot;AttachStdout&amp;quot;: true,
&amp;quot;AttachStderr&amp;quot;: true,
&amp;quot;Tty&amp;quot;: false,
&amp;quot;Cmd&amp;quot;: [
&amp;quot;date&amp;quot;
],
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 201 OK
Content-Type: application/json
{
&amp;quot;Id&amp;quot;: &amp;quot;f90e34656806&amp;quot;
&amp;quot;Warnings&amp;quot;:[]
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Json Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;AttachStdin&lt;/strong&gt; - Boolean value, attaches to stdin of the exec command.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;AttachStdout&lt;/strong&gt; - Boolean value, attaches to stdout of the exec command.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;AttachStderr&lt;/strong&gt; - Boolean value, attaches to stderr of the exec command.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Tty&lt;/strong&gt; - Boolean value to allocate a pseudo-TTY&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Cmd&lt;/strong&gt; - Command to run specified as a string or an array of strings.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;201&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;exec-start&#34;&gt;Exec Start&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /exec/(id)/start&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Starts a previously set up exec instance &lt;code&gt;id&lt;/code&gt;. If &lt;code&gt;detach&lt;/code&gt; is true, this API
returns after starting the &lt;code&gt;exec&lt;/code&gt; command. Otherwise, this API sets up an
interactive session with the &lt;code&gt;exec&lt;/code&gt; command.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /exec/e90e34656806/start HTTP/1.1
Content-Type: application/json
{
&amp;quot;Detach&amp;quot;: false,
&amp;quot;Tty&amp;quot;: false,
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 201 OK
Content-Type: application/json
{{ STREAM }}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Json Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Detach&lt;/strong&gt; - Detach from the exec command&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Tty&lt;/strong&gt; - Boolean value to allocate a pseudo-TTY&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;201&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;404&lt;/strong&gt; no such exec instance&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Stream details&lt;/strong&gt;:
Similar to the stream behavior of &lt;code&gt;POST /container/(id)/attach&lt;/code&gt; API&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;exec-resize&#34;&gt;Exec Resize&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /exec/(id)/resize&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Resizes the tty session used by the exec command &lt;code&gt;id&lt;/code&gt;.
This API is valid only if &lt;code&gt;tty&lt;/code&gt; was specified as part of creating and starting the exec command.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /exec/e90e34656806/resize HTTP/1.1
Content-Type: text/plain
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 201 OK
Content-Type: text/plain
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;h&lt;/strong&gt; height of tty session&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;w&lt;/strong&gt; width&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;201&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such exec instance&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;exec-inspect&#34;&gt;Exec Inspect&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /exec/(id)/json&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Return low-level information about the exec command &lt;code&gt;id&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /exec/11fb006128e8ceb3942e7c58d77750f24210e35f879dd204ac975c184b820b39/json HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: plain/text
{
&amp;quot;ID&amp;quot; : &amp;quot;11fb006128e8ceb3942e7c58d77750f24210e35f879dd204ac975c184b820b39&amp;quot;,
&amp;quot;Running&amp;quot; : false,
&amp;quot;ExitCode&amp;quot; : 2,
&amp;quot;ProcessConfig&amp;quot; : {
&amp;quot;privileged&amp;quot; : false,
&amp;quot;user&amp;quot; : &amp;quot;&amp;quot;,
&amp;quot;tty&amp;quot; : false,
&amp;quot;entrypoint&amp;quot; : &amp;quot;sh&amp;quot;,
&amp;quot;arguments&amp;quot; : [
&amp;quot;-c&amp;quot;,
&amp;quot;exit 2&amp;quot;
]
},
&amp;quot;OpenStdin&amp;quot; : false,
&amp;quot;OpenStderr&amp;quot; : false,
&amp;quot;OpenStdout&amp;quot; : false,
&amp;quot;Container&amp;quot; : {
&amp;quot;State&amp;quot; : {
&amp;quot;Running&amp;quot; : true,
&amp;quot;Paused&amp;quot; : false,
&amp;quot;Restarting&amp;quot; : false,
&amp;quot;OOMKilled&amp;quot; : false,
&amp;quot;Pid&amp;quot; : 3650,
&amp;quot;ExitCode&amp;quot; : 0,
&amp;quot;Error&amp;quot; : &amp;quot;&amp;quot;,
&amp;quot;StartedAt&amp;quot; : &amp;quot;2014-11-17T22:26:03.717657531Z&amp;quot;,
&amp;quot;FinishedAt&amp;quot; : &amp;quot;0001-01-01T00:00:00Z&amp;quot;
},
&amp;quot;ID&amp;quot; : &amp;quot;8f177a186b977fb451136e0fdf182abff5599a08b3c7f6ef0d36a55aaf89634c&amp;quot;,
&amp;quot;Created&amp;quot; : &amp;quot;2014-11-17T22:26:03.626304998Z&amp;quot;,
&amp;quot;Path&amp;quot; : &amp;quot;date&amp;quot;,
&amp;quot;Args&amp;quot; : [],
&amp;quot;Config&amp;quot; : {
&amp;quot;Hostname&amp;quot; : &amp;quot;8f177a186b97&amp;quot;,
&amp;quot;Domainname&amp;quot; : &amp;quot;&amp;quot;,
&amp;quot;User&amp;quot; : &amp;quot;&amp;quot;,
&amp;quot;AttachStdin&amp;quot; : false,
&amp;quot;AttachStdout&amp;quot; : false,
&amp;quot;AttachStderr&amp;quot; : false,
&amp;quot;PortSpecs&amp;quot; : null,
&amp;quot;ExposedPorts&amp;quot; : null,
&amp;quot;Tty&amp;quot; : false,
&amp;quot;OpenStdin&amp;quot; : false,
&amp;quot;StdinOnce&amp;quot; : false,
&amp;quot;Env&amp;quot; : [ &amp;quot;PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin&amp;quot; ],
&amp;quot;Cmd&amp;quot; : [
&amp;quot;date&amp;quot;
],
&amp;quot;Image&amp;quot; : &amp;quot;ubuntu&amp;quot;,
&amp;quot;Volumes&amp;quot; : null,
&amp;quot;WorkingDir&amp;quot; : &amp;quot;&amp;quot;,
&amp;quot;Entrypoint&amp;quot; : null,
&amp;quot;NetworkDisabled&amp;quot; : false,
&amp;quot;MacAddress&amp;quot; : &amp;quot;&amp;quot;,
&amp;quot;OnBuild&amp;quot; : null,
&amp;quot;SecurityOpt&amp;quot; : null
},
&amp;quot;Image&amp;quot; : &amp;quot;5506de2b643be1e6febbf3b8a240760c6843244c41e12aa2f60ccbb7153d17f5&amp;quot;,
&amp;quot;NetworkSettings&amp;quot; : {
&amp;quot;IPAddress&amp;quot; : &amp;quot;172.17.0.2&amp;quot;,
&amp;quot;IPPrefixLen&amp;quot; : 16,
&amp;quot;MacAddress&amp;quot; : &amp;quot;02:42:ac:11:00:02&amp;quot;,
&amp;quot;Gateway&amp;quot; : &amp;quot;172.17.42.1&amp;quot;,
&amp;quot;Bridge&amp;quot; : &amp;quot;docker0&amp;quot;,
&amp;quot;PortMapping&amp;quot; : null,
&amp;quot;Ports&amp;quot; : {}
},
&amp;quot;ResolvConfPath&amp;quot; : &amp;quot;/var/lib/docker/containers/8f177a186b977fb451136e0fdf182abff5599a08b3c7f6ef0d36a55aaf89634c/resolv.conf&amp;quot;,
&amp;quot;HostnamePath&amp;quot; : &amp;quot;/var/lib/docker/containers/8f177a186b977fb451136e0fdf182abff5599a08b3c7f6ef0d36a55aaf89634c/hostname&amp;quot;,
&amp;quot;HostsPath&amp;quot; : &amp;quot;/var/lib/docker/containers/8f177a186b977fb451136e0fdf182abff5599a08b3c7f6ef0d36a55aaf89634c/hosts&amp;quot;,
&amp;quot;LogPath&amp;quot;: &amp;quot;/var/lib/docker/containers/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b-json.log&amp;quot;,
&amp;quot;Name&amp;quot; : &amp;quot;/test&amp;quot;,
&amp;quot;Driver&amp;quot; : &amp;quot;aufs&amp;quot;,
&amp;quot;ExecDriver&amp;quot; : &amp;quot;native-0.2&amp;quot;,
&amp;quot;MountLabel&amp;quot; : &amp;quot;&amp;quot;,
&amp;quot;ProcessLabel&amp;quot; : &amp;quot;&amp;quot;,
&amp;quot;AppArmorProfile&amp;quot; : &amp;quot;&amp;quot;,
&amp;quot;RestartCount&amp;quot; : 0,
&amp;quot;Volumes&amp;quot; : {},
&amp;quot;VolumesRW&amp;quot; : {}
}
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such exec instance&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; - server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h1 id=&#34;3-going-further&#34;&gt;3. Going further&lt;/h1&gt;
&lt;h2 id=&#34;3-1-inside-docker-run&#34;&gt;3.1 Inside &lt;code&gt;docker run&lt;/code&gt;&lt;/h2&gt;
&lt;p&gt;As an example, the &lt;code&gt;docker run&lt;/code&gt; command line makes the following API calls:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Create the container&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If the status code is 404, it means the image doesn&amp;rsquo;t exist:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Try to pull it&lt;/li&gt;
&lt;li&gt;Then retry to create the container&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Start the container&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If you are not in detached mode:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Attach to the container, using logs=1 (to have stdout and
stderr from the container&amp;rsquo;s start) and stream=1&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If in detached mode or only stdin is attached:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Display the container&amp;rsquo;s id&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;3-2-hijacking&#34;&gt;3.2 Hijacking&lt;/h2&gt;
&lt;p&gt;In this version of the API, /attach, uses hijacking to transport stdin,
stdout and stderr on the same socket.&lt;/p&gt;
&lt;p&gt;To hint potential proxies about connection hijacking, Docker client sends
connection upgrade headers similarly to websocket.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Upgrade: tcp
Connection: Upgrade
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;When Docker daemon detects the &lt;code&gt;Upgrade&lt;/code&gt; header, it will switch its status code
from &lt;strong&gt;200 OK&lt;/strong&gt; to &lt;strong&gt;101 UPGRADED&lt;/strong&gt; and resend the same headers.&lt;/p&gt;
&lt;p&gt;This might change in the future.&lt;/p&gt;
&lt;h2 id=&#34;3-3-cors-requests&#34;&gt;3.3 CORS Requests&lt;/h2&gt;
&lt;p&gt;To set cross origin requests to the remote api please give values to
&amp;ldquo;&amp;ndash;api-cors-header&amp;rdquo; when running docker in daemon mode. Set * will allow all,
default or blank means CORS disabled&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ docker -d -H=&amp;quot;192.168.1.9:2375&amp;quot; --api-cors-header=&amp;quot;http://foo.bar&amp;quot;
&lt;/code&gt;&lt;/pre&gt;
</description>
</item>
<item>
<title>Remote API v1.19</title>
<link>http://localhost/reference/api/docker_remote_api_v1.19/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>http://localhost/reference/api/docker_remote_api_v1.19/</guid>
<description>
&lt;h1 id=&#34;docker-remote-api-v1-19&#34;&gt;Docker Remote API v1.19&lt;/h1&gt;
&lt;h2 id=&#34;1-brief-introduction&#34;&gt;1. Brief introduction&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;The Remote API has replaced &lt;code&gt;rcli&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The daemon listens on &lt;code&gt;unix:///var/run/docker.sock&lt;/code&gt; but you can
&lt;a href=&#34;http://localhost/articles/basics/#bind-docker-to-another-hostport-or-a-unix-socket&#34;&gt;Bind Docker to another host/port or a Unix socket&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;The API tends to be REST. However, for some complex commands, like &lt;code&gt;attach&lt;/code&gt;
or &lt;code&gt;pull&lt;/code&gt;, the HTTP connection is hijacked to transport &lt;code&gt;stdout&lt;/code&gt;,
&lt;code&gt;stdin&lt;/code&gt; and &lt;code&gt;stderr&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;When the client API version is newer than the daemon&amp;rsquo;s, these calls return an HTTP
&lt;code&gt;400 Bad Request&lt;/code&gt; error message.&lt;/li&gt;
&lt;/ul&gt;
&lt;h1 id=&#34;2-endpoints&#34;&gt;2. Endpoints&lt;/h1&gt;
&lt;h2 id=&#34;2-1-containers&#34;&gt;2.1 Containers&lt;/h2&gt;
&lt;h3 id=&#34;list-containers&#34;&gt;List containers&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /containers/json&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;List containers&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;GET /containers/json?all=1&amp;amp;before=8dfafdbc3a40&amp;amp;size=1 HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;HTTP/1.1 200 OK
Content-Type: application/json
[
{
&amp;quot;Id&amp;quot;: &amp;quot;8dfafdbc3a40&amp;quot;,
&amp;quot;Image&amp;quot;: &amp;quot;ubuntu:latest&amp;quot;,
&amp;quot;Command&amp;quot;: &amp;quot;echo 1&amp;quot;,
&amp;quot;Created&amp;quot;: 1367854155,
&amp;quot;Status&amp;quot;: &amp;quot;Exit 0&amp;quot;,
&amp;quot;Ports&amp;quot;: [{&amp;quot;PrivatePort&amp;quot;: 2222, &amp;quot;PublicPort&amp;quot;: 3333, &amp;quot;Type&amp;quot;: &amp;quot;tcp&amp;quot;}],
&amp;quot;SizeRw&amp;quot;: 12288,
&amp;quot;SizeRootFs&amp;quot;: 0
},
{
&amp;quot;Id&amp;quot;: &amp;quot;9cd87474be90&amp;quot;,
&amp;quot;Image&amp;quot;: &amp;quot;ubuntu:latest&amp;quot;,
&amp;quot;Command&amp;quot;: &amp;quot;echo 222222&amp;quot;,
&amp;quot;Created&amp;quot;: 1367854155,
&amp;quot;Status&amp;quot;: &amp;quot;Exit 0&amp;quot;,
&amp;quot;Ports&amp;quot;: [],
&amp;quot;SizeRw&amp;quot;: 12288,
&amp;quot;SizeRootFs&amp;quot;: 0
},
{
&amp;quot;Id&amp;quot;: &amp;quot;3176a2479c92&amp;quot;,
&amp;quot;Image&amp;quot;: &amp;quot;ubuntu:latest&amp;quot;,
&amp;quot;Command&amp;quot;: &amp;quot;echo 3333333333333333&amp;quot;,
&amp;quot;Created&amp;quot;: 1367854154,
&amp;quot;Status&amp;quot;: &amp;quot;Exit 0&amp;quot;,
&amp;quot;Ports&amp;quot;:[],
&amp;quot;SizeRw&amp;quot;:12288,
&amp;quot;SizeRootFs&amp;quot;:0
},
{
&amp;quot;Id&amp;quot;: &amp;quot;4cb07b47f9fb&amp;quot;,
&amp;quot;Image&amp;quot;: &amp;quot;ubuntu:latest&amp;quot;,
&amp;quot;Command&amp;quot;: &amp;quot;echo 444444444444444444444444444444444&amp;quot;,
&amp;quot;Created&amp;quot;: 1367854152,
&amp;quot;Status&amp;quot;: &amp;quot;Exit 0&amp;quot;,
&amp;quot;Ports&amp;quot;: [],
&amp;quot;SizeRw&amp;quot;: 12288,
&amp;quot;SizeRootFs&amp;quot;: 0
}
]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;all&lt;/strong&gt; 1/True/true or 0/False/false, Show all containers.
Only running containers are shown by default (i.e., this defaults to false)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;limit&lt;/strong&gt; Show &lt;code&gt;limit&lt;/code&gt; last created
containers, include non-running ones.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;since&lt;/strong&gt; Show only containers created since Id, include
non-running ones.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;before&lt;/strong&gt; Show only containers created before Id, include
non-running ones.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;size&lt;/strong&gt; 1/True/true or 0/False/false, Show the containers
sizes&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;filters&lt;/strong&gt; - a JSON encoded value of the filters (a &lt;code&gt;map[string][]string&lt;/code&gt;) to process on the containers list. Available filters:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;exited=&amp;lt;int&amp;gt;&lt;/code&gt;; &amp;ndash; containers with exit code of &lt;code&gt;&amp;lt;int&amp;gt;&lt;/code&gt; ;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;status=&lt;/code&gt;(&lt;code&gt;restarting&lt;/code&gt;|&lt;code&gt;running&lt;/code&gt;|&lt;code&gt;paused&lt;/code&gt;|&lt;code&gt;exited&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;label=key&lt;/code&gt; or &lt;code&gt;key=value&lt;/code&gt; of a container label&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;400&lt;/strong&gt; bad parameter&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;create-a-container&#34;&gt;Create a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /containers/create&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Create a container&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;POST /containers/create HTTP/1.1
Content-Type: application/json
{
&amp;quot;Hostname&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;Domainname&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;User&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;AttachStdin&amp;quot;: false,
&amp;quot;AttachStdout&amp;quot;: true,
&amp;quot;AttachStderr&amp;quot;: true,
&amp;quot;Tty&amp;quot;: false,
&amp;quot;OpenStdin&amp;quot;: false,
&amp;quot;StdinOnce&amp;quot;: false,
&amp;quot;Env&amp;quot;: null,
&amp;quot;Cmd&amp;quot;: [
&amp;quot;date&amp;quot;
],
&amp;quot;Entrypoint&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;Image&amp;quot;: &amp;quot;ubuntu&amp;quot;,
&amp;quot;Labels&amp;quot;: {
&amp;quot;com.example.vendor&amp;quot;: &amp;quot;Acme&amp;quot;,
&amp;quot;com.example.license&amp;quot;: &amp;quot;GPL&amp;quot;,
&amp;quot;com.example.version&amp;quot;: &amp;quot;1.0&amp;quot;
},
&amp;quot;Volumes&amp;quot;: {
&amp;quot;/tmp&amp;quot;: {}
},
&amp;quot;WorkingDir&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;NetworkDisabled&amp;quot;: false,
&amp;quot;MacAddress&amp;quot;: &amp;quot;12:34:56:78:9a:bc&amp;quot;,
&amp;quot;ExposedPorts&amp;quot;: {
&amp;quot;22/tcp&amp;quot;: {}
},
&amp;quot;HostConfig&amp;quot;: {
&amp;quot;Binds&amp;quot;: [&amp;quot;/tmp:/tmp&amp;quot;],
&amp;quot;Links&amp;quot;: [&amp;quot;redis3:redis&amp;quot;],
&amp;quot;LxcConf&amp;quot;: {&amp;quot;lxc.utsname&amp;quot;:&amp;quot;docker&amp;quot;},
&amp;quot;Memory&amp;quot;: 0,
&amp;quot;MemorySwap&amp;quot;: 0,
&amp;quot;CpuShares&amp;quot;: 512,
&amp;quot;CpuPeriod&amp;quot;: 100000,
&amp;quot;CpusetCpus&amp;quot;: &amp;quot;0,1&amp;quot;,
&amp;quot;CpusetMems&amp;quot;: &amp;quot;0,1&amp;quot;,
&amp;quot;BlkioWeight&amp;quot;: 300,
&amp;quot;OomKillDisable&amp;quot;: false,
&amp;quot;PortBindings&amp;quot;: { &amp;quot;22/tcp&amp;quot;: [{ &amp;quot;HostPort&amp;quot;: &amp;quot;11022&amp;quot; }] },
&amp;quot;PublishAllPorts&amp;quot;: false,
&amp;quot;Privileged&amp;quot;: false,
&amp;quot;ReadonlyRootfs&amp;quot;: false,
&amp;quot;Dns&amp;quot;: [&amp;quot;8.8.8.8&amp;quot;],
&amp;quot;DnsSearch&amp;quot;: [&amp;quot;&amp;quot;],
&amp;quot;ExtraHosts&amp;quot;: null,
&amp;quot;VolumesFrom&amp;quot;: [&amp;quot;parent&amp;quot;, &amp;quot;other:ro&amp;quot;],
&amp;quot;CapAdd&amp;quot;: [&amp;quot;NET_ADMIN&amp;quot;],
&amp;quot;CapDrop&amp;quot;: [&amp;quot;MKNOD&amp;quot;],
&amp;quot;RestartPolicy&amp;quot;: { &amp;quot;Name&amp;quot;: &amp;quot;&amp;quot;, &amp;quot;MaximumRetryCount&amp;quot;: 0 },
&amp;quot;NetworkMode&amp;quot;: &amp;quot;bridge&amp;quot;,
&amp;quot;Devices&amp;quot;: [],
&amp;quot;Ulimits&amp;quot;: [{}],
&amp;quot;LogConfig&amp;quot;: { &amp;quot;Type&amp;quot;: &amp;quot;json-file&amp;quot;, &amp;quot;Config&amp;quot;: {} },
&amp;quot;SecurityOpt&amp;quot;: [&amp;quot;&amp;quot;],
&amp;quot;CgroupParent&amp;quot;: &amp;quot;&amp;quot;
}
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 201 Created
Content-Type: application/json
{
&amp;quot;Id&amp;quot;:&amp;quot;e90e34656806&amp;quot;
&amp;quot;Warnings&amp;quot;:[]
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Json Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Hostname&lt;/strong&gt; - A string value containing the hostname to use for the
container.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Domainname&lt;/strong&gt; - A string value containing the domain name to use
for the container.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;User&lt;/strong&gt; - A string value specifying the user inside the container.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Memory&lt;/strong&gt; - Memory limit in bytes.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;MemorySwap&lt;/strong&gt;- Total memory limit (memory + swap); set &lt;code&gt;-1&lt;/code&gt; to disable swap
You must use this with &lt;code&gt;memory&lt;/code&gt; and make the swap value larger than &lt;code&gt;memory&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;CpuShares&lt;/strong&gt; - An integer value containing the container&amp;rsquo;s CPU Shares
(ie. the relative weight vs other containers).&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;CpuPeriod&lt;/strong&gt; - The length of a CPU period in microseconds.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Cpuset&lt;/strong&gt; - Deprecated please don&amp;rsquo;t use. Use &lt;code&gt;CpusetCpus&lt;/code&gt; instead.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;CpusetCpus&lt;/strong&gt; - String value containing the &lt;code&gt;cgroups CpusetCpus&lt;/code&gt; to use.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;CpusetMems&lt;/strong&gt; - Memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only effective on NUMA systems.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;BlkioWeight&lt;/strong&gt; - Block IO weight (relative weight) accepts a weight value between 10 and 1000.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;OomKillDisable&lt;/strong&gt; - Boolean value, whether to disable OOM Killer for the container or not.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;AttachStdin&lt;/strong&gt; - Boolean value, attaches to &lt;code&gt;stdin&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;AttachStdout&lt;/strong&gt; - Boolean value, attaches to &lt;code&gt;stdout&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;AttachStderr&lt;/strong&gt; - Boolean value, attaches to &lt;code&gt;stderr&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Tty&lt;/strong&gt; - Boolean value, Attach standard streams to a &lt;code&gt;tty&lt;/code&gt;, including &lt;code&gt;stdin&lt;/code&gt; if it is not closed.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;OpenStdin&lt;/strong&gt; - Boolean value, opens stdin,&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;StdinOnce&lt;/strong&gt; - Boolean value, close &lt;code&gt;stdin&lt;/code&gt; after the 1 attached client disconnects.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Env&lt;/strong&gt; - A list of environment variables in the form of &lt;code&gt;VAR=value&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Labels&lt;/strong&gt; - Adds a map of labels to a container. To specify a map: &lt;code&gt;{&amp;quot;key&amp;quot;:&amp;quot;value&amp;quot;[,&amp;quot;key2&amp;quot;:&amp;quot;value2&amp;quot;]}&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Cmd&lt;/strong&gt; - Command to run specified as a string or an array of strings.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Entrypoint&lt;/strong&gt; - Set the entry point for the container as a string or an array
of strings.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Image&lt;/strong&gt; - A string specifying the image name to use for the container.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Volumes&lt;/strong&gt; An object mapping mount point paths (strings) inside the
container to empty objects.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;WorkingDir&lt;/strong&gt; - A string specifying the working directory for commands to
run in.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;NetworkDisabled&lt;/strong&gt; - Boolean value, when true disables networking for the
container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;ExposedPorts&lt;/strong&gt; - An object mapping ports to an empty object in the form of:
&lt;code&gt;&amp;quot;ExposedPorts&amp;quot;: { &amp;quot;&amp;lt;port&amp;gt;/&amp;lt;tcp|udp&amp;gt;: {}&amp;quot; }&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;HostConfig&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Binds&lt;/strong&gt; A list of volume bindings for this container. Each volume binding is a string in one of these forms:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;container_path&lt;/code&gt; to create a new volume for the container&lt;/li&gt;
&lt;li&gt;&lt;code&gt;host_path:container_path&lt;/code&gt; to bind-mount a host path into the container&lt;/li&gt;
&lt;li&gt;&lt;code&gt;host_path:container_path:ro&lt;/code&gt; to make the bind-mount read-only inside the container.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Links&lt;/strong&gt; - A list of links for the container. Each link entry should be
in the form of &lt;code&gt;container_name:alias&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;LxcConf&lt;/strong&gt; - LXC specific configurations. These configurations only
work when using the &lt;code&gt;lxc&lt;/code&gt; execution driver.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;PortBindings&lt;/strong&gt; - A map of exposed container ports and the host port they
should map to. A JSON object in the form
&lt;code&gt;{ &amp;lt;port&amp;gt;/&amp;lt;protocol&amp;gt;: [{ &amp;quot;HostPort&amp;quot;: &amp;quot;&amp;lt;port&amp;gt;&amp;quot; }] }&lt;/code&gt;
Take note that &lt;code&gt;port&lt;/code&gt; is specified as a string and not an integer value.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;PublishAllPorts&lt;/strong&gt; - Allocates a random host port for all of a container&amp;rsquo;s
exposed ports. Specified as a boolean value.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Privileged&lt;/strong&gt; - Gives the container full access to the host. Specified as
a boolean value.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;ReadonlyRootfs&lt;/strong&gt; - Mount the container&amp;rsquo;s root filesystem as read only.
Specified as a boolean value.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Dns&lt;/strong&gt; - A list of DNS servers for the container to use.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;DnsSearch&lt;/strong&gt; - A list of DNS search domains&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;ExtraHosts&lt;/strong&gt; - A list of hostnames/IP mappings to add to the
container&amp;rsquo;s &lt;code&gt;/etc/hosts&lt;/code&gt; file. Specified in the form &lt;code&gt;[&amp;quot;hostname:IP&amp;quot;]&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;VolumesFrom&lt;/strong&gt; - A list of volumes to inherit from another container.
Specified in the form &lt;code&gt;&amp;lt;container name&amp;gt;[:&amp;lt;ro|rw&amp;gt;]&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;CapAdd&lt;/strong&gt; - A list of kernel capabilities to add to the container.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Capdrop&lt;/strong&gt; - A list of kernel capabilities to drop from the container.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;RestartPolicy&lt;/strong&gt; The behavior to apply when the container exits. The
value is an object with a &lt;code&gt;Name&lt;/code&gt; property of either &lt;code&gt;&amp;quot;always&amp;quot;&lt;/code&gt; to
always restart or &lt;code&gt;&amp;quot;on-failure&amp;quot;&lt;/code&gt; to restart only when the container
exit code is non-zero. If &lt;code&gt;on-failure&lt;/code&gt; is used, &lt;code&gt;MaximumRetryCount&lt;/code&gt;
controls the number of times to retry before giving up.
The default is not to restart. (optional)
An ever increasing delay (double the previous delay, starting at 100mS)
is added before each restart to prevent flooding the server.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;NetworkMode&lt;/strong&gt; - Sets the networking mode for the container. Supported
values are: &lt;code&gt;bridge&lt;/code&gt;, &lt;code&gt;host&lt;/code&gt;, and &lt;code&gt;container:&amp;lt;name|id&amp;gt;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Devices&lt;/strong&gt; - A list of devices to add to the container specified as a JSON object in the
form
&lt;code&gt;{ &amp;quot;PathOnHost&amp;quot;: &amp;quot;/dev/deviceName&amp;quot;, &amp;quot;PathInContainer&amp;quot;: &amp;quot;/dev/deviceName&amp;quot;, &amp;quot;CgroupPermissions&amp;quot;: &amp;quot;mrw&amp;quot;}&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Ulimits&lt;/strong&gt; - A list of ulimits to set in the container, specified as
&lt;code&gt;{ &amp;quot;Name&amp;quot;: &amp;lt;name&amp;gt;, &amp;quot;Soft&amp;quot;: &amp;lt;soft limit&amp;gt;, &amp;quot;Hard&amp;quot;: &amp;lt;hard limit&amp;gt; }&lt;/code&gt;, for example:
&lt;code&gt;Ulimits: { &amp;quot;Name&amp;quot;: &amp;quot;nofile&amp;quot;, &amp;quot;Soft&amp;quot;: 1024, &amp;quot;Hard&amp;quot;, 2048 }}&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;SecurityOpt&lt;/strong&gt;: A list of string values to customize labels for MLS
systems, such as SELinux.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;LogConfig&lt;/strong&gt; - Log configuration for the container, specified as a JSON object in the form
&lt;code&gt;{ &amp;quot;Type&amp;quot;: &amp;quot;&amp;lt;driver_name&amp;gt;&amp;quot;, &amp;quot;Config&amp;quot;: {&amp;quot;key1&amp;quot;: &amp;quot;val1&amp;quot;}}&lt;/code&gt;.
Available types: &lt;code&gt;json-file&lt;/code&gt;, &lt;code&gt;syslog&lt;/code&gt;, &lt;code&gt;journald&lt;/code&gt;, &lt;code&gt;none&lt;/code&gt;.
&lt;code&gt;syslog&lt;/code&gt; available options are: &lt;code&gt;address&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;CgroupParent&lt;/strong&gt; - Path to cgroups under which the cgroup for the container will be created. If the path is not absolute, the path is considered to be relative to the cgroups path of the init process. Cgroups will be created if they do not already exist.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;name&lt;/strong&gt; Assign the specified name to the container. Must
match &lt;code&gt;/?[a-zA-Z0-9_-]+&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;201&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;406&lt;/strong&gt; impossible to attach (container not running)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;inspect-a-container&#34;&gt;Inspect a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /containers/(id)/json&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Return low-level information on the container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /containers/4fa6e0f0c678/json HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;HTTP/1.1 200 OK
Content-Type: application/json
{
&amp;quot;AppArmorProfile&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;Args&amp;quot;: [
&amp;quot;-c&amp;quot;,
&amp;quot;exit 9&amp;quot;
],
&amp;quot;Config&amp;quot;: {
&amp;quot;AttachStderr&amp;quot;: true,
&amp;quot;AttachStdin&amp;quot;: false,
&amp;quot;AttachStdout&amp;quot;: true,
&amp;quot;Cmd&amp;quot;: [
&amp;quot;/bin/sh&amp;quot;,
&amp;quot;-c&amp;quot;,
&amp;quot;exit 9&amp;quot;
],
&amp;quot;Domainname&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;Entrypoint&amp;quot;: null,
&amp;quot;Env&amp;quot;: [
&amp;quot;PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin&amp;quot;
],
&amp;quot;ExposedPorts&amp;quot;: null,
&amp;quot;Hostname&amp;quot;: &amp;quot;ba033ac44011&amp;quot;,
&amp;quot;Image&amp;quot;: &amp;quot;ubuntu&amp;quot;,
&amp;quot;Labels&amp;quot;: {
&amp;quot;com.example.vendor&amp;quot;: &amp;quot;Acme&amp;quot;,
&amp;quot;com.example.license&amp;quot;: &amp;quot;GPL&amp;quot;,
&amp;quot;com.example.version&amp;quot;: &amp;quot;1.0&amp;quot;
},
&amp;quot;MacAddress&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;NetworkDisabled&amp;quot;: false,
&amp;quot;OnBuild&amp;quot;: null,
&amp;quot;OpenStdin&amp;quot;: false,
&amp;quot;PortSpecs&amp;quot;: null,
&amp;quot;StdinOnce&amp;quot;: false,
&amp;quot;Tty&amp;quot;: false,
&amp;quot;User&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;Volumes&amp;quot;: null,
&amp;quot;WorkingDir&amp;quot;: &amp;quot;&amp;quot;
},
&amp;quot;Created&amp;quot;: &amp;quot;2015-01-06T15:47:31.485331387Z&amp;quot;,
&amp;quot;Driver&amp;quot;: &amp;quot;devicemapper&amp;quot;,
&amp;quot;ExecDriver&amp;quot;: &amp;quot;native-0.2&amp;quot;,
&amp;quot;ExecIDs&amp;quot;: null,
&amp;quot;HostConfig&amp;quot;: {
&amp;quot;Binds&amp;quot;: null,
&amp;quot;BlkioWeight&amp;quot;: 0,
&amp;quot;CapAdd&amp;quot;: null,
&amp;quot;CapDrop&amp;quot;: null,
&amp;quot;ContainerIDFile&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;CpusetCpus&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;CpusetMems&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;CpuShares&amp;quot;: 0,
&amp;quot;CpuPeriod&amp;quot;: 100000,
&amp;quot;Devices&amp;quot;: [],
&amp;quot;Dns&amp;quot;: null,
&amp;quot;DnsSearch&amp;quot;: null,
&amp;quot;ExtraHosts&amp;quot;: null,
&amp;quot;IpcMode&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;Links&amp;quot;: null,
&amp;quot;LxcConf&amp;quot;: [],
&amp;quot;Memory&amp;quot;: 0,
&amp;quot;MemorySwap&amp;quot;: 0,
&amp;quot;OomKillDisable&amp;quot;: false,
&amp;quot;NetworkMode&amp;quot;: &amp;quot;bridge&amp;quot;,
&amp;quot;PortBindings&amp;quot;: {},
&amp;quot;Privileged&amp;quot;: false,
&amp;quot;ReadonlyRootfs&amp;quot;: false,
&amp;quot;PublishAllPorts&amp;quot;: false,
&amp;quot;RestartPolicy&amp;quot;: {
&amp;quot;MaximumRetryCount&amp;quot;: 2,
&amp;quot;Name&amp;quot;: &amp;quot;on-failure&amp;quot;
},
&amp;quot;LogConfig&amp;quot;: {
&amp;quot;Config&amp;quot;: null,
&amp;quot;Type&amp;quot;: &amp;quot;json-file&amp;quot;
},
&amp;quot;SecurityOpt&amp;quot;: null,
&amp;quot;VolumesFrom&amp;quot;: null,
&amp;quot;Ulimits&amp;quot;: [{}]
},
&amp;quot;HostnamePath&amp;quot;: &amp;quot;/var/lib/docker/containers/ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39/hostname&amp;quot;,
&amp;quot;HostsPath&amp;quot;: &amp;quot;/var/lib/docker/containers/ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39/hosts&amp;quot;,
&amp;quot;LogPath&amp;quot;: &amp;quot;/var/lib/docker/containers/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b-json.log&amp;quot;,
&amp;quot;Id&amp;quot;: &amp;quot;ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39&amp;quot;,
&amp;quot;Image&amp;quot;: &amp;quot;04c5d3b7b0656168630d3ba35d8889bd0e9caafcaeb3004d2bfbc47e7c5d35d2&amp;quot;,
&amp;quot;MountLabel&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;Name&amp;quot;: &amp;quot;/boring_euclid&amp;quot;,
&amp;quot;NetworkSettings&amp;quot;: {
&amp;quot;Bridge&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;Gateway&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;IPAddress&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;IPPrefixLen&amp;quot;: 0,
&amp;quot;MacAddress&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;PortMapping&amp;quot;: null,
&amp;quot;Ports&amp;quot;: null
},
&amp;quot;Path&amp;quot;: &amp;quot;/bin/sh&amp;quot;,
&amp;quot;ProcessLabel&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;ResolvConfPath&amp;quot;: &amp;quot;/var/lib/docker/containers/ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39/resolv.conf&amp;quot;,
&amp;quot;RestartCount&amp;quot;: 1,
&amp;quot;State&amp;quot;: {
&amp;quot;Error&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;ExitCode&amp;quot;: 9,
&amp;quot;FinishedAt&amp;quot;: &amp;quot;2015-01-06T15:47:32.080254511Z&amp;quot;,
&amp;quot;OOMKilled&amp;quot;: false,
&amp;quot;Paused&amp;quot;: false,
&amp;quot;Pid&amp;quot;: 0,
&amp;quot;Restarting&amp;quot;: false,
&amp;quot;Running&amp;quot;: false,
&amp;quot;StartedAt&amp;quot;: &amp;quot;2015-01-06T15:47:32.072697474Z&amp;quot;
},
&amp;quot;Volumes&amp;quot;: {},
&amp;quot;VolumesRW&amp;quot;: {}
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;list-processes-running-inside-a-container&#34;&gt;List processes running inside a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /containers/(id)/top&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;List processes running inside the container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;GET /containers/4fa6e0f0c678/top HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;HTTP/1.1 200 OK
Content-Type: application/json
{
&amp;quot;Titles&amp;quot;: [
&amp;quot;USER&amp;quot;,
&amp;quot;PID&amp;quot;,
&amp;quot;%CPU&amp;quot;,
&amp;quot;%MEM&amp;quot;,
&amp;quot;VSZ&amp;quot;,
&amp;quot;RSS&amp;quot;,
&amp;quot;TTY&amp;quot;,
&amp;quot;STAT&amp;quot;,
&amp;quot;START&amp;quot;,
&amp;quot;TIME&amp;quot;,
&amp;quot;COMMAND&amp;quot;
],
&amp;quot;Processes&amp;quot;: [
[&amp;quot;root&amp;quot;,&amp;quot;20147&amp;quot;,&amp;quot;0.0&amp;quot;,&amp;quot;0.1&amp;quot;,&amp;quot;18060&amp;quot;,&amp;quot;1864&amp;quot;,&amp;quot;pts/4&amp;quot;,&amp;quot;S&amp;quot;,&amp;quot;10:06&amp;quot;,&amp;quot;0:00&amp;quot;,&amp;quot;bash&amp;quot;],
[&amp;quot;root&amp;quot;,&amp;quot;20271&amp;quot;,&amp;quot;0.0&amp;quot;,&amp;quot;0.0&amp;quot;,&amp;quot;4312&amp;quot;,&amp;quot;352&amp;quot;,&amp;quot;pts/4&amp;quot;,&amp;quot;S+&amp;quot;,&amp;quot;10:07&amp;quot;,&amp;quot;0:00&amp;quot;,&amp;quot;sleep&amp;quot;,&amp;quot;10&amp;quot;]
]
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;ps_args&lt;/strong&gt; ps arguments to use (e.g., aux)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;get-container-logs&#34;&gt;Get container logs&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /containers/(id)/logs&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Get &lt;code&gt;stdout&lt;/code&gt; and &lt;code&gt;stderr&lt;/code&gt; logs from the container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;:
This endpoint works only for containers with &lt;code&gt;json-file&lt;/code&gt; logging driver.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; GET /containers/4fa6e0f0c678/logs?stderr=1&amp;amp;stdout=1&amp;amp;timestamps=1&amp;amp;follow=1&amp;amp;tail=10&amp;amp;since=1428990821 HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 101 UPGRADED
Content-Type: application/vnd.docker.raw-stream
Connection: Upgrade
Upgrade: tcp
{{ STREAM }}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;follow&lt;/strong&gt; 1/True/true or 0/False/false, return stream. Default &lt;code&gt;false&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;stdout&lt;/strong&gt; 1/True/true or 0/False/false, show &lt;code&gt;stdout&lt;/code&gt; log. Default &lt;code&gt;false&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;stderr&lt;/strong&gt; 1/True/true or 0/False/false, show &lt;code&gt;stderr&lt;/code&gt; log. Default &lt;code&gt;false&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;since&lt;/strong&gt; UNIX timestamp (integer) to filter logs. Specifying a timestamp
will only output log-entries since that timestamp. Default: 0 (unfiltered)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;timestamps&lt;/strong&gt; 1/True/true or 0/False/false, print timestamps for
every log line. Default &lt;code&gt;false&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;tail&lt;/strong&gt; Output specified number of lines at the end of logs: &lt;code&gt;all&lt;/code&gt; or &lt;code&gt;&amp;lt;number&amp;gt;&lt;/code&gt;. Default all.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;101&lt;/strong&gt; no error, hints proxy about hijacking&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error, no upgrade header found&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;inspect-changes-on-a-container-s-filesystem&#34;&gt;Inspect changes on a container&amp;rsquo;s filesystem&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /containers/(id)/changes&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Inspect changes on container &lt;code&gt;id&lt;/code&gt;&amp;rsquo;s filesystem&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;GET /containers/4fa6e0f0c678/changes HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;HTTP/1.1 200 OK
Content-Type: application/json
[
{
&amp;quot;Path&amp;quot;: &amp;quot;/dev&amp;quot;,
&amp;quot;Kind&amp;quot;: 0
},
{
&amp;quot;Path&amp;quot;: &amp;quot;/dev/kmsg&amp;quot;,
&amp;quot;Kind&amp;quot;: 1
},
{
&amp;quot;Path&amp;quot;: &amp;quot;/test&amp;quot;,
&amp;quot;Kind&amp;quot;: 1
}
]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Values for &lt;code&gt;Kind&lt;/code&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;0&lt;/code&gt;: Modify&lt;/li&gt;
&lt;li&gt;&lt;code&gt;1&lt;/code&gt;: Add&lt;/li&gt;
&lt;li&gt;&lt;code&gt;2&lt;/code&gt;: Delete&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;export-a-container&#34;&gt;Export a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /containers/(id)/export&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Export the contents of container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;GET /containers/4fa6e0f0c678/export HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;HTTP/1.1 200 OK
Content-Type: application/octet-stream
{{ TAR STREAM }}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;get-container-stats-based-on-resource-usage&#34;&gt;Get container stats based on resource usage&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /containers/(id)/stats&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;This endpoint returns a live stream of a container&amp;rsquo;s resource usage statistics.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: this functionality currently only works when using the &lt;em&gt;libcontainer&lt;/em&gt; exec-driver.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;GET /containers/redis1/stats HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Type: application/json
{
&amp;quot;read&amp;quot; : &amp;quot;2015-01-08T22:57:31.547920715Z&amp;quot;,
&amp;quot;network&amp;quot; : {
&amp;quot;rx_dropped&amp;quot; : 0,
&amp;quot;rx_bytes&amp;quot; : 648,
&amp;quot;rx_errors&amp;quot; : 0,
&amp;quot;tx_packets&amp;quot; : 8,
&amp;quot;tx_dropped&amp;quot; : 0,
&amp;quot;rx_packets&amp;quot; : 8,
&amp;quot;tx_errors&amp;quot; : 0,
&amp;quot;tx_bytes&amp;quot; : 648
},
&amp;quot;memory_stats&amp;quot; : {
&amp;quot;stats&amp;quot; : {
&amp;quot;total_pgmajfault&amp;quot; : 0,
&amp;quot;cache&amp;quot; : 0,
&amp;quot;mapped_file&amp;quot; : 0,
&amp;quot;total_inactive_file&amp;quot; : 0,
&amp;quot;pgpgout&amp;quot; : 414,
&amp;quot;rss&amp;quot; : 6537216,
&amp;quot;total_mapped_file&amp;quot; : 0,
&amp;quot;writeback&amp;quot; : 0,
&amp;quot;unevictable&amp;quot; : 0,
&amp;quot;pgpgin&amp;quot; : 477,
&amp;quot;total_unevictable&amp;quot; : 0,
&amp;quot;pgmajfault&amp;quot; : 0,
&amp;quot;total_rss&amp;quot; : 6537216,
&amp;quot;total_rss_huge&amp;quot; : 6291456,
&amp;quot;total_writeback&amp;quot; : 0,
&amp;quot;total_inactive_anon&amp;quot; : 0,
&amp;quot;rss_huge&amp;quot; : 6291456,
&amp;quot;hierarchical_memory_limit&amp;quot; : 67108864,
&amp;quot;total_pgfault&amp;quot; : 964,
&amp;quot;total_active_file&amp;quot; : 0,
&amp;quot;active_anon&amp;quot; : 6537216,
&amp;quot;total_active_anon&amp;quot; : 6537216,
&amp;quot;total_pgpgout&amp;quot; : 414,
&amp;quot;total_cache&amp;quot; : 0,
&amp;quot;inactive_anon&amp;quot; : 0,
&amp;quot;active_file&amp;quot; : 0,
&amp;quot;pgfault&amp;quot; : 964,
&amp;quot;inactive_file&amp;quot; : 0,
&amp;quot;total_pgpgin&amp;quot; : 477
},
&amp;quot;max_usage&amp;quot; : 6651904,
&amp;quot;usage&amp;quot; : 6537216,
&amp;quot;failcnt&amp;quot; : 0,
&amp;quot;limit&amp;quot; : 67108864
},
&amp;quot;blkio_stats&amp;quot; : {},
&amp;quot;cpu_stats&amp;quot; : {
&amp;quot;cpu_usage&amp;quot; : {
&amp;quot;percpu_usage&amp;quot; : [
16970827,
1839451,
7107380,
10571290
],
&amp;quot;usage_in_usermode&amp;quot; : 10000000,
&amp;quot;total_usage&amp;quot; : 36488948,
&amp;quot;usage_in_kernelmode&amp;quot; : 20000000
},
&amp;quot;system_cpu_usage&amp;quot; : 20091722000000000,
&amp;quot;throttling_data&amp;quot; : {}
}
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;stream&lt;/strong&gt; 1/True/true or 0/False/false, pull stats once then disconnect. Default &lt;code&gt;true&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;resize-a-container-tty&#34;&gt;Resize a container TTY&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /containers/(id)/resize?h=&amp;lt;height&amp;gt;&amp;amp;w=&amp;lt;width&amp;gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Resize the TTY for container with &lt;code&gt;id&lt;/code&gt;. You must restart the container for the resize to take effect.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /containers/4fa6e0f0c678/resize?h=40&amp;amp;w=80 HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 200 OK
Content-Length: 0
Content-Type: text/plain; charset=utf-8
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; No such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; Cannot resize container&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;start-a-container&#34;&gt;Start a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /containers/(id)/start&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Start the container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; POST /containers/(id)/start HTTP/1.1
Content-Type: application/json
{
&amp;quot;Binds&amp;quot;: [&amp;quot;/tmp:/tmp&amp;quot;],
&amp;quot;Links&amp;quot;: [&amp;quot;redis3:redis&amp;quot;],
&amp;quot;LxcConf&amp;quot;: {&amp;quot;lxc.utsname&amp;quot;:&amp;quot;docker&amp;quot;},
&amp;quot;Memory&amp;quot;: 0,
&amp;quot;MemorySwap&amp;quot;: 0,
&amp;quot;CpuShares&amp;quot;: 512,
&amp;quot;CpusetCpus&amp;quot;: &amp;quot;0,1&amp;quot;,
&amp;quot;PortBindings&amp;quot;: { &amp;quot;22/tcp&amp;quot;: [{ &amp;quot;HostPort&amp;quot;: &amp;quot;11022&amp;quot; }] },
&amp;quot;PublishAllPorts&amp;quot;: false,
&amp;quot;Privileged&amp;quot;: false,
&amp;quot;ReadonlyRootfs&amp;quot;: false,
&amp;quot;Dns&amp;quot;: [&amp;quot;8.8.8.8&amp;quot;],
&amp;quot;DnsSearch&amp;quot;: [&amp;quot;&amp;quot;],
&amp;quot;ExtraHosts&amp;quot;: null,
&amp;quot;VolumesFrom&amp;quot;: [&amp;quot;parent&amp;quot;, &amp;quot;other:ro&amp;quot;],
&amp;quot;CapAdd&amp;quot;: [&amp;quot;NET_ADMIN&amp;quot;],
&amp;quot;CapDrop&amp;quot;: [&amp;quot;MKNOD&amp;quot;],
&amp;quot;RestartPolicy&amp;quot;: { &amp;quot;Name&amp;quot;: &amp;quot;&amp;quot;, &amp;quot;MaximumRetryCount&amp;quot;: 0 },
&amp;quot;NetworkMode&amp;quot;: &amp;quot;bridge&amp;quot;,
&amp;quot;Devices&amp;quot;: [],
&amp;quot;Ulimits&amp;quot;: [{}],
&amp;quot;LogConfig&amp;quot;: { &amp;quot;Type&amp;quot;: &amp;quot;json-file&amp;quot;, &amp;quot;Config&amp;quot;: {} },
&amp;quot;SecurityOpt&amp;quot;: [&amp;quot;&amp;quot;],
&amp;quot;CgroupParent&amp;quot;: &amp;quot;&amp;quot;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP/1.1 204 No Content
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Json Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Binds&lt;/strong&gt; A list of volume bindings for this container. Each volume binding is a string in one of these forms:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;container_path&lt;/code&gt; to create a new volume for the container&lt;/li&gt;
&lt;li&gt;&lt;code&gt;host_path:container_path&lt;/code&gt; to bind-mount a host path into the container&lt;/li&gt;
&lt;li&gt;&lt;code&gt;host_path:container_path:ro&lt;/code&gt; to make the bind-mount read-only inside the container.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Links&lt;/strong&gt; - A list of links for the container. Each link entry should be of
of the form &lt;code&gt;container_name:alias&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;LxcConf&lt;/strong&gt; - LXC specific configurations. These configurations only
work when using the &lt;code&gt;lxc&lt;/code&gt; execution driver.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;PortBindings&lt;/strong&gt; - A map of exposed container ports and the host port they
should map to. A JSON object in the form
&lt;code&gt;{ &amp;lt;port&amp;gt;/&amp;lt;protocol&amp;gt;: [{ &amp;quot;HostPort&amp;quot;: &amp;quot;&amp;lt;port&amp;gt;&amp;quot; }] }&lt;/code&gt;
Take note that &lt;code&gt;port&lt;/code&gt; is specified as a string and not an integer value.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;PublishAllPorts&lt;/strong&gt; - Allocates a random host port for all of a container&amp;rsquo;s
exposed ports. Specified as a boolean value.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Privileged&lt;/strong&gt; - Gives the container full access to the host. Specified as
a boolean value.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;ReadonlyRootfs&lt;/strong&gt; - Mount the container&amp;rsquo;s root filesystem as read only.
Specified as a boolean value.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Dns&lt;/strong&gt; - A list of dns servers for the container to use.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;DnsSearch&lt;/strong&gt; - A list of DNS search domains.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;ExtraHosts&lt;/strong&gt; - A list of hostnames/IP mappings to add to the
container&amp;rsquo;s &lt;code&gt;/etc/hosts&lt;/code&gt; file. Specified in the form &lt;code&gt;[&amp;quot;hostname:IP&amp;quot;]&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;VolumesFrom&lt;/strong&gt; - A list of volumes to inherit from another container.
Specified in the form &lt;code&gt;&amp;lt;container name&amp;gt;[:&amp;lt;ro|rw&amp;gt;]&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;CapAdd&lt;/strong&gt; - A list of kernel capabilities to add to the container.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Capdrop&lt;/strong&gt; - A list of kernel capabilities to drop from the container.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;RestartPolicy&lt;/strong&gt; The behavior to apply when the container exits. The
value is an object with a &lt;code&gt;Name&lt;/code&gt; property of either &lt;code&gt;&amp;quot;always&amp;quot;&lt;/code&gt; to
always restart or &lt;code&gt;&amp;quot;on-failure&amp;quot;&lt;/code&gt; to restart only when the container
exit code is non-zero. If &lt;code&gt;on-failure&lt;/code&gt; is used, &lt;code&gt;MaximumRetryCount&lt;/code&gt;
controls the number of times to retry before giving up.
The default is not to restart. (optional)
An ever increasing delay (double the previous delay, starting at 100mS)
is added before each restart to prevent flooding the server.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;NetworkMode&lt;/strong&gt; - Sets the networking mode for the container. Supported
values are: &lt;code&gt;bridge&lt;/code&gt;, &lt;code&gt;host&lt;/code&gt;, and &lt;code&gt;container:&amp;lt;name|id&amp;gt;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Devices&lt;/strong&gt; - A list of devices to add to the container specified as a JSON object in the
form
&lt;code&gt;{ &amp;quot;PathOnHost&amp;quot;: &amp;quot;/dev/deviceName&amp;quot;, &amp;quot;PathInContainer&amp;quot;: &amp;quot;/dev/deviceName&amp;quot;, &amp;quot;CgroupPermissions&amp;quot;: &amp;quot;mrw&amp;quot;}&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Ulimits&lt;/strong&gt; - A list of ulimits to set in the container, specified as
&lt;code&gt;{ &amp;quot;Name&amp;quot;: &amp;lt;name&amp;gt;, &amp;quot;Soft&amp;quot;: &amp;lt;soft limit&amp;gt;, &amp;quot;Hard&amp;quot;: &amp;lt;hard limit&amp;gt; }&lt;/code&gt;, for example:
&lt;code&gt;Ulimits: { &amp;quot;Name&amp;quot;: &amp;quot;nofile&amp;quot;, &amp;quot;Soft&amp;quot;: 1024, &amp;quot;Hard&amp;quot;, 2048 }}&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;SecurityOpt&lt;/strong&gt;: A list of string values to customize labels for MLS
systems, such as SELinux.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;LogConfig&lt;/strong&gt; - Log configuration for the container, specified as
&lt;code&gt;{ &amp;quot;Type&amp;quot;: &amp;quot;&amp;lt;driver_name&amp;gt;&amp;quot;, &amp;quot;Config&amp;quot;: {&amp;quot;key1&amp;quot;: &amp;quot;val1&amp;quot;}}&lt;/code&gt;.
Available types: &lt;code&gt;json-file&lt;/code&gt;, &lt;code&gt;syslog&lt;/code&gt;, &lt;code&gt;journald&lt;/code&gt;, &lt;code&gt;none&lt;/code&gt;.
&lt;code&gt;json-file&lt;/code&gt; logging driver.
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;CgroupParent&lt;/strong&gt; - Path to &lt;code&gt;cgroups&lt;/code&gt; under which the container&amp;rsquo;s &lt;code&gt;cgroup&lt;/code&gt; is created. If the path is not absolute, the path is considered to be relative to the &lt;code&gt;cgroups&lt;/code&gt; path of the init process. Cgroups are created if they do not already exist.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;204&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;304&lt;/strong&gt; container already started&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;stop-a-container&#34;&gt;Stop a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /containers/(id)/stop&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Stop the container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;POST /containers/e90e34656806/stop?t=5 HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;HTTP/1.1 204 No Content
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;t&lt;/strong&gt; number of seconds to wait before killing the container&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;204&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;304&lt;/strong&gt; container already stopped&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;restart-a-container&#34;&gt;Restart a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /containers/(id)/restart&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Restart the container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;POST /containers/e90e34656806/restart?t=5 HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;HTTP/1.1 204 No Content
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;t&lt;/strong&gt; number of seconds to wait before killing the container&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;204&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;kill-a-container&#34;&gt;Kill a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /containers/(id)/kill&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Kill the container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;POST /containers/e90e34656806/kill HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;HTTP/1.1 204 No Content
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;signal&lt;/strong&gt; - Signal to send to the container: integer or string like &lt;code&gt;SIGINT&lt;/code&gt;.
When not set, &lt;code&gt;SIGKILL&lt;/code&gt; is assumed and the call waits for the container to exit.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;204&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;rename-a-container&#34;&gt;Rename a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /containers/(id)/rename&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Rename the container &lt;code&gt;id&lt;/code&gt; to a &lt;code&gt;new_name&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;POST /containers/e90e34656806/rename?name=new_name HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;HTTP/1.1 204 No Content
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;name&lt;/strong&gt; new name for the container&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;204&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;409&lt;/strong&gt; - conflict name already assigned&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;pause-a-container&#34;&gt;Pause a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /containers/(id)/pause&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Pause the container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;POST /containers/e90e34656806/pause HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;HTTP/1.1 204 No Content
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;204&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;unpause-a-container&#34;&gt;Unpause a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /containers/(id)/unpause&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Unpause the container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;POST /containers/e90e34656806/unpause HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;HTTP/1.1 204 No Content
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;204&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;attach-to-a-container&#34;&gt;Attach to a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /containers/(id)/attach&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Attach to the container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;POST /containers/16253994b7c4/attach?logs=1&amp;amp;stream=0&amp;amp;stdout=1 HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;HTTP/1.1 101 UPGRADED
Content-Type: application/vnd.docker.raw-stream
Connection: Upgrade
Upgrade: tcp
{{ STREAM }}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;logs&lt;/strong&gt; 1/True/true or 0/False/false, return logs. Default &lt;code&gt;false&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;stream&lt;/strong&gt; 1/True/true or 0/False/false, return stream.
Default &lt;code&gt;false&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;stdin&lt;/strong&gt; 1/True/true or 0/False/false, if &lt;code&gt;stream=true&lt;/code&gt;, attach
to &lt;code&gt;stdin&lt;/code&gt;. Default &lt;code&gt;false&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;stdout&lt;/strong&gt; 1/True/true or 0/False/false, if &lt;code&gt;logs=true&lt;/code&gt;, return
&lt;code&gt;stdout&lt;/code&gt; log, if &lt;code&gt;stream=true&lt;/code&gt;, attach to &lt;code&gt;stdout&lt;/code&gt;. Default &lt;code&gt;false&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;stderr&lt;/strong&gt; 1/True/true or 0/False/false, if &lt;code&gt;logs=true&lt;/code&gt;, return
&lt;code&gt;stderr&lt;/code&gt; log, if &lt;code&gt;stream=true&lt;/code&gt;, attach to &lt;code&gt;stderr&lt;/code&gt;. Default &lt;code&gt;false&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;101&lt;/strong&gt; no error, hints proxy about hijacking&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error, no upgrade header found&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;400&lt;/strong&gt; bad parameter&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Stream details&lt;/strong&gt;:&lt;/p&gt;
&lt;p&gt;When using the TTY setting is enabled in
&lt;a href=&#34;http://localhost/docker/reference/api/docker_remote_api_v1.9/#create-a-container&#34; title=&#34;POST /containers/create&#34;&gt;&lt;code&gt;POST /containers/create&lt;/code&gt;
&lt;/a&gt;,
the stream is the raw data from the process PTY and client&amp;rsquo;s &lt;code&gt;stdin&lt;/code&gt;.
When the TTY is disabled, then the stream is multiplexed to separate
&lt;code&gt;stdout&lt;/code&gt; and &lt;code&gt;stderr&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The format is a &lt;strong&gt;Header&lt;/strong&gt; and a &lt;strong&gt;Payload&lt;/strong&gt; (frame).&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;HEADER&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The header contains the information which the stream writes (&lt;code&gt;stdout&lt;/code&gt; or
&lt;code&gt;stderr&lt;/code&gt;). It also contains the size of the associated frame encoded in the
last four bytes (&lt;code&gt;uint32&lt;/code&gt;).&lt;/p&gt;
&lt;p&gt;It is encoded on the first eight bytes like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;header := [8]byte{STREAM_TYPE, 0, 0, 0, SIZE1, SIZE2, SIZE3, SIZE4}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;STREAM_TYPE&lt;/code&gt; can be:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;0: &lt;code&gt;stdin&lt;/code&gt; (is written on &lt;code&gt;stdout&lt;/code&gt;)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;1: &lt;code&gt;stdout&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;2: &lt;code&gt;stderr&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;SIZE1, SIZE2, SIZE3, SIZE4&lt;/code&gt; are the four bytes of
the &lt;code&gt;uint32&lt;/code&gt; size encoded as big endian.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;PAYLOAD&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The payload is the raw stream.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;IMPLEMENTATION&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The simplest way to implement the Attach protocol is the following:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Read eight bytes.&lt;/li&gt;
&lt;li&gt;Choose &lt;code&gt;stdout&lt;/code&gt; or &lt;code&gt;stderr&lt;/code&gt; depending on the first byte.&lt;/li&gt;
&lt;li&gt;Extract the frame size from the last four bytes.&lt;/li&gt;
&lt;li&gt;Read the extracted size and output it on the correct output.&lt;/li&gt;
&lt;li&gt;Goto 1.&lt;/li&gt;
&lt;/ol&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;attach-to-a-container-websocket&#34;&gt;Attach to a container (websocket)&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /containers/(id)/attach/ws&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Attach to the container &lt;code&gt;id&lt;/code&gt; via websocket&lt;/p&gt;
&lt;p&gt;Implements websocket protocol handshake according to &lt;a href=&#34;http://tools.ietf.org/html/rfc6455&#34;&gt;RFC 6455&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;GET /containers/e90e34656806/attach/ws?logs=0&amp;amp;stream=1&amp;amp;stdin=1&amp;amp;stdout=1&amp;amp;stderr=1 HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;{{ STREAM }}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;logs&lt;/strong&gt; 1/True/true or 0/False/false, return logs. Default &lt;code&gt;false&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;stream&lt;/strong&gt; 1/True/true or 0/False/false, return stream.
Default &lt;code&gt;false&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;stdin&lt;/strong&gt; 1/True/true or 0/False/false, if &lt;code&gt;stream=true&lt;/code&gt;, attach
to &lt;code&gt;stdin&lt;/code&gt;. Default &lt;code&gt;false&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;stdout&lt;/strong&gt; 1/True/true or 0/False/false, if &lt;code&gt;logs=true&lt;/code&gt;, return
&lt;code&gt;stdout&lt;/code&gt; log, if &lt;code&gt;stream=true&lt;/code&gt;, attach to &lt;code&gt;stdout&lt;/code&gt;. Default &lt;code&gt;false&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;stderr&lt;/strong&gt; 1/True/true or 0/False/false, if &lt;code&gt;logs=true&lt;/code&gt;, return
&lt;code&gt;stderr&lt;/code&gt; log, if &lt;code&gt;stream=true&lt;/code&gt;, attach to &lt;code&gt;stderr&lt;/code&gt;. Default &lt;code&gt;false&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;400&lt;/strong&gt; bad parameter&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;wait-a-container&#34;&gt;Wait a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /containers/(id)/wait&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Block until container &lt;code&gt;id&lt;/code&gt; stops, then returns the exit code&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;POST /containers/16253994b7c4/wait HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;HTTP/1.1 200 OK
Content-Type: application/json
{&amp;quot;StatusCode&amp;quot;: 0}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;remove-a-container&#34;&gt;Remove a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;DELETE /containers/(id)&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Remove the container &lt;code&gt;id&lt;/code&gt; from the filesystem&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;DELETE /containers/16253994b7c4?v=1 HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;HTTP/1.1 204 No Content
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;v&lt;/strong&gt; 1/True/true or 0/False/false, Remove the volumes
associated to the container. Default &lt;code&gt;false&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;force&lt;/strong&gt; - 1/True/true or 0/False/false, Kill then remove the container.
Default &lt;code&gt;false&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;204&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;400&lt;/strong&gt; bad parameter&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;copy-files-or-folders-from-a-container&#34;&gt;Copy files or folders from a container&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /containers/(id)/copy&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Copy files or folders of container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;POST /containers/4fa6e0f0c678/copy HTTP/1.1
Content-Type: application/json
{
&amp;quot;Resource&amp;quot;: &amp;quot;test.txt&amp;quot;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;HTTP/1.1 200 OK
Content-Type: application/x-tar
{{ TAR STREAM }}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;2-2-images&#34;&gt;2.2 Images&lt;/h2&gt;
&lt;h3 id=&#34;list-images&#34;&gt;List Images&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /images/json&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;GET /images/json?all=0 HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;HTTP/1.1 200 OK
Content-Type: application/json
[
{
&amp;quot;RepoTags&amp;quot;: [
&amp;quot;ubuntu:12.04&amp;quot;,
&amp;quot;ubuntu:precise&amp;quot;,
&amp;quot;ubuntu:latest&amp;quot;
],
&amp;quot;Id&amp;quot;: &amp;quot;8dbd9e392a964056420e5d58ca5cc376ef18e2de93b5cc90e868a1bbc8318c1c&amp;quot;,
&amp;quot;Created&amp;quot;: 1365714795,
&amp;quot;Size&amp;quot;: 131506275,
&amp;quot;VirtualSize&amp;quot;: 131506275
},
{
&amp;quot;RepoTags&amp;quot;: [
&amp;quot;ubuntu:12.10&amp;quot;,
&amp;quot;ubuntu:quantal&amp;quot;
],
&amp;quot;ParentId&amp;quot;: &amp;quot;27cf784147099545&amp;quot;,
&amp;quot;Id&amp;quot;: &amp;quot;b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc&amp;quot;,
&amp;quot;Created&amp;quot;: 1364102658,
&amp;quot;Size&amp;quot;: 24653,
&amp;quot;VirtualSize&amp;quot;: 180116135
}
]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example request, with digest information&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;GET /images/json?digests=1 HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response, with digest information&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;HTTP/1.1 200 OK
Content-Type: application/json
[
{
&amp;quot;Created&amp;quot;: 1420064636,
&amp;quot;Id&amp;quot;: &amp;quot;4986bf8c15363d1c5d15512d5266f8777bfba4974ac56e3270e7760f6f0a8125&amp;quot;,
&amp;quot;ParentId&amp;quot;: &amp;quot;ea13149945cb6b1e746bf28032f02e9b5a793523481a0a18645fc77ad53c4ea2&amp;quot;,
&amp;quot;RepoDigests&amp;quot;: [
&amp;quot;localhost:5000/test/busybox@sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf&amp;quot;
],
&amp;quot;RepoTags&amp;quot;: [
&amp;quot;localhost:5000/test/busybox:latest&amp;quot;,
&amp;quot;playdate:latest&amp;quot;
],
&amp;quot;Size&amp;quot;: 0,
&amp;quot;VirtualSize&amp;quot;: 2429728
}
]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The response shows a single image &lt;code&gt;Id&lt;/code&gt; associated with two repositories
(&lt;code&gt;RepoTags&lt;/code&gt;): &lt;code&gt;localhost:5000/test/busybox&lt;/code&gt;: and &lt;code&gt;playdate&lt;/code&gt;. A caller can use
either of the &lt;code&gt;RepoTags&lt;/code&gt; values &lt;code&gt;localhost:5000/test/busybox:latest&lt;/code&gt; or
&lt;code&gt;playdate:latest&lt;/code&gt; to reference the image.&lt;/p&gt;
&lt;p&gt;You can also use &lt;code&gt;RepoDigests&lt;/code&gt; values to reference an image. In this response,
the array has only one reference and that is to the
&lt;code&gt;localhost:5000/test/busybox&lt;/code&gt; repository; the &lt;code&gt;playdate&lt;/code&gt; repository has no
digest. You can reference this digest using the value:
&lt;code&gt;localhost:5000/test/busybox@sha256:cbbf2f9a99b47fc460d...&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;See the &lt;code&gt;docker run&lt;/code&gt; and &lt;code&gt;docker build&lt;/code&gt; commands for examples of digest and tag
references on the command line.&lt;/p&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;all&lt;/strong&gt; 1/True/true or 0/False/false, default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;filters&lt;/strong&gt; a JSON encoded value of the filters (a map[string][]string) to process on the images list. Available filters:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;dangling=true&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;label=key&lt;/code&gt; or &lt;code&gt;key=value&lt;/code&gt; of an image label&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;build-image-from-a-dockerfile&#34;&gt;Build image from a Dockerfile&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /build&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Build an image from a Dockerfile&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;POST /build HTTP/1.1
{{ TAR STREAM }}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;HTTP/1.1 200 OK
Content-Type: application/json
{&amp;quot;stream&amp;quot;: &amp;quot;Step 1...&amp;quot;}
{&amp;quot;stream&amp;quot;: &amp;quot;...&amp;quot;}
{&amp;quot;error&amp;quot;: &amp;quot;Error...&amp;quot;, &amp;quot;errorDetail&amp;quot;: {&amp;quot;code&amp;quot;: 123, &amp;quot;message&amp;quot;: &amp;quot;Error...&amp;quot;}}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The input stream must be a &lt;code&gt;tar&lt;/code&gt; archive compressed with one of the
following algorithms: &lt;code&gt;identity&lt;/code&gt; (no compression), &lt;code&gt;gzip&lt;/code&gt;, &lt;code&gt;bzip2&lt;/code&gt;, &lt;code&gt;xz&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The archive must include a build instructions file, typically called
&lt;code&gt;Dockerfile&lt;/code&gt; at the archive&amp;rsquo;s root. The &lt;code&gt;dockerfile&lt;/code&gt; parameter may be
used to specify a different build instructions file. To do this, its value must be
the path to the alternate build instructions file to use.&lt;/p&gt;
&lt;p&gt;The archive may include any number of other files,
which are accessible in the build context (See the &lt;a href=&#34;http://localhost/docker/reference/builder/#dockerbuilder&#34;&gt;&lt;em&gt;ADD build
command&lt;/em&gt;&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;The build is canceled if the client drops the connection by quitting
or being killed.&lt;/p&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;dockerfile&lt;/strong&gt; - Path within the build context to the Dockerfile. This is
ignored if &lt;code&gt;remote&lt;/code&gt; is specified and points to an individual filename.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;t&lt;/strong&gt; A repository name (and optionally a tag) to apply to
the resulting image in case of success.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;remote&lt;/strong&gt; A Git repository URI or HTTP/HTTPS URI build source. If the
URI specifies a filename, the file&amp;rsquo;s contents are placed into a file
called &lt;code&gt;Dockerfile&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;q&lt;/strong&gt; Suppress verbose build output.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;nocache&lt;/strong&gt; Do not use the cache when building the image.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;pull&lt;/strong&gt; - Attempt to pull the image even if an older image exists locally.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;rm&lt;/strong&gt; - Remove intermediate containers after a successful build (default behavior).&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;forcerm&lt;/strong&gt; - Always remove intermediate containers (includes &lt;code&gt;rm&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;memory&lt;/strong&gt; - Set memory limit for build.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;memswap&lt;/strong&gt; - Total memory (memory + swap), &lt;code&gt;-1&lt;/code&gt; to disable swap.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;cpushares&lt;/strong&gt; - CPU shares (relative weight).&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;cpusetcpus&lt;/strong&gt; - CPUs in which to allow execution (e.g., &lt;code&gt;0-3&lt;/code&gt;, &lt;code&gt;0,1&lt;/code&gt;).&lt;/p&gt;
&lt;p&gt;Request Headers:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Content-type&lt;/strong&gt; Set to &lt;code&gt;&amp;quot;application/tar&amp;quot;&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;X-Registry-Config&lt;/strong&gt; base64-encoded ConfigFile object&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;create-an-image&#34;&gt;Create an image&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /images/create&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Create an image either by pulling it from the registry or by importing it&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;POST /images/create?fromImage=ubuntu HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;HTTP/1.1 200 OK
Content-Type: application/json
{&amp;quot;status&amp;quot;: &amp;quot;Pulling...&amp;quot;}
{&amp;quot;status&amp;quot;: &amp;quot;Pulling&amp;quot;, &amp;quot;progress&amp;quot;: &amp;quot;1 B/ 100 B&amp;quot;, &amp;quot;progressDetail&amp;quot;: {&amp;quot;current&amp;quot;: 1, &amp;quot;total&amp;quot;: 100}}
{&amp;quot;error&amp;quot;: &amp;quot;Invalid...&amp;quot;}
...
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;When using this endpoint to pull an image from the registry, the
&lt;code&gt;X-Registry-Auth&lt;/code&gt; header can be used to include
a base64-encoded AuthConfig object.&lt;/p&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;fromImage&lt;/strong&gt; Name of the image to pull.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;fromSrc&lt;/strong&gt; Source to import. The value may be a URL from which the image
can be retrieved or &lt;code&gt;-&lt;/code&gt; to read the image from the request body.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;repo&lt;/strong&gt; Repository name.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;tag&lt;/strong&gt; Tag.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;registry&lt;/strong&gt; The registry to pull from.&lt;/p&gt;
&lt;p&gt;Request Headers:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;X-Registry-Auth&lt;/strong&gt; base64-encoded AuthConfig object&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;inspect-an-image&#34;&gt;Inspect an image&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /images/(name)/json&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Return low-level information on the image &lt;code&gt;name&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;GET /images/ubuntu/json HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;HTTP/1.1 200 OK
Content-Type: application/json
{
&amp;quot;Created&amp;quot;: &amp;quot;2013-03-23T22:24:18.818426-07:00&amp;quot;,
&amp;quot;Container&amp;quot;: &amp;quot;3d67245a8d72ecf13f33dffac9f79dcdf70f75acb84d308770391510e0c23ad0&amp;quot;,
&amp;quot;ContainerConfig&amp;quot;:
{
&amp;quot;Hostname&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;User&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;AttachStdin&amp;quot;: false,
&amp;quot;AttachStdout&amp;quot;: false,
&amp;quot;AttachStderr&amp;quot;: false,
&amp;quot;PortSpecs&amp;quot;: null,
&amp;quot;Tty&amp;quot;: true,
&amp;quot;OpenStdin&amp;quot;: true,
&amp;quot;StdinOnce&amp;quot;: false,
&amp;quot;Env&amp;quot;: null,
&amp;quot;Cmd&amp;quot;: [&amp;quot;/bin/bash&amp;quot;],
&amp;quot;Dns&amp;quot;: null,
&amp;quot;Image&amp;quot;: &amp;quot;ubuntu&amp;quot;,
&amp;quot;Labels&amp;quot;: {
&amp;quot;com.example.vendor&amp;quot;: &amp;quot;Acme&amp;quot;,
&amp;quot;com.example.license&amp;quot;: &amp;quot;GPL&amp;quot;,
&amp;quot;com.example.version&amp;quot;: &amp;quot;1.0&amp;quot;
},
&amp;quot;Volumes&amp;quot;: null,
&amp;quot;VolumesFrom&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;WorkingDir&amp;quot;: &amp;quot;&amp;quot;
},
&amp;quot;Id&amp;quot;: &amp;quot;b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc&amp;quot;,
&amp;quot;Parent&amp;quot;: &amp;quot;27cf784147099545&amp;quot;,
&amp;quot;Size&amp;quot;: 6824592
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such image&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;get-the-history-of-an-image&#34;&gt;Get the history of an image&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /images/(name)/history&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Return the history of the image &lt;code&gt;name&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;GET /images/ubuntu/history HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;HTTP/1.1 200 OK
Content-Type: application/json
[
{
&amp;quot;Id&amp;quot;: &amp;quot;b750fe79269d&amp;quot;,
&amp;quot;Created&amp;quot;: 1364102658,
&amp;quot;CreatedBy&amp;quot;: &amp;quot;/bin/bash&amp;quot;
},
{
&amp;quot;Id&amp;quot;: &amp;quot;27cf78414709&amp;quot;,
&amp;quot;Created&amp;quot;: 1364068391,
&amp;quot;CreatedBy&amp;quot;: &amp;quot;&amp;quot;
}
]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such image&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;push-an-image-on-the-registry&#34;&gt;Push an image on the registry&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /images/(name)/push&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Push the image &lt;code&gt;name&lt;/code&gt; on the registry&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;POST /images/test/push HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;HTTP/1.1 200 OK
Content-Type: application/json
{&amp;quot;status&amp;quot;: &amp;quot;Pushing...&amp;quot;}
{&amp;quot;status&amp;quot;: &amp;quot;Pushing&amp;quot;, &amp;quot;progress&amp;quot;: &amp;quot;1/? (n/a)&amp;quot;, &amp;quot;progressDetail&amp;quot;: {&amp;quot;current&amp;quot;: 1}}}
{&amp;quot;error&amp;quot;: &amp;quot;Invalid...&amp;quot;}
...
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If you wish to push an image on to a private registry, that image must already have a tag
into a repository which references that registry &lt;code&gt;hostname&lt;/code&gt; and &lt;code&gt;port&lt;/code&gt;. This repository name should
then be used in the URL. This duplicates the command line&amp;rsquo;s flow.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;POST /images/registry.acme.com:5000/test/push HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;tag&lt;/strong&gt; The tag to associate with the image on the registry. This is optional.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Request Headers:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;X-Registry-Auth&lt;/strong&gt; Include a base64-encoded AuthConfig.
object.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such image&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;tag-an-image-into-a-repository&#34;&gt;Tag an image into a repository&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /images/(name)/tag&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Tag the image &lt;code&gt;name&lt;/code&gt; into a repository&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;POST /images/test/tag?repo=myrepo&amp;amp;force=0&amp;amp;tag=v42 HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;HTTP/1.1 201 OK
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;repo&lt;/strong&gt; The repository to tag in&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;force&lt;/strong&gt; 1/True/true or 0/False/false, default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;tag&lt;/strong&gt; - The new tag name&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;201&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;400&lt;/strong&gt; bad parameter&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such image&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;409&lt;/strong&gt; conflict&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;remove-an-image&#34;&gt;Remove an image&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;DELETE /images/(name)&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Remove the image &lt;code&gt;name&lt;/code&gt; from the filesystem&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;DELETE /images/test HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;HTTP/1.1 200 OK
Content-type: application/json
[
{&amp;quot;Untagged&amp;quot;: &amp;quot;3e2f21a89f&amp;quot;},
{&amp;quot;Deleted&amp;quot;: &amp;quot;3e2f21a89f&amp;quot;},
{&amp;quot;Deleted&amp;quot;: &amp;quot;53b4f83ac9&amp;quot;}
]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;force&lt;/strong&gt; 1/True/true or 0/False/false, default false&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;noprune&lt;/strong&gt; 1/True/true or 0/False/false, default false&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such image&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;409&lt;/strong&gt; conflict&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;search-images&#34;&gt;Search images&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /images/search&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Search for an image on &lt;a href=&#34;https://hub.docker.com&#34;&gt;Docker Hub&lt;/a&gt;.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;:
The response keys have changed from API v1.6 to reflect the JSON
sent by the registry server to the docker daemon&amp;rsquo;s request.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;GET /images/search?term=sshd HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;HTTP/1.1 200 OK
Content-Type: application/json
[
{
&amp;quot;description&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;is_official&amp;quot;: false,
&amp;quot;is_automated&amp;quot;: false,
&amp;quot;name&amp;quot;: &amp;quot;wma55/u1210sshd&amp;quot;,
&amp;quot;star_count&amp;quot;: 0
},
{
&amp;quot;description&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;is_official&amp;quot;: false,
&amp;quot;is_automated&amp;quot;: false,
&amp;quot;name&amp;quot;: &amp;quot;jdswinbank/sshd&amp;quot;,
&amp;quot;star_count&amp;quot;: 0
},
{
&amp;quot;description&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;is_official&amp;quot;: false,
&amp;quot;is_automated&amp;quot;: false,
&amp;quot;name&amp;quot;: &amp;quot;vgauthier/sshd&amp;quot;,
&amp;quot;star_count&amp;quot;: 0
}
...
]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;term&lt;/strong&gt; term to search&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;2-3-misc&#34;&gt;2.3 Misc&lt;/h2&gt;
&lt;h3 id=&#34;check-auth-configuration&#34;&gt;Check auth configuration&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /auth&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Get the default username and email&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;POST /auth HTTP/1.1
Content-Type: application/json
{
&amp;quot;username&amp;quot;:&amp;quot; hannibal&amp;quot;,
&amp;quot;password: &amp;quot;xxxx&amp;quot;,
&amp;quot;email&amp;quot;: &amp;quot;hannibal@a-team.com&amp;quot;,
&amp;quot;serveraddress&amp;quot;: &amp;quot;https://index.docker.io/v1/&amp;quot;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;HTTP/1.1 200 OK
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;204&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;display-system-wide-information&#34;&gt;Display system-wide information&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /info&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Display system-wide information&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;GET /info HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;HTTP/1.1 200 OK
Content-Type: application/json
{
&amp;quot;Containers&amp;quot;: 11,
&amp;quot;CpuCfsPeriod&amp;quot;: true,
&amp;quot;CpuCfsQuota&amp;quot;: true,
&amp;quot;Debug&amp;quot;: false,
&amp;quot;DockerRootDir&amp;quot;: &amp;quot;/var/lib/docker&amp;quot;,
&amp;quot;Driver&amp;quot;: &amp;quot;btrfs&amp;quot;,
&amp;quot;DriverStatus&amp;quot;: [[&amp;quot;&amp;quot;]],
&amp;quot;ExecutionDriver&amp;quot;: &amp;quot;native-0.1&amp;quot;,
&amp;quot;ExperimentalBuild&amp;quot;: false,
&amp;quot;HttpProxy&amp;quot;: &amp;quot;http://test:test@localhost:8080&amp;quot;,
&amp;quot;HttpsProxy&amp;quot;: &amp;quot;https://test:test@localhost:8080&amp;quot;,
&amp;quot;ID&amp;quot;: &amp;quot;7TRN:IPZB:QYBB:VPBQ:UMPP:KARE:6ZNR:XE6T:7EWV:PKF4:ZOJD:TPYS&amp;quot;,
&amp;quot;IPv4Forwarding&amp;quot;: true,
&amp;quot;Images&amp;quot;: 16,
&amp;quot;IndexServerAddress&amp;quot;: &amp;quot;https://index.docker.io/v1/&amp;quot;,
&amp;quot;InitPath&amp;quot;: &amp;quot;/usr/bin/docker&amp;quot;,
&amp;quot;InitSha1&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;KernelVersion&amp;quot;: &amp;quot;3.12.0-1-amd64&amp;quot;,
&amp;quot;Labels&amp;quot;: [
&amp;quot;storage=ssd&amp;quot;
],
&amp;quot;MemTotal&amp;quot;: 2099236864,
&amp;quot;MemoryLimit&amp;quot;: true,
&amp;quot;NCPU&amp;quot;: 1,
&amp;quot;NEventsListener&amp;quot;: 0,
&amp;quot;NFd&amp;quot;: 11,
&amp;quot;NGoroutines&amp;quot;: 21,
&amp;quot;Name&amp;quot;: &amp;quot;prod-server-42&amp;quot;,
&amp;quot;NoProxy&amp;quot;: &amp;quot;9.81.1.160&amp;quot;,
&amp;quot;OomKillDisable&amp;quot;: true,
&amp;quot;OperatingSystem&amp;quot;: &amp;quot;Boot2Docker&amp;quot;,
&amp;quot;RegistryConfig&amp;quot;: {
&amp;quot;IndexConfigs&amp;quot;: {
&amp;quot;docker.io&amp;quot;: {
&amp;quot;Mirrors&amp;quot;: null,
&amp;quot;Name&amp;quot;: &amp;quot;docker.io&amp;quot;,
&amp;quot;Official&amp;quot;: true,
&amp;quot;Secure&amp;quot;: true
}
},
&amp;quot;InsecureRegistryCIDRs&amp;quot;: [
&amp;quot;127.0.0.0/8&amp;quot;
]
},
&amp;quot;SwapLimit&amp;quot;: false,
&amp;quot;SystemTime&amp;quot;: &amp;quot;2015-03-10T11:11:23.730591467-07:00&amp;quot;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;show-the-docker-version-information&#34;&gt;Show the docker version information&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /version&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Show the docker version information&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;GET /version HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;HTTP/1.1 200 OK
Content-Type: application/json
{
&amp;quot;Version&amp;quot;: &amp;quot;1.5.0&amp;quot;,
&amp;quot;Os&amp;quot;: &amp;quot;linux&amp;quot;,
&amp;quot;KernelVersion&amp;quot;: &amp;quot;3.18.5-tinycore64&amp;quot;,
&amp;quot;GoVersion&amp;quot;: &amp;quot;go1.4.1&amp;quot;,
&amp;quot;GitCommit&amp;quot;: &amp;quot;a8a31ef&amp;quot;,
&amp;quot;Arch&amp;quot;: &amp;quot;amd64&amp;quot;,
&amp;quot;ApiVersion&amp;quot;: &amp;quot;1.19&amp;quot;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;ping-the-docker-server&#34;&gt;Ping the docker server&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /_ping&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Ping the docker server&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;GET /_ping HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;HTTP/1.1 200 OK
Content-Type: text/plain
OK
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; - no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; - server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;create-a-new-image-from-a-container-s-changes&#34;&gt;Create a new image from a container&amp;rsquo;s changes&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /commit&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Create a new image from a container&amp;rsquo;s changes&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;POST /commit?container=44c004db4b17&amp;amp;comment=message&amp;amp;repo=myrepo HTTP/1.1
Content-Type: application/json
{
&amp;quot;Hostname&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;Domainname&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;User&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;AttachStdin&amp;quot;: false,
&amp;quot;AttachStdout&amp;quot;: true,
&amp;quot;AttachStderr&amp;quot;: true,
&amp;quot;PortSpecs&amp;quot;: null,
&amp;quot;Tty&amp;quot;: false,
&amp;quot;OpenStdin&amp;quot;: false,
&amp;quot;StdinOnce&amp;quot;: false,
&amp;quot;Env&amp;quot;: null,
&amp;quot;Cmd&amp;quot;: [
&amp;quot;date&amp;quot;
],
&amp;quot;Volumes&amp;quot;: {
&amp;quot;/tmp&amp;quot;: {}
},
&amp;quot;WorkingDir&amp;quot;: &amp;quot;&amp;quot;,
&amp;quot;NetworkDisabled&amp;quot;: false,
&amp;quot;ExposedPorts&amp;quot;: {
&amp;quot;22/tcp&amp;quot;: {}
}
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;HTTP/1.1 201 Created
Content-Type: application/vnd.docker.raw-stream
{&amp;quot;Id&amp;quot;: &amp;quot;596069db4bf5&amp;quot;}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Json Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;config&lt;/strong&gt; - the container&amp;rsquo;s configuration&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;container&lt;/strong&gt; source container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;repo&lt;/strong&gt; repository&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;tag&lt;/strong&gt; tag&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;comment&lt;/strong&gt; commit message&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;author&lt;/strong&gt; author (e.g., &amp;ldquo;John Hannibal Smith
&amp;lt;&lt;a href=&#34;mailto:hannibal%40a-team.com&#34;&gt;hannibal@a-team.com&lt;/a&gt;&amp;gt;&amp;ldquo;)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;201&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;monitor-docker-s-events&#34;&gt;Monitor Docker&amp;rsquo;s events&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /events&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Get container events from docker, either in real time via streaming, or via
polling (using since).&lt;/p&gt;
&lt;p&gt;Docker containers report the following events:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;create, destroy, die, exec_create, exec_start, export, kill, oom, pause, restart, start, stop, unpause
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;and Docker images report:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;untag, delete
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;GET /events?since=1374067924
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;HTTP/1.1 200 OK
Content-Type: application/json
{&amp;quot;status&amp;quot;: &amp;quot;create&amp;quot;, &amp;quot;id&amp;quot;: &amp;quot;dfdf82bd3881&amp;quot;,&amp;quot;from&amp;quot;: &amp;quot;ubuntu:latest&amp;quot;, &amp;quot;time&amp;quot;:1374067924}
{&amp;quot;status&amp;quot;: &amp;quot;start&amp;quot;, &amp;quot;id&amp;quot;: &amp;quot;dfdf82bd3881&amp;quot;,&amp;quot;from&amp;quot;: &amp;quot;ubuntu:latest&amp;quot;, &amp;quot;time&amp;quot;:1374067924}
{&amp;quot;status&amp;quot;: &amp;quot;stop&amp;quot;, &amp;quot;id&amp;quot;: &amp;quot;dfdf82bd3881&amp;quot;,&amp;quot;from&amp;quot;: &amp;quot;ubuntu:latest&amp;quot;, &amp;quot;time&amp;quot;:1374067966}
{&amp;quot;status&amp;quot;: &amp;quot;destroy&amp;quot;, &amp;quot;id&amp;quot;: &amp;quot;dfdf82bd3881&amp;quot;,&amp;quot;from&amp;quot;: &amp;quot;ubuntu:latest&amp;quot;, &amp;quot;time&amp;quot;:1374067970}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;since&lt;/strong&gt; Timestamp used for polling&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;until&lt;/strong&gt; Timestamp used for polling&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;filters&lt;/strong&gt; A json encoded value of the filters (a map[string][]string) to process on the event list. Available filters:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;event=&amp;lt;string&amp;gt;&lt;/code&gt;; &amp;ndash; event to filter&lt;/li&gt;
&lt;li&gt;&lt;code&gt;image=&amp;lt;string&amp;gt;&lt;/code&gt;; &amp;ndash; image to filter&lt;/li&gt;
&lt;li&gt;&lt;code&gt;container=&amp;lt;string&amp;gt;&lt;/code&gt;; &amp;ndash; container to filter&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;get-a-tarball-containing-all-images-in-a-repository&#34;&gt;Get a tarball containing all images in a repository&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /images/(name)/get&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Get a tarball containing all images and metadata for the repository specified
by &lt;code&gt;name&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;If &lt;code&gt;name&lt;/code&gt; is a specific name and tag (e.g. ubuntu:latest), then only that image
(and its parents) are returned. If &lt;code&gt;name&lt;/code&gt; is an image ID, similarly only that
image (and its parents) are returned, but with the exclusion of the
&amp;lsquo;repositories&amp;rsquo; file in the tarball, as there were no image names referenced.&lt;/p&gt;
&lt;p&gt;See the &lt;a href=&#34;#image-tarball-format&#34;&gt;image tarball format&lt;/a&gt; for more details.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;GET /images/ubuntu/get
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;HTTP/1.1 200 OK
Content-Type: application/x-tar
Binary data stream
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;get-a-tarball-containing-all-images&#34;&gt;Get a tarball containing all images.&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /images/get&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Get a tarball containing all images and metadata for one or more repositories.&lt;/p&gt;
&lt;p&gt;For each value of the &lt;code&gt;names&lt;/code&gt; parameter: if it is a specific name and tag (e.g.
&lt;code&gt;ubuntu:latest&lt;/code&gt;), then only that image (and its parents) are returned; if it is
an image ID, similarly only that image (and its parents) are returned and there
would be no names referenced in the &amp;lsquo;repositories&amp;rsquo; file for this image ID.&lt;/p&gt;
&lt;p&gt;See the &lt;a href=&#34;#image-tarball-format&#34;&gt;image tarball format&lt;/a&gt; for more details.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;GET /images/get?names=myname%2Fmyapp%3Alatest&amp;amp;names=busybox
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;HTTP/1.1 200 OK
Content-Type: application/x-tar
Binary data stream
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;load-a-tarball-with-a-set-of-images-and-tags-into-docker&#34;&gt;Load a tarball with a set of images and tags into docker&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /images/load&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Load a set of images and tags into a Docker repository.
See the &lt;a href=&#34;#image-tarball-format&#34;&gt;image tarball format&lt;/a&gt; for more details.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;POST /images/load
Tarball in body
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;HTTP/1.1 200 OK
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;image-tarball-format&#34;&gt;Image tarball format&lt;/h3&gt;
&lt;p&gt;An image tarball contains one directory per image layer (named using its long ID),
each containing these files:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;VERSION&lt;/code&gt;: currently &lt;code&gt;1.0&lt;/code&gt; - the file format version&lt;/li&gt;
&lt;li&gt;&lt;code&gt;json&lt;/code&gt;: detailed layer information, similar to &lt;code&gt;docker inspect layer_id&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;layer.tar&lt;/code&gt;: A tarfile containing the filesystem changes in this layer&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The &lt;code&gt;layer.tar&lt;/code&gt; file contains &lt;code&gt;aufs&lt;/code&gt; style &lt;code&gt;.wh..wh.aufs&lt;/code&gt; files and directories
for storing attribute changes and deletions.&lt;/p&gt;
&lt;p&gt;If the tarball defines a repository, the tarball should also include a &lt;code&gt;repositories&lt;/code&gt; file at
the root that contains a list of repository and tag names mapped to layer IDs.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;{&amp;quot;hello-world&amp;quot;:
{&amp;quot;latest&amp;quot;: &amp;quot;565a9d68a73f6706862bfe8409a7f659776d4d60a8d096eb4a3cbce6999cc2a1&amp;quot;}
}
&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&#34;exec-create&#34;&gt;Exec Create&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /containers/(id)/exec&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Sets up an exec instance in a running container &lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;POST /containers/e90e34656806/exec HTTP/1.1
Content-Type: application/json
{
&amp;quot;AttachStdin&amp;quot;: false,
&amp;quot;AttachStdout&amp;quot;: true,
&amp;quot;AttachStderr&amp;quot;: true,
&amp;quot;Tty&amp;quot;: false,
&amp;quot;Cmd&amp;quot;: [
&amp;quot;date&amp;quot;
],
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;HTTP/1.1 201 OK
Content-Type: application/json
{
&amp;quot;Id&amp;quot;: &amp;quot;f90e34656806&amp;quot;
&amp;quot;Warnings&amp;quot;:[]
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Json Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;AttachStdin&lt;/strong&gt; - Boolean value, attaches to &lt;code&gt;stdin&lt;/code&gt; of the &lt;code&gt;exec&lt;/code&gt; command.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;AttachStdout&lt;/strong&gt; - Boolean value, attaches to &lt;code&gt;stdout&lt;/code&gt; of the &lt;code&gt;exec&lt;/code&gt; command.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;AttachStderr&lt;/strong&gt; - Boolean value, attaches to &lt;code&gt;stderr&lt;/code&gt; of the &lt;code&gt;exec&lt;/code&gt; command.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Tty&lt;/strong&gt; - Boolean value to allocate a pseudo-TTY.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Cmd&lt;/strong&gt; - Command to run specified as a string or an array of strings.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;201&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such container&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;exec-start&#34;&gt;Exec Start&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /exec/(id)/start&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Starts a previously set up &lt;code&gt;exec&lt;/code&gt; instance &lt;code&gt;id&lt;/code&gt;. If &lt;code&gt;detach&lt;/code&gt; is true, this API
returns after starting the &lt;code&gt;exec&lt;/code&gt; command. Otherwise, this API sets up an
interactive session with the &lt;code&gt;exec&lt;/code&gt; command.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;POST /exec/e90e34656806/start HTTP/1.1
Content-Type: application/json
{
&amp;quot;Detach&amp;quot;: false,
&amp;quot;Tty&amp;quot;: false,
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;HTTP/1.1 201 OK
Content-Type: application/json
{{ STREAM }}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Json Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Detach&lt;/strong&gt; - Detach from the &lt;code&gt;exec&lt;/code&gt; command.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Tty&lt;/strong&gt; - Boolean value to allocate a pseudo-TTY.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;201&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;404&lt;/strong&gt; no such exec instance&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Stream details&lt;/strong&gt;:
Similar to the stream behavior of &lt;code&gt;POST /container/(id)/attach&lt;/code&gt; API&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;exec-resize&#34;&gt;Exec Resize&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;POST /exec/(id)/resize&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Resizes the &lt;code&gt;tty&lt;/code&gt; session used by the &lt;code&gt;exec&lt;/code&gt; command &lt;code&gt;id&lt;/code&gt;.
This API is valid only if &lt;code&gt;tty&lt;/code&gt; was specified as part of creating and starting the &lt;code&gt;exec&lt;/code&gt; command.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;POST /exec/e90e34656806/resize HTTP/1.1
Content-Type: text/plain
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;HTTP/1.1 201 OK
Content-Type: text/plain
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Query Parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;h&lt;/strong&gt; height of &lt;code&gt;tty&lt;/code&gt; session&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;w&lt;/strong&gt; width&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;201&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such exec instance&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;exec-inspect&#34;&gt;Exec Inspect&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;GET /exec/(id)/json&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Return low-level information about the &lt;code&gt;exec&lt;/code&gt; command &lt;code&gt;id&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example request&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;GET /exec/11fb006128e8ceb3942e7c58d77750f24210e35f879dd204ac975c184b820b39/json HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Example response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;HTTP/1.1 200 OK
Content-Type: plain/text
{
&amp;quot;ID&amp;quot; : &amp;quot;11fb006128e8ceb3942e7c58d77750f24210e35f879dd204ac975c184b820b39&amp;quot;,
&amp;quot;Running&amp;quot; : false,
&amp;quot;ExitCode&amp;quot; : 2,
&amp;quot;ProcessConfig&amp;quot; : {
&amp;quot;privileged&amp;quot; : false,
&amp;quot;user&amp;quot; : &amp;quot;&amp;quot;,
&amp;quot;tty&amp;quot; : false,
&amp;quot;entrypoint&amp;quot; : &amp;quot;sh&amp;quot;,
&amp;quot;arguments&amp;quot; : [
&amp;quot;-c&amp;quot;,
&amp;quot;exit 2&amp;quot;
]
},
&amp;quot;OpenStdin&amp;quot; : false,
&amp;quot;OpenStderr&amp;quot; : false,
&amp;quot;OpenStdout&amp;quot; : false,
&amp;quot;Container&amp;quot; : {
&amp;quot;State&amp;quot; : {
&amp;quot;Running&amp;quot; : true,
&amp;quot;Paused&amp;quot; : false,
&amp;quot;Restarting&amp;quot; : false,
&amp;quot;OOMKilled&amp;quot; : false,
&amp;quot;Pid&amp;quot; : 3650,
&amp;quot;ExitCode&amp;quot; : 0,
&amp;quot;Error&amp;quot; : &amp;quot;&amp;quot;,
&amp;quot;StartedAt&amp;quot; : &amp;quot;2014-11-17T22:26:03.717657531Z&amp;quot;,
&amp;quot;FinishedAt&amp;quot; : &amp;quot;0001-01-01T00:00:00Z&amp;quot;
},
&amp;quot;ID&amp;quot; : &amp;quot;8f177a186b977fb451136e0fdf182abff5599a08b3c7f6ef0d36a55aaf89634c&amp;quot;,
&amp;quot;Created&amp;quot; : &amp;quot;2014-11-17T22:26:03.626304998Z&amp;quot;,
&amp;quot;Path&amp;quot; : &amp;quot;date&amp;quot;,
&amp;quot;Args&amp;quot; : [],
&amp;quot;Config&amp;quot; : {
&amp;quot;Hostname&amp;quot; : &amp;quot;8f177a186b97&amp;quot;,
&amp;quot;Domainname&amp;quot; : &amp;quot;&amp;quot;,
&amp;quot;User&amp;quot; : &amp;quot;&amp;quot;,
&amp;quot;AttachStdin&amp;quot; : false,
&amp;quot;AttachStdout&amp;quot; : false,
&amp;quot;AttachStderr&amp;quot; : false,
&amp;quot;PortSpecs&amp;quot; : null,
&amp;quot;ExposedPorts&amp;quot; : null,
&amp;quot;Tty&amp;quot; : false,
&amp;quot;OpenStdin&amp;quot; : false,
&amp;quot;StdinOnce&amp;quot; : false,
&amp;quot;Env&amp;quot; : [ &amp;quot;PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin&amp;quot; ],
&amp;quot;Cmd&amp;quot; : [
&amp;quot;date&amp;quot;
],
&amp;quot;Image&amp;quot; : &amp;quot;ubuntu&amp;quot;,
&amp;quot;Volumes&amp;quot; : null,
&amp;quot;WorkingDir&amp;quot; : &amp;quot;&amp;quot;,
&amp;quot;Entrypoint&amp;quot; : null,
&amp;quot;NetworkDisabled&amp;quot; : false,
&amp;quot;MacAddress&amp;quot; : &amp;quot;&amp;quot;,
&amp;quot;OnBuild&amp;quot; : null,
&amp;quot;SecurityOpt&amp;quot; : null
},
&amp;quot;Image&amp;quot; : &amp;quot;5506de2b643be1e6febbf3b8a240760c6843244c41e12aa2f60ccbb7153d17f5&amp;quot;,
&amp;quot;NetworkSettings&amp;quot; : {
&amp;quot;IPAddress&amp;quot; : &amp;quot;172.17.0.2&amp;quot;,
&amp;quot;IPPrefixLen&amp;quot; : 16,
&amp;quot;MacAddress&amp;quot; : &amp;quot;02:42:ac:11:00:02&amp;quot;,
&amp;quot;Gateway&amp;quot; : &amp;quot;172.17.42.1&amp;quot;,
&amp;quot;Bridge&amp;quot; : &amp;quot;docker0&amp;quot;,
&amp;quot;PortMapping&amp;quot; : null,
&amp;quot;Ports&amp;quot; : {}
},
&amp;quot;ResolvConfPath&amp;quot; : &amp;quot;/var/lib/docker/containers/8f177a186b977fb451136e0fdf182abff5599a08b3c7f6ef0d36a55aaf89634c/resolv.conf&amp;quot;,
&amp;quot;HostnamePath&amp;quot; : &amp;quot;/var/lib/docker/containers/8f177a186b977fb451136e0fdf182abff5599a08b3c7f6ef0d36a55aaf89634c/hostname&amp;quot;,
&amp;quot;HostsPath&amp;quot; : &amp;quot;/var/lib/docker/containers/8f177a186b977fb451136e0fdf182abff5599a08b3c7f6ef0d36a55aaf89634c/hosts&amp;quot;,
&amp;quot;LogPath&amp;quot;: &amp;quot;/var/lib/docker/containers/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b-json.log&amp;quot;,
&amp;quot;Name&amp;quot; : &amp;quot;/test&amp;quot;,
&amp;quot;Driver&amp;quot; : &amp;quot;aufs&amp;quot;,
&amp;quot;ExecDriver&amp;quot; : &amp;quot;native-0.2&amp;quot;,
&amp;quot;MountLabel&amp;quot; : &amp;quot;&amp;quot;,
&amp;quot;ProcessLabel&amp;quot; : &amp;quot;&amp;quot;,
&amp;quot;AppArmorProfile&amp;quot; : &amp;quot;&amp;quot;,
&amp;quot;RestartCount&amp;quot; : 0,
&amp;quot;Volumes&amp;quot; : {},
&amp;quot;VolumesRW&amp;quot; : {}
}
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Status Codes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;200&lt;/strong&gt; no error&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;404&lt;/strong&gt; no such exec instance&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;500&lt;/strong&gt; - server error&lt;/li&gt;
&lt;/ul&gt;
&lt;h1 id=&#34;3-going-further&#34;&gt;3. Going further&lt;/h1&gt;
&lt;h2 id=&#34;3-1-inside-docker-run&#34;&gt;3.1 Inside &lt;code&gt;docker run&lt;/code&gt;&lt;/h2&gt;
&lt;p&gt;As an example, the &lt;code&gt;docker run&lt;/code&gt; command line makes the following API calls:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Create the container&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If the status code is 404, it means the image doesn&amp;rsquo;t exist:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Try to pull it.&lt;/li&gt;
&lt;li&gt;Then, retry to create the container.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Start the container.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If you are not in detached mode:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Attach to the container, using &lt;code&gt;logs=1&lt;/code&gt; (to have &lt;code&gt;stdout&lt;/code&gt; and
&lt;code&gt;stderr&lt;/code&gt; from the container&amp;rsquo;s start) and &lt;code&gt;stream=1&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If in detached mode or only &lt;code&gt;stdin&lt;/code&gt; is attached, display the container&amp;rsquo;s id.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;3-2-hijacking&#34;&gt;3.2 Hijacking&lt;/h2&gt;
&lt;p&gt;In this version of the API, &lt;code&gt;/attach&lt;/code&gt;, uses hijacking to transport &lt;code&gt;stdin&lt;/code&gt;,
&lt;code&gt;stdout&lt;/code&gt;, and &lt;code&gt;stderr&lt;/code&gt; on the same socket.&lt;/p&gt;
&lt;p&gt;To hint potential proxies about connection hijacking, Docker client sends
connection upgrade headers similarly to websocket.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Upgrade: tcp
Connection: Upgrade
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;When Docker daemon detects the &lt;code&gt;Upgrade&lt;/code&gt; header, it switches its status code
from &lt;strong&gt;200 OK&lt;/strong&gt; to &lt;strong&gt;101 UPGRADED&lt;/strong&gt; and resends the same headers.&lt;/p&gt;
&lt;h2 id=&#34;3-3-cors-requests&#34;&gt;3.3 CORS Requests&lt;/h2&gt;
&lt;p&gt;To set cross origin requests to the remote api please give values to
&lt;code&gt;--api-cors-header&lt;/code&gt; when running Docker in daemon mode. Set * (asterisk) allows all,
default or blank means CORS disabled&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ docker -d -H=&amp;quot;192.168.1.9:2375&amp;quot; --api-cors-header=&amp;quot;http://foo.bar&amp;quot;
&lt;/code&gt;&lt;/pre&gt;
</description>
</item>
<item>
<title>The Docker Hub and the Registry v1</title>
<link>http://localhost/reference/api/hub_registry_spec/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>http://localhost/reference/api/hub_registry_spec/</guid>
<description>
&lt;h1 id=&#34;the-docker-hub-and-the-registry-v1&#34;&gt;The Docker Hub and the Registry v1&lt;/h1&gt;
&lt;h2 id=&#34;the-three-roles&#34;&gt;The three roles&lt;/h2&gt;
&lt;p&gt;There are three major components playing a role in the Docker ecosystem.&lt;/p&gt;
&lt;h3 id=&#34;docker-hub&#34;&gt;Docker Hub&lt;/h3&gt;
&lt;p&gt;The Docker Hub is responsible for centralizing information about:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;User accounts&lt;/li&gt;
&lt;li&gt;Checksums of the images&lt;/li&gt;
&lt;li&gt;Public namespaces&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The Docker Hub has different components:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Web UI&lt;/li&gt;
&lt;li&gt;Meta-data store (comments, stars, list public repositories)&lt;/li&gt;
&lt;li&gt;Authentication service&lt;/li&gt;
&lt;li&gt;Tokenization&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The Docker Hub is authoritative for that information.&lt;/p&gt;
&lt;p&gt;There is only one instance of the Docker Hub, run and
managed by Docker Inc.&lt;/p&gt;
&lt;h3 id=&#34;docker-registry-1-0&#34;&gt;Docker Registry 1.0&lt;/h3&gt;
&lt;p&gt;The 1.0 registry has the following characteristics:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;It stores the images and the graph for a set of repositories&lt;/li&gt;
&lt;li&gt;It does not have user accounts data&lt;/li&gt;
&lt;li&gt;It has no notion of user accounts or authorization&lt;/li&gt;
&lt;li&gt;It delegates authentication and authorization to the Docker Hub Auth
service using tokens&lt;/li&gt;
&lt;li&gt;It supports different storage backends (S3, cloud files, local FS)&lt;/li&gt;
&lt;li&gt;It doesn&amp;rsquo;t have a local database&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/docker/docker-registry&#34;&gt;Source Code&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;We expect that there will be multiple registries out there. To help you
grasp the context, here are some examples of registries:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;sponsor registry&lt;/strong&gt;: such a registry is provided by a third-party
hosting infrastructure as a convenience for their customers and the
Docker community as a whole. Its costs are supported by the third
party, but the management and operation of the registry are
supported by Docker, Inc. It features read/write access, and delegates
authentication and authorization to the Docker Hub.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;mirror registry&lt;/strong&gt;: such a registry is provided by a third-party
hosting infrastructure but is targeted at their customers only. Some
mechanism (unspecified to date) ensures that public images are
pulled from a sponsor registry to the mirror registry, to make sure
that the customers of the third-party provider can &lt;code&gt;docker pull&lt;/code&gt;
those images locally.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;vendor registry&lt;/strong&gt;: such a registry is provided by a software
vendor who wants to distribute docker images. It would be operated
and managed by the vendor. Only users authorized by the vendor would
be able to get write access. Some images would be public (accessible
for anyone), others private (accessible only for authorized users).
Authentication and authorization would be delegated to the Docker Hub.
The goal of vendor registries is to let someone do &lt;code&gt;docker pull
basho/riak1.3&lt;/code&gt; and automatically push from the vendor registry
(instead of a sponsor registry); i.e., vendors get all the convenience of a
sponsor registry, while retaining control on the asset distribution.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;private registry&lt;/strong&gt;: such a registry is located behind a firewall,
or protected by an additional security layer (HTTP authorization,
SSL client-side certificates, IP address authorization&amp;hellip;). The
registry is operated by a private entity, outside of Docker&amp;rsquo;s
control. It can optionally delegate additional authorization to the
Docker Hub, but it is not mandatory.&lt;/li&gt;
&lt;/ul&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; The latter implies that while HTTP is the protocol
of choice for a registry, multiple schemes are possible (and
in some cases, trivial):&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;HTTP with GET (and PUT for read-write registries);&lt;/li&gt;
&lt;li&gt;local mount point;&lt;/li&gt;
&lt;li&gt;remote docker addressed through SSH.&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;p&gt;The latter would only require two new commands in Docker, e.g.,
&lt;code&gt;registryget&lt;/code&gt; and &lt;code&gt;registryput&lt;/code&gt;,
wrapping access to the local filesystem (and optionally doing
consistency checks). Authentication and authorization are then delegated
to SSH (e.g., with public keys).&lt;/p&gt;
&lt;h3 id=&#34;docker&#34;&gt;Docker&lt;/h3&gt;
&lt;p&gt;On top of being a runtime for LXC, Docker is the Registry client. It
supports:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Push / Pull on the registry&lt;/li&gt;
&lt;li&gt;Client authentication on the Docker Hub&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;workflow&#34;&gt;Workflow&lt;/h2&gt;
&lt;h3 id=&#34;pull&#34;&gt;Pull&lt;/h3&gt;
&lt;p&gt;&lt;img src=&#34;http://localhost/docker/static_files/docker_pull_chart.png&#34; alt=&#34;&#34; /&gt;
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Contact the Docker Hub to know where I should download “samalba/busybox”&lt;/li&gt;
&lt;li&gt;Docker Hub replies: a. &lt;code&gt;samalba/busybox&lt;/code&gt; is on Registry A b. here are the
checksums for &lt;code&gt;samalba/busybox&lt;/code&gt; (for all layers) c. token&lt;/li&gt;
&lt;li&gt;Contact Registry A to receive the layers for &lt;code&gt;samalba/busybox&lt;/code&gt; (all of
them to the base image). Registry A is authoritative for “samalba/busybox”
but keeps a copy of all inherited layers and serve them all from the same
location.&lt;/li&gt;
&lt;li&gt;registry contacts Docker Hub to verify if token/user is allowed to download images&lt;/li&gt;
&lt;li&gt;Docker Hub returns true/false lettings registry know if it should proceed or error
out&lt;/li&gt;
&lt;li&gt;Get the payload for all layers&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;It&amp;rsquo;s possible to run:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ docker pull https://&amp;lt;registry&amp;gt;/repositories/samalba/busybox
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In this case, Docker bypasses the Docker Hub. However the security is not
guaranteed (in case Registry A is corrupted) because there won&amp;rsquo;t be any
checksum checks.&lt;/p&gt;
&lt;p&gt;Currently registry redirects to s3 urls for downloads, going forward all
downloads need to be streamed through the registry. The Registry will
then abstract the calls to S3 by a top-level class which implements
sub-classes for S3 and local storage.&lt;/p&gt;
&lt;p&gt;Token is only returned when the &lt;code&gt;X-Docker-Token&lt;/code&gt;
header is sent with request.&lt;/p&gt;
&lt;p&gt;Basic Auth is required to pull private repos. Basic auth isn&amp;rsquo;t required
for pulling public repos, but if one is provided, it needs to be valid
and for an active account.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;API (pulling repository foo/bar):&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;(Docker -&amp;gt; Docker Hub) GET /v1/repositories/foo/bar/images:&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Headers&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
X-Docker-Token: true
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Action&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; (looking up the foo/bar in db and gets images and checksums
for that repo (all if no tag is specified, if tag, only
checksums for those tags) see part 4.4.1)
&lt;/code&gt;&lt;/pre&gt;
&lt;ol&gt;
&lt;li&gt;(Docker Hub -&amp;gt; Docker) HTTP 200 OK&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Headers&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; Authorization: Token
signature=123abc,repository=”foo/bar”,access=write
X-Docker-Endpoints: registry.docker.io [,registry2.docker.io]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Body&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; Jsonified checksums (see part 4.4.1)
&lt;/code&gt;&lt;/pre&gt;
&lt;ol&gt;
&lt;li&gt;(Docker -&amp;gt; Registry) GET /v1/repositories/foo/bar/tags/latest&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Headers&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; Authorization: Token
signature=123abc,repository=”foo/bar”,access=write
&lt;/code&gt;&lt;/pre&gt;
&lt;ol&gt;
&lt;li&gt;(Registry -&amp;gt; Docker Hub) GET /v1/repositories/foo/bar/images&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Headers&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; Authorization: Token
signature=123abc,repository=”foo/bar”,access=read
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Body&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; &amp;lt;ids and checksums in payload&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Action&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; (Lookup token see if they have access to pull.)
If good:
HTTP 200 OK Docker Hub will invalidate the token
If bad:
HTTP 401 Unauthorized
&lt;/code&gt;&lt;/pre&gt;
&lt;ol&gt;
&lt;li&gt;(Docker -&amp;gt; Registry) GET /v1/images/928374982374/ancestry&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Action&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; (for each image id returned in the registry, fetch /json + /layer)
&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;:
If someone makes a second request, then we will always give a new token,
never reuse tokens.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3 id=&#34;push&#34;&gt;Push&lt;/h3&gt;
&lt;p&gt;&lt;img src=&#34;http://localhost/docker/static_files/docker_push_chart.png&#34; alt=&#34;&#34; /&gt;
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Contact the Docker Hub to allocate the repository name “samalba/busybox”
(authentication required with user credentials)&lt;/li&gt;
&lt;li&gt;If authentication works and namespace available, “samalba/busybox”
is allocated and a temporary token is returned (namespace is marked
as initialized in Docker Hub)&lt;/li&gt;
&lt;li&gt;Push the image on the registry (along with the token)&lt;/li&gt;
&lt;li&gt;Registry A contacts the Docker Hub to verify the token (token must
corresponds to the repository name)&lt;/li&gt;
&lt;li&gt;Docker Hub validates the token. Registry A starts reading the stream
pushed by docker and store the repository (with its images)&lt;/li&gt;
&lt;li&gt;docker contacts the Docker Hub to give checksums for upload images&lt;/li&gt;
&lt;/ol&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt;
&lt;strong&gt;It&amp;rsquo;s possible not to use the Docker Hub at all!&lt;/strong&gt; In this case, a deployed
version of the Registry is deployed to store and serve images. Those
images are not authenticated and the security is not guaranteed.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt;
&lt;strong&gt;Docker Hub can be replaced!&lt;/strong&gt; For a private Registry deployed, a custom
Docker Hub can be used to serve and validate token according to different
policies.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Docker computes the checksums and submit them to the Docker Hub at the end of
the push. When a repository name does not have checksums on the Docker Hub,
it means that the push is in progress (since checksums are submitted at
the end).&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;API (pushing repos foo/bar):&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;(Docker -&amp;gt; Docker Hub) PUT /v1/repositories/foo/bar/&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Headers&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; Authorization: Basic sdkjfskdjfhsdkjfh== X-Docker-Token:
true
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Action&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;in Docker Hub, we allocated a new repository, and set to
initialized&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Body&lt;/strong&gt;:&lt;/p&gt;
&lt;p&gt;(The body contains the list of images that are going to be
pushed, with empty checksums. The checksums will be set at
the end of the push):&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; [{“id”: “9e89cc6f0bc3c38722009fe6857087b486531f9a779a0c17e3ed29dae8f12c4f”}]
&lt;/code&gt;&lt;/pre&gt;
&lt;ol&gt;
&lt;li&gt;(Docker Hub -&amp;gt; Docker) 200 Created&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Headers&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; WWW-Authenticate: Token
signature=123abc,repository=”foo/bar”,access=write
X-Docker-Endpoints: registry.docker.io [, registry2.docker.io]
&lt;/code&gt;&lt;/pre&gt;
&lt;ol&gt;
&lt;li&gt;(Docker -&amp;gt; Registry) PUT /v1/images/98765432_parent/json&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Headers&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; Authorization: Token
signature=123abc,repository=”foo/bar”,access=write
&lt;/code&gt;&lt;/pre&gt;
&lt;ol&gt;
&lt;li&gt;(Registry-&amp;gt;Docker Hub) GET /v1/repositories/foo/bar/images&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Headers&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; Authorization: Token
signature=123abc,repository=”foo/bar”,access=write
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Action&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Docker Hub:
will invalidate the token.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Registry:
grants a session (if token is approved) and fetches
the images id&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;(Docker -&amp;gt; Registry) PUT /v1/images/98765432_parent/json&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Headers&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; Authorization: Token
signature=123abc,repository=”foo/bar”,access=write
Cookie: (Cookie provided by the Registry)
&lt;/code&gt;&lt;/pre&gt;
&lt;ol&gt;
&lt;li&gt;(Docker -&amp;gt; Registry) PUT /v1/images/98765432/json&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Headers&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; Cookie: (Cookie provided by the Registry)
&lt;/code&gt;&lt;/pre&gt;
&lt;ol&gt;
&lt;li&gt;(Docker -&amp;gt; Registry) PUT /v1/images/98765432_parent/layer&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Headers&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; Cookie: (Cookie provided by the Registry)
&lt;/code&gt;&lt;/pre&gt;
&lt;ol&gt;
&lt;li&gt;(Docker -&amp;gt; Registry) PUT /v1/images/98765432/layer&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Headers&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; X-Docker-Checksum: sha256:436745873465fdjkhdfjkgh
&lt;/code&gt;&lt;/pre&gt;
&lt;ol&gt;
&lt;li&gt;(Docker -&amp;gt; Registry) PUT /v1/repositories/foo/bar/tags/latest&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Headers&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; Cookie: (Cookie provided by the Registry)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Body&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; “98765432”
&lt;/code&gt;&lt;/pre&gt;
&lt;ol&gt;
&lt;li&gt;(Docker -&amp;gt; Docker Hub) PUT /v1/repositories/foo/bar/images&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Headers&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; Authorization: Basic 123oislifjsldfj== X-Docker-Endpoints:
registry1.docker.io (no validation on this right now)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Body&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; (The image, id`s, tags and checksums)
[{“id”:
“9e89cc6f0bc3c38722009fe6857087b486531f9a779a0c17e3ed29dae8f12c4f”,
“checksum”:
“b486531f9a779a0c17e3ed29dae8f12c4f9e89cc6f0bc3c38722009fe6857087”}]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Return&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP 204
&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; If push fails and they need to start again, what happens in the Docker Hub,
there will already be a record for the namespace/name, but it will be
initialized. Should we allow it, or mark as name already used? One edge
case could be if someone pushes the same thing at the same time with two
different shells.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;If it&amp;rsquo;s a retry on the Registry, Docker has a cookie (provided by the
registry after token validation). So the Docker Hub won&amp;rsquo;t have to provide a
new token.&lt;/p&gt;
&lt;h3 id=&#34;delete&#34;&gt;Delete&lt;/h3&gt;
&lt;p&gt;If you need to delete something from the Docker Hub or registry, we need a
nice clean way to do that. Here is the workflow.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Docker contacts the Docker Hub to request a delete of a repository
&lt;code&gt;samalba/busybox&lt;/code&gt; (authentication required with user credentials)&lt;/li&gt;
&lt;li&gt;If authentication works and repository is valid, &lt;code&gt;samalba/busybox&lt;/code&gt;
is marked as deleted and a temporary token is returned&lt;/li&gt;
&lt;li&gt;Send a delete request to the registry for the repository (along with
the token)&lt;/li&gt;
&lt;li&gt;Registry A contacts the Docker Hub to verify the token (token must
corresponds to the repository name)&lt;/li&gt;
&lt;li&gt;Docker Hub validates the token. Registry A deletes the repository and
everything associated to it.&lt;/li&gt;
&lt;li&gt;docker contacts the Docker Hub to let it know it was removed from the
registry, the Docker Hub removes all records from the database.&lt;/li&gt;
&lt;/ol&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;:
The Docker client should present an &amp;ldquo;Are you sure?&amp;rdquo; prompt to confirm
the deletion before starting the process. Once it starts it can&amp;rsquo;t be
undone.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;strong&gt;API (deleting repository foo/bar):&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;(Docker -&amp;gt; Docker Hub) DELETE /v1/repositories/foo/bar/&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Headers&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; Authorization: Basic sdkjfskdjfhsdkjfh== X-Docker-Token:
true
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Action&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;in Docker Hub, we make sure it is a valid repository, and set
to deleted (logically)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Body&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; Empty
&lt;/code&gt;&lt;/pre&gt;
&lt;ol&gt;
&lt;li&gt;(Docker Hub -&amp;gt; Docker) 202 Accepted&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Headers&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; WWW-Authenticate: Token
signature=123abc,repository=”foo/bar”,access=delete
X-Docker-Endpoints: registry.docker.io [, registry2.docker.io]
# list of endpoints where this repo lives.
&lt;/code&gt;&lt;/pre&gt;
&lt;ol&gt;
&lt;li&gt;(Docker -&amp;gt; Registry) DELETE /v1/repositories/foo/bar/&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Headers&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; Authorization: Token
signature=123abc,repository=”foo/bar”,access=delete
&lt;/code&gt;&lt;/pre&gt;
&lt;ol&gt;
&lt;li&gt;(Registry-&amp;gt;Docker Hub) PUT /v1/repositories/foo/bar/auth&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Headers&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; Authorization: Token
signature=123abc,repository=”foo/bar”,access=delete
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Action&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Docker Hub:
will invalidate the token.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Registry:
deletes the repository (if token is approved)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;(Registry -&amp;gt; Docker) 200 OK&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;200 If success 403 if forbidden 400 if bad request 404
if repository isn&#39;t found
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;(Docker -&amp;gt; Docker Hub) DELETE /v1/repositories/foo/bar/&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Headers&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; Authorization: Basic 123oislifjsldfj== X-Docker-Endpoints:
registry-1.docker.io (no validation on this right now)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Body&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; Empty
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Return&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; HTTP 200
&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&#34;how-to-use-the-registry-in-standalone-mode&#34;&gt;How to use the Registry in standalone mode&lt;/h2&gt;
&lt;p&gt;The Docker Hub has two main purposes (along with its fancy social features):&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Resolve short names (to avoid passing absolute URLs all the time):&lt;/p&gt;
&lt;p&gt;username/projectname -&amp;gt;
&lt;a href=&#34;https://registry.docker.io/users/&#34;&gt;https://registry.docker.io/users/&lt;/a&gt;&lt;username&gt;/repositories/&lt;projectname&gt;/
team/projectname -&amp;gt;
&lt;a href=&#34;https://registry.docker.io/team/&#34;&gt;https://registry.docker.io/team/&lt;/a&gt;&lt;team&gt;/repositories/&lt;projectname&gt;/&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Authenticate a user as a repos owner (for a central referenced
repository)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;without-a-docker-hub&#34;&gt;Without a Docker Hub&lt;/h3&gt;
&lt;p&gt;Using the Registry without the Docker Hub can be useful to store the images
on a private network without having to rely on an external entity
controlled by Docker Inc.&lt;/p&gt;
&lt;p&gt;In this case, the registry will be launched in a special mode
(-standalone? ne? -no-index?). In this mode, the only thing which changes is
that Registry will never contact the Docker Hub to verify a token. It will be
the Registry owner responsibility to authenticate the user who pushes
(or even pulls) an image using any mechanism (HTTP auth, IP based,
etc&amp;hellip;).&lt;/p&gt;
&lt;p&gt;In this scenario, the Registry is responsible for the security in case
of data corruption since the checksums are not delivered by a trusted
entity.&lt;/p&gt;
&lt;p&gt;As hinted previously, a standalone registry can also be implemented by
any HTTP server handling GET/PUT requests (or even only GET requests if
no write access is necessary).&lt;/p&gt;
&lt;h3 id=&#34;with-a-docker-hub&#34;&gt;With a Docker Hub&lt;/h3&gt;
&lt;p&gt;The Docker Hub data needed by the Registry are simple:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Serve the checksums&lt;/li&gt;
&lt;li&gt;Provide and authorize a Token&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In the scenario of a Registry running on a private network with the need
of centralizing and authorizing, it&amp;rsquo;s easy to use a custom Docker Hub.&lt;/p&gt;
&lt;p&gt;The only challenge will be to tell Docker to contact (and trust) this
custom Docker Hub. Docker will be configurable at some point to use a
specific Docker Hub, it&amp;rsquo;ll be the private entity responsibility (basically
the organization who uses Docker in a private environment) to maintain
the Docker Hub and the Docker&amp;rsquo;s configuration among its consumers.&lt;/p&gt;
&lt;h2 id=&#34;the-api&#34;&gt;The API&lt;/h2&gt;
&lt;p&gt;The first version of the api is available here:
&lt;a href=&#34;https://github.com/jpetazzo/docker/blob/acd51ecea8f5d3c02b00a08176171c59442df8b3/docs/images-repositories-push-pull&#34;&gt;https://github.com/jpetazzo/docker/blob/acd51ecea8f5d3c02b00a08176171c59442df8b3/docs/images-repositories-push-pull.md&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&#34;images&#34;&gt;Images&lt;/h3&gt;
&lt;p&gt;The format returned in the images is not defined here (for layer and
JSON), basically because Registry stores exactly the same kind of
information as Docker uses to manage them.&lt;/p&gt;
&lt;p&gt;The format of ancestry is a line-separated list of image ids, in age
order, i.e. the image&amp;rsquo;s parent is on the last line, the parent of the
parent on the next-to-last line, etc.; if the image has no parent, the
file is empty.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;GET /v1/images/&amp;lt;image_id&amp;gt;/layer
PUT /v1/images/&amp;lt;image_id&amp;gt;/layer
GET /v1/images/&amp;lt;image_id&amp;gt;/json
PUT /v1/images/&amp;lt;image_id&amp;gt;/json
GET /v1/images/&amp;lt;image_id&amp;gt;/ancestry
PUT /v1/images/&amp;lt;image_id&amp;gt;/ancestry
&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&#34;users&#34;&gt;Users&lt;/h3&gt;
&lt;h3 id=&#34;create-a-user-docker-hub&#34;&gt;Create a user (Docker Hub)&lt;/h3&gt;
&lt;pre&gt;&lt;code&gt;POST /v1/users:
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Body&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;{&amp;quot;email&amp;quot;: &amp;quot;[sam@docker.com](mailto:sam%40docker.com)&amp;quot;,
&amp;quot;password&amp;quot;: &amp;quot;toto42&amp;quot;, &amp;quot;username&amp;quot;: &amp;quot;foobar&amp;quot;`}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Validation&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;username&lt;/strong&gt;: min 4 character, max 30 characters, must match the
regular expression [a-z0-9_].&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;password&lt;/strong&gt;: min 5 characters&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Valid&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; return HTTP 201
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Errors: HTTP 400 (we should create error codes for possible errors) -
invalid json - missing field - wrong format (username, password, email,
etc) - forbidden name - name already exists&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;:
A user account will be valid only if the email has been validated (a
validation link is sent to the email address).&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3 id=&#34;update-a-user-docker-hub&#34;&gt;Update a user (Docker Hub)&lt;/h3&gt;
&lt;pre&gt;&lt;code&gt;PUT /v1/users/&amp;lt;username&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Body&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;{&amp;quot;password&amp;quot;: &amp;quot;toto&amp;quot;}
&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;:
We can also update email address, if they do, they will need to reverify
their new email address.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3 id=&#34;login-docker-hub&#34;&gt;Login (Docker Hub)&lt;/h3&gt;
&lt;p&gt;Does nothing else but asking for a user authentication. Can be used to
validate credentials. HTTP Basic Auth for now, maybe change in future.&lt;/p&gt;
&lt;p&gt;GET /v1/users&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Return&lt;/strong&gt;:
- Valid: HTTP 200
- Invalid login: HTTP 401
- Account inactive: HTTP 403 Account is not Active&lt;/p&gt;
&lt;h3 id=&#34;tags-registry&#34;&gt;Tags (Registry)&lt;/h3&gt;
&lt;p&gt;The Registry does not know anything about users. Even though
repositories are under usernames, it&amp;rsquo;s just a namespace for the
registry. Allowing us to implement organizations or different namespaces
per user later, without modifying the Registry&amp;rsquo;s API.&lt;/p&gt;
&lt;p&gt;The following naming restrictions apply:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Namespaces must match the same regular expression as usernames (See
4.2.1.)&lt;/li&gt;
&lt;li&gt;Repository names must match the regular expression [a-zA-Z0-9-_.]&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;get-all-tags&#34;&gt;Get all tags:&lt;/h3&gt;
&lt;pre&gt;&lt;code&gt;GET /v1/repositories/&amp;lt;namespace&amp;gt;/&amp;lt;repository_name&amp;gt;/tags
**Return**: HTTP 200
[
{
&amp;quot;layer&amp;quot;: &amp;quot;9e89cc6f&amp;quot;,
&amp;quot;name&amp;quot;: &amp;quot;latest&amp;quot;
},
{
&amp;quot;layer&amp;quot;: &amp;quot;b486531f&amp;quot;,
&amp;quot;name&amp;quot;: &amp;quot;0.1.1&amp;quot;,
}
]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;4.3.2 Read the content of a tag (resolve the image id):&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;GET /v1/repositories/&amp;lt;namespace&amp;gt;/&amp;lt;repo_name&amp;gt;/tags/&amp;lt;tag&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Return&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;quot;9e89cc6f0bc3c38722009fe6857087b486531f9a779a0c17e3ed29dae8f12c4f&amp;quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;4.3.3 Delete a tag (registry):&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;DELETE /v1/repositories/&amp;lt;namespace&amp;gt;/&amp;lt;repo_name&amp;gt;/tags/&amp;lt;tag&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&#34;4-4-images-docker-hub&#34;&gt;4.4 Images (Docker Hub)&lt;/h3&gt;
&lt;p&gt;For the Docker Hub to “resolve” the repository name to a Registry location,
it uses the X-Docker-Endpoints header. In other terms, this requests
always add a &lt;code&gt;X-Docker-Endpoints&lt;/code&gt; to indicate the
location of the registry which hosts this repository.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;4.4.1 Get the images:&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;GET /v1/repositories/&amp;lt;namespace&amp;gt;/&amp;lt;repo_name&amp;gt;/images
**Return**: HTTP 200
[{“id”:
“9e89cc6f0bc3c38722009fe6857087b486531f9a779a0c17e3ed29dae8f12c4f”,
“checksum”:
“[md5:b486531f9a779a0c17e3ed29dae8f12c4f9e89cc6f0bc3c38722009fe6857087](md5:b486531f9a779a0c17e3ed29dae8f12c4f9e89cc6f0bc3c38722009fe6857087)”}]
&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&#34;add-update-the-images&#34;&gt;Add/update the images:&lt;/h3&gt;
&lt;p&gt;You always add images, you never remove them.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;PUT /v1/repositories/&amp;lt;namespace&amp;gt;/&amp;lt;repo_name&amp;gt;/images
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Body&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;[ {“id”:
“9e89cc6f0bc3c38722009fe6857087b486531f9a779a0c17e3ed29dae8f12c4f”,
“checksum”:
“sha256:b486531f9a779a0c17e3ed29dae8f12c4f9e89cc6f0bc3c38722009fe6857087”}
]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Return&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;204
&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&#34;repositories&#34;&gt;Repositories&lt;/h3&gt;
&lt;h3 id=&#34;remove-a-repository-registry&#34;&gt;Remove a Repository (Registry)&lt;/h3&gt;
&lt;p&gt;DELETE /v1/repositories/&lt;namespace&gt;/&lt;repo_name&gt;&lt;/p&gt;
&lt;p&gt;Return 200 OK&lt;/p&gt;
&lt;h3 id=&#34;remove-a-repository-docker-hub&#34;&gt;Remove a Repository (Docker Hub)&lt;/h3&gt;
&lt;p&gt;This starts the delete process. see 2.3 for more details.&lt;/p&gt;
&lt;p&gt;DELETE /v1/repositories/&lt;namespace&gt;/&lt;repo_name&gt;&lt;/p&gt;
&lt;p&gt;Return 202 OK&lt;/p&gt;
&lt;h2 id=&#34;chaining-registries&#34;&gt;Chaining Registries&lt;/h2&gt;
&lt;p&gt;It&amp;rsquo;s possible to chain Registries server for several reasons:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Load balancing&lt;/li&gt;
&lt;li&gt;Delegate the next request to another server&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;When a Registry is a reference for a repository, it should host the
entire images chain in order to avoid breaking the chain during the
download.&lt;/p&gt;
&lt;p&gt;The Docker Hub and Registry use this mechanism to redirect on one or the
other.&lt;/p&gt;
&lt;p&gt;Example with an image download:&lt;/p&gt;
&lt;p&gt;On every request, a special header can be returned:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;X-Docker-Endpoints: server1,server2
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;On the next request, the client will always pick a server from this
list.&lt;/p&gt;
&lt;h2 id=&#34;authentication-and-authorization&#34;&gt;Authentication and authorization&lt;/h2&gt;
&lt;h3 id=&#34;on-the-docker-hub&#34;&gt;On the Docker Hub&lt;/h3&gt;
&lt;p&gt;The Docker Hub supports both “Basic” and “Token” challenges. Usually when
there is a &lt;code&gt;401 Unauthorized&lt;/code&gt;, the Docker Hub replies
this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;401 Unauthorized
WWW-Authenticate: Basic realm=&amp;quot;auth required&amp;quot;,Token
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You have 3 options:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Provide user credentials and ask for a token&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Header&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
X-Docker-Token: true
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In this case, along with the 200 response, you&amp;rsquo;ll get a new token
(if user auth is ok): If authorization isn&amp;rsquo;t correct you get a 401
response. If account isn&amp;rsquo;t active you will get a 403 response.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Response&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; 200 OK
X-Docker-Token: Token
signature=123abc,repository=”foo/bar”,access=read
&lt;/code&gt;&lt;/pre&gt;
&lt;ol&gt;
&lt;li&gt;Provide user credentials only&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Header&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
&lt;/code&gt;&lt;/pre&gt;
&lt;ol&gt;
&lt;li&gt;Provide Token&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Header&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; Authorization: Token
signature=123abc,repository=”foo/bar”,access=read
&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&#34;6-2-on-the-registry&#34;&gt;6.2 On the Registry&lt;/h3&gt;
&lt;p&gt;The Registry only supports the Token challenge:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;401 Unauthorized
WWW-Authenticate: Token
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The only way is to provide a token on &lt;code&gt;401 Unauthorized&lt;/code&gt;
responses:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Authorization: Token signature=123abc,repository=&amp;quot;foo/bar&amp;quot;,access=read
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Usually, the Registry provides a Cookie when a Token verification
succeeded. Every time the Registry passes a Cookie, you have to pass it
back the same cookie.:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;200 OK
Set-Cookie: session=&amp;quot;wD/J7LqL5ctqw8haL10vgfhrb2Q=?foo=UydiYXInCnAxCi4=&amp;amp;timestamp=RjEzNjYzMTQ5NDcuNDc0NjQzCi4=&amp;quot;; Path=/; HttpOnly
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Next request:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;GET /(...)
Cookie: session=&amp;quot;wD/J7LqL5ctqw8haL10vgfhrb2Q=?foo=UydiYXInCnAxCi4=&amp;amp;timestamp=RjEzNjYzMTQ5NDcuNDc0NjQzCi4=&amp;quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&#34;document-version&#34;&gt;Document version&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;1.0 : May 6th 2013 : initial release&lt;/li&gt;
&lt;li&gt;1.1 : June 1st 2013 : Added Delete Repository and way to handle new
source namespace.&lt;/li&gt;
&lt;/ul&gt;
</description>
</item>
</channel>
</rss>