Fix headings in old API docs
Jekyll automatically adds titles based on the title of the page, so this was causing duplicate titles. Also, made all the headings the correct level. Signed-off-by: Ben Firshman <ben@firshman.co.uk>
This commit is contained in:
parent
d5dee554ea
commit
d9b109b807
7 changed files with 462 additions and 476 deletions
|
@ -16,9 +16,7 @@ redirect_from:
|
|||
will be rejected.
|
||||
-->
|
||||
|
||||
# Docker Engine API v1.18
|
||||
|
||||
# 1. Brief introduction
|
||||
## 1. Brief introduction
|
||||
|
||||
- The daemon listens on `unix:///var/run/docker.sock` but you can
|
||||
[Bind Docker to another host/port or a Unix socket](../commandline/dockerd.md#bind-docker-to-another-host-port-or-a-unix-socket).
|
||||
|
@ -26,11 +24,11 @@ redirect_from:
|
|||
or `pull`, the HTTP connection is hijacked to transport `STDOUT`,
|
||||
`STDIN` and `STDERR`.
|
||||
|
||||
# 2. Endpoints
|
||||
## 2. Endpoints
|
||||
|
||||
## 2.1 Containers
|
||||
### 2.1 Containers
|
||||
|
||||
### List containers
|
||||
#### List containers
|
||||
|
||||
`GET /containers/json`
|
||||
|
||||
|
@ -123,7 +121,7 @@ List containers
|
|||
- **400** – bad parameter
|
||||
- **500** – server error
|
||||
|
||||
### Create a container
|
||||
#### Create a container
|
||||
|
||||
`POST /containers/create`
|
||||
|
||||
|
@ -310,7 +308,7 @@ Create a container
|
|||
- **409** – conflict
|
||||
- **500** – server error
|
||||
|
||||
### Inspect a container
|
||||
#### Inspect a container
|
||||
|
||||
`GET /containers/(id or name)/json`
|
||||
|
||||
|
@ -443,7 +441,7 @@ Return low-level information on the container `id`
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### List processes running inside a container
|
||||
#### List processes running inside a container
|
||||
|
||||
`GET /containers/(id or name)/top`
|
||||
|
||||
|
@ -507,7 +505,7 @@ supported on Windows.
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Get container logs
|
||||
#### Get container logs
|
||||
|
||||
`GET /containers/(id or name)/logs`
|
||||
|
||||
|
@ -547,7 +545,7 @@ Get `stdout` and `stderr` logs from the container ``id``
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Inspect changes on a container's filesystem
|
||||
#### Inspect changes on a container's filesystem
|
||||
|
||||
`GET /containers/(id or name)/changes`
|
||||
|
||||
|
@ -589,7 +587,7 @@ Values for `Kind`:
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Export a container
|
||||
#### Export a container
|
||||
|
||||
`GET /containers/(id or name)/export`
|
||||
|
||||
|
@ -614,7 +612,7 @@ Export the contents of container `id`
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Get container stats based on resource usage
|
||||
#### Get container stats based on resource usage
|
||||
|
||||
`GET /containers/(id or name)/stats`
|
||||
|
||||
|
@ -702,7 +700,7 @@ This endpoint returns a live stream of a container's resource usage statistics.
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Resize a container TTY
|
||||
#### Resize a container TTY
|
||||
|
||||
`POST /containers/(id or name)/resize?h=<height>&w=<width>`
|
||||
|
||||
|
@ -729,7 +727,7 @@ Resize the TTY for container with `id`. You must restart the container for the
|
|||
- **404** – No such container
|
||||
- **500** – Cannot resize container
|
||||
|
||||
### Start a container
|
||||
#### Start a container
|
||||
|
||||
`POST /containers/(id or name)/start`
|
||||
|
||||
|
@ -754,7 +752,7 @@ Start the container `id`
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Stop a container
|
||||
#### Stop a container
|
||||
|
||||
`POST /containers/(id or name)/stop`
|
||||
|
||||
|
@ -779,7 +777,7 @@ Stop the container `id`
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Restart a container
|
||||
#### Restart a container
|
||||
|
||||
`POST /containers/(id or name)/restart`
|
||||
|
||||
|
@ -803,7 +801,7 @@ Restart the container `id`
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Kill a container
|
||||
#### Kill a container
|
||||
|
||||
`POST /containers/(id or name)/kill`
|
||||
|
||||
|
@ -828,7 +826,7 @@ Kill the container `id`
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Rename a container
|
||||
#### Rename a container
|
||||
|
||||
`POST /containers/(id or name)/rename`
|
||||
|
||||
|
@ -853,7 +851,7 @@ Rename the container `id` to a `new_name`
|
|||
- **409** - conflict name already assigned
|
||||
- **500** – server error
|
||||
|
||||
### Pause a container
|
||||
#### Pause a container
|
||||
|
||||
`POST /containers/(id or name)/pause`
|
||||
|
||||
|
@ -873,7 +871,7 @@ Pause the container `id`
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Unpause a container
|
||||
#### Unpause a container
|
||||
|
||||
`POST /containers/(id or name)/unpause`
|
||||
|
||||
|
@ -893,7 +891,7 @@ Unpause the container `id`
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Attach to a container
|
||||
#### Attach to a container
|
||||
|
||||
`POST /containers/(id or name)/attach`
|
||||
|
||||
|
@ -978,7 +976,7 @@ The simplest way to implement the Attach protocol is the following:
|
|||
4. Read the extracted size and output it on the correct output.
|
||||
5. Goto 1.
|
||||
|
||||
### Attach to a container (websocket)
|
||||
#### Attach to a container (websocket)
|
||||
|
||||
`GET /containers/(id or name)/attach/ws`
|
||||
|
||||
|
@ -1015,7 +1013,7 @@ Implements websocket protocol handshake according to [RFC 6455](http://tools.iet
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Wait a container
|
||||
#### Wait a container
|
||||
|
||||
`POST /containers/(id or name)/wait`
|
||||
|
||||
|
@ -1038,7 +1036,7 @@ Block until container `id` stops, then returns the exit code
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Remove a container
|
||||
#### Remove a container
|
||||
|
||||
`DELETE /containers/(id or name)`
|
||||
|
||||
|
@ -1067,7 +1065,7 @@ Remove the container `id` from the filesystem
|
|||
- **409** – conflict
|
||||
- **500** – server error
|
||||
|
||||
### Copy files or folders from a container
|
||||
#### Copy files or folders from a container
|
||||
|
||||
`POST /containers/(id or name)/copy`
|
||||
|
||||
|
@ -1097,9 +1095,9 @@ Copy files or folders of container `id`
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
## 2.2 Images
|
||||
### 2.2 Images
|
||||
|
||||
### List Images
|
||||
#### List Images
|
||||
|
||||
`GET /images/json`
|
||||
|
||||
|
@ -1185,7 +1183,7 @@ references on the command line.
|
|||
- `label=key` or `label="key=value"` of an image label
|
||||
- **filter** - only return images with the specified name
|
||||
|
||||
### Build image from a Dockerfile
|
||||
#### Build image from a Dockerfile
|
||||
|
||||
`POST /build`
|
||||
|
||||
|
@ -1256,7 +1254,7 @@ or being killed.
|
|||
- **200** – no error
|
||||
- **500** – server error
|
||||
|
||||
### Create an image
|
||||
#### Create an image
|
||||
|
||||
`POST /images/create`
|
||||
|
||||
|
@ -1300,7 +1298,7 @@ a base64-encoded AuthConfig object.
|
|||
|
||||
|
||||
|
||||
### Inspect an image
|
||||
#### Inspect an image
|
||||
|
||||
`GET /images/(name)/json`
|
||||
|
||||
|
@ -1351,7 +1349,7 @@ Return low-level information on the image `name`
|
|||
- **404** – no such image
|
||||
- **500** – server error
|
||||
|
||||
### Get the history of an image
|
||||
#### Get the history of an image
|
||||
|
||||
`GET /images/(name)/history`
|
||||
|
||||
|
@ -1385,7 +1383,7 @@ Return the history of the image `name`
|
|||
- **404** – no such image
|
||||
- **500** – server error
|
||||
|
||||
### Push an image on the registry
|
||||
#### Push an image on the registry
|
||||
|
||||
`POST /images/(name)/push`
|
||||
|
||||
|
@ -1428,7 +1426,7 @@ then be used in the URL. This duplicates the command line's flow.
|
|||
- **404** – no such image
|
||||
- **500** – server error
|
||||
|
||||
### Tag an image into a repository
|
||||
#### Tag an image into a repository
|
||||
|
||||
`POST /images/(name)/tag`
|
||||
|
||||
|
@ -1456,7 +1454,7 @@ Tag the image `name` into a repository
|
|||
- **409** – conflict
|
||||
- **500** – server error
|
||||
|
||||
### Remove an image
|
||||
#### Remove an image
|
||||
|
||||
`DELETE /images/(name)`
|
||||
|
||||
|
@ -1489,7 +1487,7 @@ Remove the image `name` from the filesystem
|
|||
- **409** – conflict
|
||||
- **500** – server error
|
||||
|
||||
### Search images
|
||||
#### Search images
|
||||
|
||||
`GET /images/search`
|
||||
|
||||
|
@ -1542,9 +1540,9 @@ Search for an image on [Docker Hub](https://hub.docker.com).
|
|||
- **200** – no error
|
||||
- **500** – server error
|
||||
|
||||
## 2.3 Misc
|
||||
### 2.3 Misc
|
||||
|
||||
### Check auth configuration
|
||||
#### Check auth configuration
|
||||
|
||||
`POST /auth`
|
||||
|
||||
|
@ -1572,7 +1570,7 @@ Get the default username and email
|
|||
- **204** – no error
|
||||
- **500** – server error
|
||||
|
||||
### Display system-wide information
|
||||
#### Display system-wide information
|
||||
|
||||
`GET /info`
|
||||
|
||||
|
@ -1637,7 +1635,7 @@ Display system-wide information
|
|||
- **200** – no error
|
||||
- **500** – server error
|
||||
|
||||
### Show the docker version information
|
||||
#### Show the docker version information
|
||||
|
||||
`GET /version`
|
||||
|
||||
|
@ -1667,7 +1665,7 @@ Show the docker version information
|
|||
- **200** – no error
|
||||
- **500** – server error
|
||||
|
||||
### Ping the docker server
|
||||
#### Ping the docker server
|
||||
|
||||
`GET /_ping`
|
||||
|
||||
|
@ -1689,7 +1687,7 @@ Ping the docker server
|
|||
- **200** - no error
|
||||
- **500** - server error
|
||||
|
||||
### Create a new image from a container's changes
|
||||
#### Create a new image from a container's changes
|
||||
|
||||
`POST /commit`
|
||||
|
||||
|
@ -1751,7 +1749,7 @@ Create a new image from a container's changes
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Monitor Docker's events
|
||||
#### Monitor Docker's events
|
||||
|
||||
`GET /events`
|
||||
|
||||
|
@ -1793,7 +1791,7 @@ Docker images report the following events:
|
|||
- **200** – no error
|
||||
- **500** – server error
|
||||
|
||||
### Get a tarball containing all images in a repository
|
||||
#### Get a tarball containing all images in a repository
|
||||
|
||||
`GET /images/(name)/get`
|
||||
|
||||
|
@ -1823,7 +1821,7 @@ See the [image tarball format](#image-tarball-format) for more details.
|
|||
- **200** – no error
|
||||
- **500** – server error
|
||||
|
||||
### Get a tarball containing all images
|
||||
#### Get a tarball containing all images
|
||||
|
||||
`GET /images/get`
|
||||
|
||||
|
@ -1852,7 +1850,7 @@ See the [image tarball format](#image-tarball-format) for more details.
|
|||
- **200** – no error
|
||||
- **500** – server error
|
||||
|
||||
### Load a tarball with a set of images and tags into docker
|
||||
#### Load a tarball with a set of images and tags into docker
|
||||
|
||||
`POST /images/load`
|
||||
|
||||
|
@ -1875,7 +1873,7 @@ See the [image tarball format](#image-tarball-format) for more details.
|
|||
- **200** – no error
|
||||
- **500** – server error
|
||||
|
||||
### Image tarball format
|
||||
#### Image tarball format
|
||||
|
||||
An image tarball contains one directory per image layer (named using its long ID),
|
||||
each containing these files:
|
||||
|
@ -1896,7 +1894,7 @@ the root that contains a list of repository and tag names mapped to layer IDs.
|
|||
}
|
||||
```
|
||||
|
||||
### Exec Create
|
||||
#### Exec Create
|
||||
|
||||
`POST /containers/(id or name)/exec`
|
||||
|
||||
|
@ -1939,7 +1937,7 @@ Sets up an exec instance in a running container `id`
|
|||
- **201** – no error
|
||||
- **404** – no such container
|
||||
|
||||
### Exec Start
|
||||
#### Exec Start
|
||||
|
||||
`POST /exec/(id)/start`
|
||||
|
||||
|
@ -1980,7 +1978,7 @@ interactive session with the `exec` command.
|
|||
|
||||
Similar to the stream behavior of `POST /containers/(id or name)/attach` API
|
||||
|
||||
### Exec Resize
|
||||
#### Exec Resize
|
||||
|
||||
`POST /exec/(id)/resize`
|
||||
|
||||
|
@ -2007,7 +2005,7 @@ This API is valid only if `tty` was specified as part of creating and starting t
|
|||
- **201** – no error
|
||||
- **404** – no such exec instance
|
||||
|
||||
### Exec Inspect
|
||||
#### Exec Inspect
|
||||
|
||||
`GET /exec/(id)/json`
|
||||
|
||||
|
@ -2112,9 +2110,9 @@ Return low-level information about the `exec` command `id`.
|
|||
- **404** – no such exec instance
|
||||
- **500** - server error
|
||||
|
||||
# 3. Going further
|
||||
## 3. Going further
|
||||
|
||||
## 3.1 Inside `docker run`
|
||||
### 3.1 Inside `docker run`
|
||||
|
||||
As an example, the `docker run` command line makes the following API calls:
|
||||
|
||||
|
@ -2132,7 +2130,7 @@ As an example, the `docker run` command line makes the following API calls:
|
|||
|
||||
- If in detached mode or only `stdin` is attached, display the container's id.
|
||||
|
||||
## 3.2 Hijacking
|
||||
### 3.2 Hijacking
|
||||
|
||||
In this version of the API, `/attach`, uses hijacking to transport `stdin`,
|
||||
`stdout`, and `stderr` on the same socket.
|
||||
|
@ -2148,7 +2146,7 @@ from **200 OK** to **101 UPGRADED** and resends the same headers.
|
|||
|
||||
This might change in the future.
|
||||
|
||||
## 3.3 CORS Requests
|
||||
### 3.3 CORS Requests
|
||||
|
||||
To set cross origin requests to the Engine API please give values to
|
||||
`--api-cors-header` when running Docker in daemon mode. Set * (asterisk) allows all,
|
||||
|
|
|
@ -16,8 +16,6 @@ redirect_from:
|
|||
will be rejected.
|
||||
-->
|
||||
|
||||
# Docker Engine API v1.19
|
||||
|
||||
## 1. Brief introduction
|
||||
|
||||
- The daemon listens on `unix:///var/run/docker.sock` but you can
|
||||
|
@ -28,11 +26,11 @@ redirect_from:
|
|||
- When the client API version is newer than the daemon's, these calls return an HTTP
|
||||
`400 Bad Request` error message.
|
||||
|
||||
# 2. Endpoints
|
||||
## 2. Endpoints
|
||||
|
||||
## 2.1 Containers
|
||||
### 2.1 Containers
|
||||
|
||||
### List containers
|
||||
#### List containers
|
||||
|
||||
`GET /containers/json`
|
||||
|
||||
|
@ -125,7 +123,7 @@ List containers
|
|||
- **400** – bad parameter
|
||||
- **500** – server error
|
||||
|
||||
### Create a container
|
||||
#### Create a container
|
||||
|
||||
`POST /containers/create`
|
||||
|
||||
|
@ -322,7 +320,7 @@ Create a container
|
|||
- **409** – conflict
|
||||
- **500** – server error
|
||||
|
||||
### Inspect a container
|
||||
#### Inspect a container
|
||||
|
||||
`GET /containers/(id or name)/json`
|
||||
|
||||
|
@ -459,7 +457,7 @@ Return low-level information on the container `id`
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### List processes running inside a container
|
||||
#### List processes running inside a container
|
||||
|
||||
`GET /containers/(id or name)/top`
|
||||
|
||||
|
@ -523,7 +521,7 @@ supported on Windows.
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Get container logs
|
||||
#### Get container logs
|
||||
|
||||
`GET /containers/(id or name)/logs`
|
||||
|
||||
|
@ -565,7 +563,7 @@ Get `stdout` and `stderr` logs from the container ``id``
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Inspect changes on a container's filesystem
|
||||
#### Inspect changes on a container's filesystem
|
||||
|
||||
`GET /containers/(id or name)/changes`
|
||||
|
||||
|
@ -607,7 +605,7 @@ Values for `Kind`:
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Export a container
|
||||
#### Export a container
|
||||
|
||||
`GET /containers/(id or name)/export`
|
||||
|
||||
|
@ -632,7 +630,7 @@ Export the contents of container `id`
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Get container stats based on resource usage
|
||||
#### Get container stats based on resource usage
|
||||
|
||||
`GET /containers/(id or name)/stats`
|
||||
|
||||
|
@ -741,7 +739,7 @@ The precpu_stats is the cpu statistic of last read, which is used for calculatin
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Resize a container TTY
|
||||
#### Resize a container TTY
|
||||
|
||||
`POST /containers/(id or name)/resize?h=<height>&w=<width>`
|
||||
|
||||
|
@ -768,7 +766,7 @@ Resize the TTY for container with `id`. You must restart the container for the
|
|||
- **404** – No such container
|
||||
- **500** – Cannot resize container
|
||||
|
||||
### Start a container
|
||||
#### Start a container
|
||||
|
||||
`POST /containers/(id or name)/start`
|
||||
|
||||
|
@ -793,7 +791,7 @@ Start the container `id`
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Stop a container
|
||||
#### Stop a container
|
||||
|
||||
`POST /containers/(id or name)/stop`
|
||||
|
||||
|
@ -818,7 +816,7 @@ Stop the container `id`
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Restart a container
|
||||
#### Restart a container
|
||||
|
||||
`POST /containers/(id or name)/restart`
|
||||
|
||||
|
@ -842,7 +840,7 @@ Restart the container `id`
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Kill a container
|
||||
#### Kill a container
|
||||
|
||||
`POST /containers/(id or name)/kill`
|
||||
|
||||
|
@ -867,7 +865,7 @@ Kill the container `id`
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Rename a container
|
||||
#### Rename a container
|
||||
|
||||
`POST /containers/(id or name)/rename`
|
||||
|
||||
|
@ -892,7 +890,7 @@ Rename the container `id` to a `new_name`
|
|||
- **409** - conflict name already assigned
|
||||
- **500** – server error
|
||||
|
||||
### Pause a container
|
||||
#### Pause a container
|
||||
|
||||
`POST /containers/(id or name)/pause`
|
||||
|
||||
|
@ -912,7 +910,7 @@ Pause the container `id`
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Unpause a container
|
||||
#### Unpause a container
|
||||
|
||||
`POST /containers/(id or name)/unpause`
|
||||
|
||||
|
@ -932,7 +930,7 @@ Unpause the container `id`
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Attach to a container
|
||||
#### Attach to a container
|
||||
|
||||
`POST /containers/(id or name)/attach`
|
||||
|
||||
|
@ -1017,7 +1015,7 @@ The simplest way to implement the Attach protocol is the following:
|
|||
4. Read the extracted size and output it on the correct output.
|
||||
5. Goto 1.
|
||||
|
||||
### Attach to a container (websocket)
|
||||
#### Attach to a container (websocket)
|
||||
|
||||
`GET /containers/(id or name)/attach/ws`
|
||||
|
||||
|
@ -1054,7 +1052,7 @@ Implements websocket protocol handshake according to [RFC 6455](http://tools.iet
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Wait a container
|
||||
#### Wait a container
|
||||
|
||||
`POST /containers/(id or name)/wait`
|
||||
|
||||
|
@ -1077,7 +1075,7 @@ Block until container `id` stops, then returns the exit code
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Remove a container
|
||||
#### Remove a container
|
||||
|
||||
`DELETE /containers/(id or name)`
|
||||
|
||||
|
@ -1106,7 +1104,7 @@ Remove the container `id` from the filesystem
|
|||
- **409** – conflict
|
||||
- **500** – server error
|
||||
|
||||
### Copy files or folders from a container
|
||||
#### Copy files or folders from a container
|
||||
|
||||
`POST /containers/(id or name)/copy`
|
||||
|
||||
|
@ -1136,9 +1134,9 @@ Copy files or folders of container `id`
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
## 2.2 Images
|
||||
### 2.2 Images
|
||||
|
||||
### List Images
|
||||
#### List Images
|
||||
|
||||
`GET /images/json`
|
||||
|
||||
|
@ -1229,7 +1227,7 @@ references on the command line.
|
|||
- `label=key` or `label="key=value"` of an image label
|
||||
- **filter** - only return images with the specified name
|
||||
|
||||
### Build image from a Dockerfile
|
||||
#### Build image from a Dockerfile
|
||||
|
||||
`POST /build`
|
||||
|
||||
|
@ -1302,7 +1300,7 @@ or being killed.
|
|||
- **200** – no error
|
||||
- **500** – server error
|
||||
|
||||
### Create an image
|
||||
#### Create an image
|
||||
|
||||
`POST /images/create`
|
||||
|
||||
|
@ -1346,7 +1344,7 @@ a base64-encoded AuthConfig object.
|
|||
|
||||
|
||||
|
||||
### Inspect an image
|
||||
#### Inspect an image
|
||||
|
||||
`GET /images/(name)/json`
|
||||
|
||||
|
@ -1397,7 +1395,7 @@ Return low-level information on the image `name`
|
|||
- **404** – no such image
|
||||
- **500** – server error
|
||||
|
||||
### Get the history of an image
|
||||
#### Get the history of an image
|
||||
|
||||
`GET /images/(name)/history`
|
||||
|
||||
|
@ -1451,7 +1449,7 @@ Return the history of the image `name`
|
|||
- **404** – no such image
|
||||
- **500** – server error
|
||||
|
||||
### Push an image on the registry
|
||||
#### Push an image on the registry
|
||||
|
||||
`POST /images/(name)/push`
|
||||
|
||||
|
@ -1494,7 +1492,7 @@ then be used in the URL. This duplicates the command line's flow.
|
|||
- **404** – no such image
|
||||
- **500** – server error
|
||||
|
||||
### Tag an image into a repository
|
||||
#### Tag an image into a repository
|
||||
|
||||
`POST /images/(name)/tag`
|
||||
|
||||
|
@ -1522,7 +1520,7 @@ Tag the image `name` into a repository
|
|||
- **409** – conflict
|
||||
- **500** – server error
|
||||
|
||||
### Remove an image
|
||||
#### Remove an image
|
||||
|
||||
`DELETE /images/(name)`
|
||||
|
||||
|
@ -1555,7 +1553,7 @@ Remove the image `name` from the filesystem
|
|||
- **409** – conflict
|
||||
- **500** – server error
|
||||
|
||||
### Search images
|
||||
#### Search images
|
||||
|
||||
`GET /images/search`
|
||||
|
||||
|
@ -1614,9 +1612,9 @@ be deprecated and replaced by the `is_automated` property.
|
|||
- **200** – no error
|
||||
- **500** – server error
|
||||
|
||||
## 2.3 Misc
|
||||
### 2.3 Misc
|
||||
|
||||
### Check auth configuration
|
||||
#### Check auth configuration
|
||||
|
||||
`POST /auth`
|
||||
|
||||
|
@ -1644,7 +1642,7 @@ Get the default username and email
|
|||
- **204** – no error
|
||||
- **500** – server error
|
||||
|
||||
### Display system-wide information
|
||||
#### Display system-wide information
|
||||
|
||||
`GET /info`
|
||||
|
||||
|
@ -1713,7 +1711,7 @@ Display system-wide information
|
|||
- **200** – no error
|
||||
- **500** – server error
|
||||
|
||||
### Show the docker version information
|
||||
#### Show the docker version information
|
||||
|
||||
`GET /version`
|
||||
|
||||
|
@ -1743,7 +1741,7 @@ Show the docker version information
|
|||
- **200** – no error
|
||||
- **500** – server error
|
||||
|
||||
### Ping the docker server
|
||||
#### Ping the docker server
|
||||
|
||||
`GET /_ping`
|
||||
|
||||
|
@ -1765,7 +1763,7 @@ Ping the docker server
|
|||
- **200** - no error
|
||||
- **500** - server error
|
||||
|
||||
### Create a new image from a container's changes
|
||||
#### Create a new image from a container's changes
|
||||
|
||||
`POST /commit`
|
||||
|
||||
|
@ -1831,7 +1829,7 @@ Create a new image from a container's changes
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Monitor Docker's events
|
||||
#### Monitor Docker's events
|
||||
|
||||
`GET /events`
|
||||
|
||||
|
@ -1873,7 +1871,7 @@ Docker images report the following events:
|
|||
- **200** – no error
|
||||
- **500** – server error
|
||||
|
||||
### Get a tarball containing all images in a repository
|
||||
#### Get a tarball containing all images in a repository
|
||||
|
||||
`GET /images/(name)/get`
|
||||
|
||||
|
@ -1903,7 +1901,7 @@ See the [image tarball format](#image-tarball-format) for more details.
|
|||
- **200** – no error
|
||||
- **500** – server error
|
||||
|
||||
### Get a tarball containing all images
|
||||
#### Get a tarball containing all images
|
||||
|
||||
`GET /images/get`
|
||||
|
||||
|
@ -1932,7 +1930,7 @@ See the [image tarball format](#image-tarball-format) for more details.
|
|||
- **200** – no error
|
||||
- **500** – server error
|
||||
|
||||
### Load a tarball with a set of images and tags into docker
|
||||
#### Load a tarball with a set of images and tags into docker
|
||||
|
||||
`POST /images/load`
|
||||
|
||||
|
@ -1955,7 +1953,7 @@ See the [image tarball format](#image-tarball-format) for more details.
|
|||
- **200** – no error
|
||||
- **500** – server error
|
||||
|
||||
### Image tarball format
|
||||
#### Image tarball format
|
||||
|
||||
An image tarball contains one directory per image layer (named using its long ID),
|
||||
each containing these files:
|
||||
|
@ -1976,7 +1974,7 @@ the root that contains a list of repository and tag names mapped to layer IDs.
|
|||
}
|
||||
```
|
||||
|
||||
### Exec Create
|
||||
#### Exec Create
|
||||
|
||||
`POST /containers/(id or name)/exec`
|
||||
|
||||
|
@ -2022,7 +2020,7 @@ Sets up an exec instance in a running container `id`
|
|||
- **201** – no error
|
||||
- **404** – no such container
|
||||
|
||||
### Exec Start
|
||||
#### Exec Start
|
||||
|
||||
`POST /exec/(id)/start`
|
||||
|
||||
|
@ -2063,7 +2061,7 @@ interactive session with the `exec` command.
|
|||
|
||||
Similar to the stream behavior of `POST /containers/(id or name)/attach` API
|
||||
|
||||
### Exec Resize
|
||||
#### Exec Resize
|
||||
|
||||
`POST /exec/(id)/resize`
|
||||
|
||||
|
@ -2090,7 +2088,7 @@ This API is valid only if `tty` was specified as part of creating and starting t
|
|||
- **201** – no error
|
||||
- **404** – no such exec instance
|
||||
|
||||
### Exec Inspect
|
||||
#### Exec Inspect
|
||||
|
||||
`GET /exec/(id)/json`
|
||||
|
||||
|
@ -2195,9 +2193,9 @@ Return low-level information about the `exec` command `id`.
|
|||
- **404** – no such exec instance
|
||||
- **500** - server error
|
||||
|
||||
# 3. Going further
|
||||
## 3. Going further
|
||||
|
||||
## 3.1 Inside `docker run`
|
||||
### 3.1 Inside `docker run`
|
||||
|
||||
As an example, the `docker run` command line makes the following API calls:
|
||||
|
||||
|
@ -2215,7 +2213,7 @@ As an example, the `docker run` command line makes the following API calls:
|
|||
|
||||
- If in detached mode or only `stdin` is attached, display the container's id.
|
||||
|
||||
## 3.2 Hijacking
|
||||
### 3.2 Hijacking
|
||||
|
||||
In this version of the API, `/attach`, uses hijacking to transport `stdin`,
|
||||
`stdout`, and `stderr` on the same socket.
|
||||
|
@ -2230,7 +2228,7 @@ When Docker daemon detects the `Upgrade` header, it switches its status code
|
|||
from **200 OK** to **101 UPGRADED** and resends the same headers.
|
||||
|
||||
|
||||
## 3.3 CORS Requests
|
||||
### 3.3 CORS Requests
|
||||
|
||||
To set cross origin requests to the Engine API please give values to
|
||||
`--api-cors-header` when running Docker in daemon mode. Set * (asterisk) allows all,
|
||||
|
|
|
@ -16,9 +16,7 @@ redirect_from:
|
|||
will be rejected.
|
||||
-->
|
||||
|
||||
# Docker Engine API v1.20
|
||||
|
||||
# 1. Brief introduction
|
||||
## 1. Brief introduction
|
||||
|
||||
- The daemon listens on `unix:///var/run/docker.sock` but you can
|
||||
[Bind Docker to another host/port or a Unix socket](../commandline/dockerd.md#bind-docker-to-another-host-port-or-a-unix-socket).
|
||||
|
@ -26,11 +24,11 @@ redirect_from:
|
|||
or `pull`, the HTTP connection is hijacked to transport `stdout`,
|
||||
`stdin` and `stderr`.
|
||||
|
||||
# 2. Endpoints
|
||||
## 2. Endpoints
|
||||
|
||||
## 2.1 Containers
|
||||
### 2.1 Containers
|
||||
|
||||
### List containers
|
||||
#### List containers
|
||||
|
||||
`GET /containers/json`
|
||||
|
||||
|
@ -123,7 +121,7 @@ List containers
|
|||
- **400** – bad parameter
|
||||
- **500** – server error
|
||||
|
||||
### Create a container
|
||||
#### Create a container
|
||||
|
||||
`POST /containers/create`
|
||||
|
||||
|
@ -324,7 +322,7 @@ Create a container
|
|||
- **409** – conflict
|
||||
- **500** – server error
|
||||
|
||||
### Inspect a container
|
||||
#### Inspect a container
|
||||
|
||||
`GET /containers/(id or name)/json`
|
||||
|
||||
|
@ -466,7 +464,7 @@ Return low-level information on the container `id`
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### List processes running inside a container
|
||||
#### List processes running inside a container
|
||||
|
||||
`GET /containers/(id or name)/top`
|
||||
|
||||
|
@ -530,7 +528,7 @@ supported on Windows.
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Get container logs
|
||||
#### Get container logs
|
||||
|
||||
`GET /containers/(id or name)/logs`
|
||||
|
||||
|
@ -572,7 +570,7 @@ Get `stdout` and `stderr` logs from the container ``id``
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Inspect changes on a container's filesystem
|
||||
#### Inspect changes on a container's filesystem
|
||||
|
||||
`GET /containers/(id or name)/changes`
|
||||
|
||||
|
@ -614,7 +612,7 @@ Values for `Kind`:
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Export a container
|
||||
#### Export a container
|
||||
|
||||
`GET /containers/(id or name)/export`
|
||||
|
||||
|
@ -639,7 +637,7 @@ Export the contents of container `id`
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Get container stats based on resource usage
|
||||
#### Get container stats based on resource usage
|
||||
|
||||
`GET /containers/(id or name)/stats`
|
||||
|
||||
|
@ -748,7 +746,7 @@ The precpu_stats is the cpu statistic of last read, which is used for calculatin
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Resize a container TTY
|
||||
#### Resize a container TTY
|
||||
|
||||
`POST /containers/(id or name)/resize?h=<height>&w=<width>`
|
||||
|
||||
|
@ -775,7 +773,7 @@ Resize the TTY for container with `id`. You must restart the container for the
|
|||
- **404** – No such container
|
||||
- **500** – Cannot resize container
|
||||
|
||||
### Start a container
|
||||
#### Start a container
|
||||
|
||||
`POST /containers/(id or name)/start`
|
||||
|
||||
|
@ -800,7 +798,7 @@ Start the container `id`
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Stop a container
|
||||
#### Stop a container
|
||||
|
||||
`POST /containers/(id or name)/stop`
|
||||
|
||||
|
@ -825,7 +823,7 @@ Stop the container `id`
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Restart a container
|
||||
#### Restart a container
|
||||
|
||||
`POST /containers/(id or name)/restart`
|
||||
|
||||
|
@ -849,7 +847,7 @@ Restart the container `id`
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Kill a container
|
||||
#### Kill a container
|
||||
|
||||
`POST /containers/(id or name)/kill`
|
||||
|
||||
|
@ -874,7 +872,7 @@ Kill the container `id`
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Rename a container
|
||||
#### Rename a container
|
||||
|
||||
`POST /containers/(id or name)/rename`
|
||||
|
||||
|
@ -899,7 +897,7 @@ Rename the container `id` to a `new_name`
|
|||
- **409** - conflict name already assigned
|
||||
- **500** – server error
|
||||
|
||||
### Pause a container
|
||||
#### Pause a container
|
||||
|
||||
`POST /containers/(id or name)/pause`
|
||||
|
||||
|
@ -919,7 +917,7 @@ Pause the container `id`
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Unpause a container
|
||||
#### Unpause a container
|
||||
|
||||
`POST /containers/(id or name)/unpause`
|
||||
|
||||
|
@ -939,7 +937,7 @@ Unpause the container `id`
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Attach to a container
|
||||
#### Attach to a container
|
||||
|
||||
`POST /containers/(id or name)/attach`
|
||||
|
||||
|
@ -1024,7 +1022,7 @@ The simplest way to implement the Attach protocol is the following:
|
|||
4. Read the extracted size and output it on the correct output.
|
||||
5. Goto 1.
|
||||
|
||||
### Attach to a container (websocket)
|
||||
#### Attach to a container (websocket)
|
||||
|
||||
`GET /containers/(id or name)/attach/ws`
|
||||
|
||||
|
@ -1061,7 +1059,7 @@ Implements websocket protocol handshake according to [RFC 6455](http://tools.iet
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Wait a container
|
||||
#### Wait a container
|
||||
|
||||
`POST /containers/(id or name)/wait`
|
||||
|
||||
|
@ -1084,7 +1082,7 @@ Block until container `id` stops, then returns the exit code
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Remove a container
|
||||
#### Remove a container
|
||||
|
||||
`DELETE /containers/(id or name)`
|
||||
|
||||
|
@ -1113,7 +1111,7 @@ Remove the container `id` from the filesystem
|
|||
- **409** – conflict
|
||||
- **500** – server error
|
||||
|
||||
### Copy files or folders from a container
|
||||
#### Copy files or folders from a container
|
||||
|
||||
`POST /containers/(id or name)/copy`
|
||||
|
||||
|
@ -1145,14 +1143,14 @@ Copy files or folders of container `id`
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Retrieving information about files and folders in a container
|
||||
#### Retrieving information about files and folders in a container
|
||||
|
||||
`HEAD /containers/(id or name)/archive`
|
||||
|
||||
See the description of the `X-Docker-Container-Path-Stat` header in the
|
||||
following section.
|
||||
|
||||
### Get an archive of a filesystem resource in a container
|
||||
#### Get an archive of a filesystem resource in a container
|
||||
|
||||
`GET /containers/(id or name)/archive`
|
||||
|
||||
|
@ -1217,7 +1215,7 @@ desired.
|
|||
- no such file or directory (**path** does not exist)
|
||||
- **500** - server error
|
||||
|
||||
### Extract an archive of files or folders to a directory in a container
|
||||
#### Extract an archive of files or folders to a directory in a container
|
||||
|
||||
`PUT /containers/(id or name)/archive`
|
||||
|
||||
|
@ -1265,9 +1263,9 @@ Upload a tar archive to be extracted to a path in the filesystem of container
|
|||
- no such file or directory (**path** resource does not exist)
|
||||
- **500** – server error
|
||||
|
||||
## 2.2 Images
|
||||
### 2.2 Images
|
||||
|
||||
### List Images
|
||||
#### List Images
|
||||
|
||||
`GET /images/json`
|
||||
|
||||
|
@ -1358,7 +1356,7 @@ references on the command line.
|
|||
- `label=key` or `label="key=value"` of an image label
|
||||
- **filter** - only return images with the specified name
|
||||
|
||||
### Build image from a Dockerfile
|
||||
#### Build image from a Dockerfile
|
||||
|
||||
`POST /build`
|
||||
|
||||
|
@ -1456,7 +1454,7 @@ or being killed.
|
|||
- **200** – no error
|
||||
- **500** – server error
|
||||
|
||||
### Create an image
|
||||
#### Create an image
|
||||
|
||||
`POST /images/create`
|
||||
|
||||
|
@ -1500,7 +1498,7 @@ a base64-encoded AuthConfig object.
|
|||
|
||||
|
||||
|
||||
### Inspect an image
|
||||
#### Inspect an image
|
||||
|
||||
`GET /images/(name)/json`
|
||||
|
||||
|
@ -1551,7 +1549,7 @@ Return low-level information on the image `name`
|
|||
- **404** – no such image
|
||||
- **500** – server error
|
||||
|
||||
### Get the history of an image
|
||||
#### Get the history of an image
|
||||
|
||||
`GET /images/(name)/history`
|
||||
|
||||
|
@ -1605,7 +1603,7 @@ Return the history of the image `name`
|
|||
- **404** – no such image
|
||||
- **500** – server error
|
||||
|
||||
### Push an image on the registry
|
||||
#### Push an image on the registry
|
||||
|
||||
`POST /images/(name)/push`
|
||||
|
||||
|
@ -1648,7 +1646,7 @@ then be used in the URL. This duplicates the command line's flow.
|
|||
- **404** – no such image
|
||||
- **500** – server error
|
||||
|
||||
### Tag an image into a repository
|
||||
#### Tag an image into a repository
|
||||
|
||||
`POST /images/(name)/tag`
|
||||
|
||||
|
@ -1676,7 +1674,7 @@ Tag the image `name` into a repository
|
|||
- **409** – conflict
|
||||
- **500** – server error
|
||||
|
||||
### Remove an image
|
||||
#### Remove an image
|
||||
|
||||
`DELETE /images/(name)`
|
||||
|
||||
|
@ -1709,7 +1707,7 @@ Remove the image `name` from the filesystem
|
|||
- **409** – conflict
|
||||
- **500** – server error
|
||||
|
||||
### Search images
|
||||
#### Search images
|
||||
|
||||
`GET /images/search`
|
||||
|
||||
|
@ -1762,9 +1760,9 @@ Search for an image on [Docker Hub](https://hub.docker.com).
|
|||
- **200** – no error
|
||||
- **500** – server error
|
||||
|
||||
## 2.3 Misc
|
||||
### 2.3 Misc
|
||||
|
||||
### Check auth configuration
|
||||
#### Check auth configuration
|
||||
|
||||
`POST /auth`
|
||||
|
||||
|
@ -1792,7 +1790,7 @@ Get the default username and email
|
|||
- **204** – no error
|
||||
- **500** – server error
|
||||
|
||||
### Display system-wide information
|
||||
#### Display system-wide information
|
||||
|
||||
`GET /info`
|
||||
|
||||
|
@ -1861,7 +1859,7 @@ Display system-wide information
|
|||
- **200** – no error
|
||||
- **500** – server error
|
||||
|
||||
### Show the docker version information
|
||||
#### Show the docker version information
|
||||
|
||||
`GET /version`
|
||||
|
||||
|
@ -1892,7 +1890,7 @@ Show the docker version information
|
|||
- **200** – no error
|
||||
- **500** – server error
|
||||
|
||||
### Ping the docker server
|
||||
#### Ping the docker server
|
||||
|
||||
`GET /_ping`
|
||||
|
||||
|
@ -1914,7 +1912,7 @@ Ping the docker server
|
|||
- **200** - no error
|
||||
- **500** - server error
|
||||
|
||||
### Create a new image from a container's changes
|
||||
#### Create a new image from a container's changes
|
||||
|
||||
`POST /commit`
|
||||
|
||||
|
@ -1986,7 +1984,7 @@ Create a new image from a container's changes
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Monitor Docker's events
|
||||
#### Monitor Docker's events
|
||||
|
||||
`GET /events`
|
||||
|
||||
|
@ -2028,7 +2026,7 @@ Docker images report the following events:
|
|||
- **200** – no error
|
||||
- **500** – server error
|
||||
|
||||
### Get a tarball containing all images in a repository
|
||||
#### Get a tarball containing all images in a repository
|
||||
|
||||
`GET /images/(name)/get`
|
||||
|
||||
|
@ -2058,7 +2056,7 @@ See the [image tarball format](#image-tarball-format) for more details.
|
|||
- **200** – no error
|
||||
- **500** – server error
|
||||
|
||||
### Get a tarball containing all images
|
||||
#### Get a tarball containing all images
|
||||
|
||||
`GET /images/get`
|
||||
|
||||
|
@ -2087,7 +2085,7 @@ See the [image tarball format](#image-tarball-format) for more details.
|
|||
- **200** – no error
|
||||
- **500** – server error
|
||||
|
||||
### Load a tarball with a set of images and tags into docker
|
||||
#### Load a tarball with a set of images and tags into docker
|
||||
|
||||
`POST /images/load`
|
||||
|
||||
|
@ -2110,7 +2108,7 @@ See the [image tarball format](#image-tarball-format) for more details.
|
|||
- **200** – no error
|
||||
- **500** – server error
|
||||
|
||||
### Image tarball format
|
||||
#### Image tarball format
|
||||
|
||||
An image tarball contains one directory per image layer (named using its long ID),
|
||||
each containing these files:
|
||||
|
@ -2131,7 +2129,7 @@ the root that contains a list of repository and tag names mapped to layer IDs.
|
|||
}
|
||||
```
|
||||
|
||||
### Exec Create
|
||||
#### Exec Create
|
||||
|
||||
`POST /containers/(id or name)/exec`
|
||||
|
||||
|
@ -2177,7 +2175,7 @@ Sets up an exec instance in a running container `id`
|
|||
- **201** – no error
|
||||
- **404** – no such container
|
||||
|
||||
### Exec Start
|
||||
#### Exec Start
|
||||
|
||||
`POST /exec/(id)/start`
|
||||
|
||||
|
@ -2218,7 +2216,7 @@ interactive session with the `exec` command.
|
|||
|
||||
Similar to the stream behavior of `POST /containers/(id or name)/attach` API
|
||||
|
||||
### Exec Resize
|
||||
#### Exec Resize
|
||||
|
||||
`POST /exec/(id)/resize`
|
||||
|
||||
|
@ -2245,7 +2243,7 @@ This API is valid only if `tty` was specified as part of creating and starting t
|
|||
- **201** – no error
|
||||
- **404** – no such exec instance
|
||||
|
||||
### Exec Inspect
|
||||
#### Exec Inspect
|
||||
|
||||
`GET /exec/(id)/json`
|
||||
|
||||
|
@ -2348,9 +2346,9 @@ Return low-level information about the `exec` command `id`.
|
|||
- **404** – no such exec instance
|
||||
- **500** - server error
|
||||
|
||||
# 3. Going further
|
||||
## 3. Going further
|
||||
|
||||
## 3.1 Inside `docker run`
|
||||
### 3.1 Inside `docker run`
|
||||
|
||||
As an example, the `docker run` command line makes the following API calls:
|
||||
|
||||
|
@ -2368,7 +2366,7 @@ As an example, the `docker run` command line makes the following API calls:
|
|||
|
||||
- If in detached mode or only `stdin` is attached, display the container's id.
|
||||
|
||||
## 3.2 Hijacking
|
||||
### 3.2 Hijacking
|
||||
|
||||
In this version of the API, `/attach`, uses hijacking to transport `stdin`,
|
||||
`stdout`, and `stderr` on the same socket.
|
||||
|
@ -2383,7 +2381,7 @@ When Docker daemon detects the `Upgrade` header, it switches its status code
|
|||
from **200 OK** to **101 UPGRADED** and resends the same headers.
|
||||
|
||||
|
||||
## 3.3 CORS Requests
|
||||
### 3.3 CORS Requests
|
||||
|
||||
To set cross origin requests to the Engine API please give values to
|
||||
`--api-cors-header` when running Docker in daemon mode. Set * (asterisk) allows all,
|
||||
|
|
|
@ -16,8 +16,6 @@ redirect_from:
|
|||
will be rejected.
|
||||
-->
|
||||
|
||||
# Docker Engine API v1.21
|
||||
|
||||
## 1. Brief introduction
|
||||
|
||||
- The daemon listens on `unix:///var/run/docker.sock` but you can
|
||||
|
@ -28,11 +26,11 @@ redirect_from:
|
|||
- When the client API version is newer than the daemon's, these calls return an HTTP
|
||||
`400 Bad Request` error message.
|
||||
|
||||
# 2. Endpoints
|
||||
## 2. Endpoints
|
||||
|
||||
## 2.1 Containers
|
||||
### 2.1 Containers
|
||||
|
||||
### List containers
|
||||
#### List containers
|
||||
|
||||
`GET /containers/json`
|
||||
|
||||
|
@ -129,7 +127,7 @@ List containers
|
|||
- **400** – bad parameter
|
||||
- **500** – server error
|
||||
|
||||
### Create a container
|
||||
#### Create a container
|
||||
|
||||
`POST /containers/create`
|
||||
|
||||
|
@ -347,7 +345,7 @@ Create a container
|
|||
- **409** – conflict
|
||||
- **500** – server error
|
||||
|
||||
### Inspect a container
|
||||
#### Inspect a container
|
||||
|
||||
`GET /containers/(id or name)/json`
|
||||
|
||||
|
@ -537,7 +535,7 @@ Return low-level information on the container `id`
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### List processes running inside a container
|
||||
#### List processes running inside a container
|
||||
|
||||
`GET /containers/(id or name)/top`
|
||||
|
||||
|
@ -601,7 +599,7 @@ supported on Windows.
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Get container logs
|
||||
#### Get container logs
|
||||
|
||||
`GET /containers/(id or name)/logs`
|
||||
|
||||
|
@ -643,7 +641,7 @@ Get `stdout` and `stderr` logs from the container ``id``
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Inspect changes on a container's filesystem
|
||||
#### Inspect changes on a container's filesystem
|
||||
|
||||
`GET /containers/(id or name)/changes`
|
||||
|
||||
|
@ -685,7 +683,7 @@ Values for `Kind`:
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Export a container
|
||||
#### Export a container
|
||||
|
||||
`GET /containers/(id or name)/export`
|
||||
|
||||
|
@ -710,7 +708,7 @@ Export the contents of container `id`
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Get container stats based on resource usage
|
||||
#### Get container stats based on resource usage
|
||||
|
||||
`GET /containers/(id or name)/stats`
|
||||
|
||||
|
@ -831,7 +829,7 @@ The precpu_stats is the cpu statistic of last read, which is used for calculatin
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Resize a container TTY
|
||||
#### Resize a container TTY
|
||||
|
||||
`POST /containers/(id or name)/resize`
|
||||
|
||||
|
@ -858,7 +856,7 @@ Resize the TTY for container with `id`. The unit is number of characters. You m
|
|||
- **404** – No such container
|
||||
- **500** – Cannot resize container
|
||||
|
||||
### Start a container
|
||||
#### Start a container
|
||||
|
||||
`POST /containers/(id or name)/start`
|
||||
|
||||
|
@ -883,7 +881,7 @@ Start the container `id`
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Stop a container
|
||||
#### Stop a container
|
||||
|
||||
`POST /containers/(id or name)/stop`
|
||||
|
||||
|
@ -908,7 +906,7 @@ Stop the container `id`
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Restart a container
|
||||
#### Restart a container
|
||||
|
||||
`POST /containers/(id or name)/restart`
|
||||
|
||||
|
@ -932,7 +930,7 @@ Restart the container `id`
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Kill a container
|
||||
#### Kill a container
|
||||
|
||||
`POST /containers/(id or name)/kill`
|
||||
|
||||
|
@ -957,7 +955,7 @@ Kill the container `id`
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Rename a container
|
||||
#### Rename a container
|
||||
|
||||
`POST /containers/(id or name)/rename`
|
||||
|
||||
|
@ -982,7 +980,7 @@ Rename the container `id` to a `new_name`
|
|||
- **409** - conflict name already assigned
|
||||
- **500** – server error
|
||||
|
||||
### Pause a container
|
||||
#### Pause a container
|
||||
|
||||
`POST /containers/(id or name)/pause`
|
||||
|
||||
|
@ -1002,7 +1000,7 @@ Pause the container `id`
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Unpause a container
|
||||
#### Unpause a container
|
||||
|
||||
`POST /containers/(id or name)/unpause`
|
||||
|
||||
|
@ -1022,7 +1020,7 @@ Unpause the container `id`
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Attach to a container
|
||||
#### Attach to a container
|
||||
|
||||
`POST /containers/(id or name)/attach`
|
||||
|
||||
|
@ -1107,7 +1105,7 @@ The simplest way to implement the Attach protocol is the following:
|
|||
4. Read the extracted size and output it on the correct output.
|
||||
5. Goto 1.
|
||||
|
||||
### Attach to a container (websocket)
|
||||
#### Attach to a container (websocket)
|
||||
|
||||
`GET /containers/(id or name)/attach/ws`
|
||||
|
||||
|
@ -1144,7 +1142,7 @@ Implements websocket protocol handshake according to [RFC 6455](http://tools.iet
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Wait a container
|
||||
#### Wait a container
|
||||
|
||||
`POST /containers/(id or name)/wait`
|
||||
|
||||
|
@ -1167,7 +1165,7 @@ Block until container `id` stops, then returns the exit code
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Remove a container
|
||||
#### Remove a container
|
||||
|
||||
`DELETE /containers/(id or name)`
|
||||
|
||||
|
@ -1196,7 +1194,7 @@ Remove the container `id` from the filesystem
|
|||
- **409** – conflict
|
||||
- **500** – server error
|
||||
|
||||
### Copy files or folders from a container
|
||||
#### Copy files or folders from a container
|
||||
|
||||
`POST /containers/(id or name)/copy`
|
||||
|
||||
|
@ -1228,14 +1226,14 @@ Copy files or folders of container `id`
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Retrieving information about files and folders in a container
|
||||
#### Retrieving information about files and folders in a container
|
||||
|
||||
`HEAD /containers/(id or name)/archive`
|
||||
|
||||
See the description of the `X-Docker-Container-Path-Stat` header in the
|
||||
following section.
|
||||
|
||||
### Get an archive of a filesystem resource in a container
|
||||
#### Get an archive of a filesystem resource in a container
|
||||
|
||||
`GET /containers/(id or name)/archive`
|
||||
|
||||
|
@ -1300,7 +1298,7 @@ desired.
|
|||
- no such file or directory (**path** does not exist)
|
||||
- **500** - server error
|
||||
|
||||
### Extract an archive of files or folders to a directory in a container
|
||||
#### Extract an archive of files or folders to a directory in a container
|
||||
|
||||
`PUT /containers/(id or name)/archive`
|
||||
|
||||
|
@ -1348,9 +1346,9 @@ Upload a tar archive to be extracted to a path in the filesystem of container
|
|||
- no such file or directory (**path** resource does not exist)
|
||||
- **500** – server error
|
||||
|
||||
## 2.2 Images
|
||||
### 2.2 Images
|
||||
|
||||
### List Images
|
||||
#### List Images
|
||||
|
||||
`GET /images/json`
|
||||
|
||||
|
@ -1441,7 +1439,7 @@ references on the command line.
|
|||
- `label=key` or `label="key=value"` of an image label
|
||||
- **filter** - only return images with the specified name
|
||||
|
||||
### Build image from a Dockerfile
|
||||
#### Build image from a Dockerfile
|
||||
|
||||
`POST /build`
|
||||
|
||||
|
@ -1545,7 +1543,7 @@ or being killed.
|
|||
- **200** – no error
|
||||
- **500** – server error
|
||||
|
||||
### Create an image
|
||||
#### Create an image
|
||||
|
||||
`POST /images/create`
|
||||
|
||||
|
@ -1593,7 +1591,7 @@ a base64-encoded AuthConfig object.
|
|||
|
||||
|
||||
|
||||
### Inspect an image
|
||||
#### Inspect an image
|
||||
|
||||
`GET /images/(name)/json`
|
||||
|
||||
|
@ -1704,7 +1702,7 @@ Return low-level information on the image `name`
|
|||
- **404** – no such image
|
||||
- **500** – server error
|
||||
|
||||
### Get the history of an image
|
||||
#### Get the history of an image
|
||||
|
||||
`GET /images/(name)/history`
|
||||
|
||||
|
@ -1758,7 +1756,7 @@ Return the history of the image `name`
|
|||
- **404** – no such image
|
||||
- **500** – server error
|
||||
|
||||
### Push an image on the registry
|
||||
#### Push an image on the registry
|
||||
|
||||
`POST /images/(name)/push`
|
||||
|
||||
|
@ -1801,7 +1799,7 @@ then be used in the URL. This duplicates the command line's flow.
|
|||
- **404** – no such image
|
||||
- **500** – server error
|
||||
|
||||
### Tag an image into a repository
|
||||
#### Tag an image into a repository
|
||||
|
||||
`POST /images/(name)/tag`
|
||||
|
||||
|
@ -1829,7 +1827,7 @@ Tag the image `name` into a repository
|
|||
- **409** – conflict
|
||||
- **500** – server error
|
||||
|
||||
### Remove an image
|
||||
#### Remove an image
|
||||
|
||||
`DELETE /images/(name)`
|
||||
|
||||
|
@ -1862,7 +1860,7 @@ Remove the image `name` from the filesystem
|
|||
- **409** – conflict
|
||||
- **500** – server error
|
||||
|
||||
### Search images
|
||||
#### Search images
|
||||
|
||||
`GET /images/search`
|
||||
|
||||
|
@ -1915,9 +1913,9 @@ Search for an image on [Docker Hub](https://hub.docker.com).
|
|||
- **200** – no error
|
||||
- **500** – server error
|
||||
|
||||
## 2.3 Misc
|
||||
### 2.3 Misc
|
||||
|
||||
### Check auth configuration
|
||||
#### Check auth configuration
|
||||
|
||||
`POST /auth`
|
||||
|
||||
|
@ -1945,7 +1943,7 @@ Get the default username and email
|
|||
- **204** – no error
|
||||
- **500** – server error
|
||||
|
||||
### Display system-wide information
|
||||
#### Display system-wide information
|
||||
|
||||
`GET /info`
|
||||
|
||||
|
@ -2016,7 +2014,7 @@ Display system-wide information
|
|||
- **200** – no error
|
||||
- **500** – server error
|
||||
|
||||
### Show the docker version information
|
||||
#### Show the docker version information
|
||||
|
||||
`GET /version`
|
||||
|
||||
|
@ -2047,7 +2045,7 @@ Show the docker version information
|
|||
- **200** – no error
|
||||
- **500** – server error
|
||||
|
||||
### Ping the docker server
|
||||
#### Ping the docker server
|
||||
|
||||
`GET /_ping`
|
||||
|
||||
|
@ -2069,7 +2067,7 @@ Ping the docker server
|
|||
- **200** - no error
|
||||
- **500** - server error
|
||||
|
||||
### Create a new image from a container's changes
|
||||
#### Create a new image from a container's changes
|
||||
|
||||
`POST /commit`
|
||||
|
||||
|
@ -2141,7 +2139,7 @@ Create a new image from a container's changes
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Monitor Docker's events
|
||||
#### Monitor Docker's events
|
||||
|
||||
`GET /events`
|
||||
|
||||
|
@ -2184,7 +2182,7 @@ Docker images report the following events:
|
|||
- **200** – no error
|
||||
- **500** – server error
|
||||
|
||||
### Get a tarball containing all images in a repository
|
||||
#### Get a tarball containing all images in a repository
|
||||
|
||||
`GET /images/(name)/get`
|
||||
|
||||
|
@ -2214,7 +2212,7 @@ See the [image tarball format](#image-tarball-format) for more details.
|
|||
- **200** – no error
|
||||
- **500** – server error
|
||||
|
||||
### Get a tarball containing all images
|
||||
#### Get a tarball containing all images
|
||||
|
||||
`GET /images/get`
|
||||
|
||||
|
@ -2243,7 +2241,7 @@ See the [image tarball format](#image-tarball-format) for more details.
|
|||
- **200** – no error
|
||||
- **500** – server error
|
||||
|
||||
### Load a tarball with a set of images and tags into docker
|
||||
#### Load a tarball with a set of images and tags into docker
|
||||
|
||||
`POST /images/load`
|
||||
|
||||
|
@ -2266,7 +2264,7 @@ See the [image tarball format](#image-tarball-format) for more details.
|
|||
- **200** – no error
|
||||
- **500** – server error
|
||||
|
||||
### Image tarball format
|
||||
#### Image tarball format
|
||||
|
||||
An image tarball contains one directory per image layer (named using its long ID),
|
||||
each containing these files:
|
||||
|
@ -2287,7 +2285,7 @@ the root that contains a list of repository and tag names mapped to layer IDs.
|
|||
}
|
||||
```
|
||||
|
||||
### Exec Create
|
||||
#### Exec Create
|
||||
|
||||
`POST /containers/(id or name)/exec`
|
||||
|
||||
|
@ -2337,7 +2335,7 @@ Sets up an exec instance in a running container `id`
|
|||
- **409** - container is paused
|
||||
- **500** - server error
|
||||
|
||||
### Exec Start
|
||||
#### Exec Start
|
||||
|
||||
`POST /exec/(id)/start`
|
||||
|
||||
|
@ -2379,7 +2377,7 @@ interactive session with the `exec` command.
|
|||
|
||||
Similar to the stream behavior of `POST /containers/(id or name)/attach` API
|
||||
|
||||
### Exec Resize
|
||||
#### Exec Resize
|
||||
|
||||
`POST /exec/(id)/resize`
|
||||
|
||||
|
@ -2406,7 +2404,7 @@ This API is valid only if `tty` was specified as part of creating and starting t
|
|||
- **201** – no error
|
||||
- **404** – no such exec instance
|
||||
|
||||
### Exec Inspect
|
||||
#### Exec Inspect
|
||||
|
||||
`GET /exec/(id)/json`
|
||||
|
||||
|
@ -2532,9 +2530,9 @@ Return low-level information about the `exec` command `id`.
|
|||
- **404** – no such exec instance
|
||||
- **500** - server error
|
||||
|
||||
## 2.4 Volumes
|
||||
### 2.4 Volumes
|
||||
|
||||
### List volumes
|
||||
#### List volumes
|
||||
|
||||
`GET /volumes`
|
||||
|
||||
|
@ -2566,7 +2564,7 @@ Return low-level information about the `exec` command `id`.
|
|||
- **200** - no error
|
||||
- **500** - server error
|
||||
|
||||
### Create a volume
|
||||
#### Create a volume
|
||||
|
||||
`POST /volumes/create`
|
||||
|
||||
|
@ -2604,7 +2602,7 @@ Create a volume
|
|||
- **DriverOpts** - A mapping of driver options and values. These options are
|
||||
passed directly to the driver and are driver specific.
|
||||
|
||||
### Inspect a volume
|
||||
#### Inspect a volume
|
||||
|
||||
`GET /volumes/(name)`
|
||||
|
||||
|
@ -2631,7 +2629,7 @@ Return low-level information on the volume `name`
|
|||
- **404** - no such volume
|
||||
- **500** - server error
|
||||
|
||||
### Remove a volume
|
||||
#### Remove a volume
|
||||
|
||||
`DELETE /volumes/(name)`
|
||||
|
||||
|
@ -2652,9 +2650,9 @@ Instruct the driver to remove the volume (`name`).
|
|||
- **409** - volume is in use and cannot be removed
|
||||
- **500** - server error
|
||||
|
||||
## 2.5 Networks
|
||||
### 2.5 Networks
|
||||
|
||||
### List networks
|
||||
#### List networks
|
||||
|
||||
`GET /networks`
|
||||
|
||||
|
@ -2735,7 +2733,7 @@ Content-Type: application/json
|
|||
- **200** - no error
|
||||
- **500** - server error
|
||||
|
||||
### Inspect network
|
||||
#### Inspect network
|
||||
|
||||
`GET /networks/<network-id>`
|
||||
|
||||
|
@ -2786,7 +2784,7 @@ Content-Type: application/json
|
|||
- **200** - no error
|
||||
- **404** - network not found
|
||||
|
||||
### Create a network
|
||||
#### Create a network
|
||||
|
||||
`POST /networks/create`
|
||||
|
||||
|
@ -2844,7 +2842,7 @@ Content-Type: application/json
|
|||
`{"Subnet": <CIDR>, "IPRange": <CIDR>, "Gateway": <IP address>, "AuxAddress": <device_name:IP address>}`
|
||||
- **Options** - Network specific options to be used by the drivers
|
||||
|
||||
### Connect a container to a network
|
||||
#### Connect a container to a network
|
||||
|
||||
`POST /networks/(id)/connect`
|
||||
|
||||
|
@ -2875,7 +2873,7 @@ Content-Type: application/json
|
|||
|
||||
- **container** - container-id/name to be connected to the network
|
||||
|
||||
### Disconnect a container from a network
|
||||
#### Disconnect a container from a network
|
||||
|
||||
`POST /networks/(id)/disconnect`
|
||||
|
||||
|
@ -2906,7 +2904,7 @@ Content-Type: application/json
|
|||
|
||||
- **Container** - container-id/name to be disconnected from a network
|
||||
|
||||
### Remove a network
|
||||
#### Remove a network
|
||||
|
||||
`DELETE /networks/(id)`
|
||||
|
||||
|
@ -2926,9 +2924,9 @@ Instruct the driver to remove the network (`id`).
|
|||
- **404** - no such network
|
||||
- **500** - server error
|
||||
|
||||
# 3. Going further
|
||||
## 3. Going further
|
||||
|
||||
## 3.1 Inside `docker run`
|
||||
### 3.1 Inside `docker run`
|
||||
|
||||
As an example, the `docker run` command line makes the following API calls:
|
||||
|
||||
|
@ -2946,7 +2944,7 @@ As an example, the `docker run` command line makes the following API calls:
|
|||
|
||||
- If in detached mode or only `stdin` is attached, display the container's id.
|
||||
|
||||
## 3.2 Hijacking
|
||||
### 3.2 Hijacking
|
||||
|
||||
In this version of the API, `/attach`, uses hijacking to transport `stdin`,
|
||||
`stdout`, and `stderr` on the same socket.
|
||||
|
@ -2961,7 +2959,7 @@ When Docker daemon detects the `Upgrade` header, it switches its status code
|
|||
from **200 OK** to **101 UPGRADED** and resends the same headers.
|
||||
|
||||
|
||||
## 3.3 CORS Requests
|
||||
### 3.3 CORS Requests
|
||||
|
||||
To set cross origin requests to the Engine API please give values to
|
||||
`--api-cors-header` when running Docker in daemon mode. Set * (asterisk) allows all,
|
||||
|
|
|
@ -16,9 +16,7 @@ redirect_from:
|
|||
will be rejected.
|
||||
-->
|
||||
|
||||
# Docker Engine API v1.22
|
||||
|
||||
# 1. Brief introduction
|
||||
## 1. Brief introduction
|
||||
|
||||
- The daemon listens on `unix:///var/run/docker.sock` but you can
|
||||
[Bind Docker to another host/port or a Unix socket](../commandline/dockerd.md#bind-docker-to-another-host-port-or-a-unix-socket).
|
||||
|
@ -26,11 +24,11 @@ redirect_from:
|
|||
or `pull`, the HTTP connection is hijacked to transport `stdout`,
|
||||
`stdin` and `stderr`.
|
||||
|
||||
# 2. Endpoints
|
||||
## 2. Endpoints
|
||||
|
||||
## 2.1 Containers
|
||||
### 2.1 Containers
|
||||
|
||||
### List containers
|
||||
#### List containers
|
||||
|
||||
`GET /containers/json`
|
||||
|
||||
|
@ -212,7 +210,7 @@ List containers
|
|||
- **400** – bad parameter
|
||||
- **500** – server error
|
||||
|
||||
### Create a container
|
||||
#### Create a container
|
||||
|
||||
`POST /containers/create`
|
||||
|
||||
|
@ -460,7 +458,7 @@ Create a container
|
|||
- **409** – conflict
|
||||
- **500** – server error
|
||||
|
||||
### Inspect a container
|
||||
#### Inspect a container
|
||||
|
||||
`GET /containers/(id or name)/json`
|
||||
|
||||
|
@ -663,7 +661,7 @@ Return low-level information on the container `id`
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### List processes running inside a container
|
||||
#### List processes running inside a container
|
||||
|
||||
`GET /containers/(id or name)/top`
|
||||
|
||||
|
@ -727,7 +725,7 @@ supported on Windows.
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Get container logs
|
||||
#### Get container logs
|
||||
|
||||
`GET /containers/(id or name)/logs`
|
||||
|
||||
|
@ -769,7 +767,7 @@ Get `stdout` and `stderr` logs from the container ``id``
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Inspect changes on a container's filesystem
|
||||
#### Inspect changes on a container's filesystem
|
||||
|
||||
`GET /containers/(id or name)/changes`
|
||||
|
||||
|
@ -811,7 +809,7 @@ Values for `Kind`:
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Export a container
|
||||
#### Export a container
|
||||
|
||||
`GET /containers/(id or name)/export`
|
||||
|
||||
|
@ -836,7 +834,7 @@ Export the contents of container `id`
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Get container stats based on resource usage
|
||||
#### Get container stats based on resource usage
|
||||
|
||||
`GET /containers/(id or name)/stats`
|
||||
|
||||
|
@ -957,7 +955,7 @@ The precpu_stats is the cpu statistic of last read, which is used for calculatin
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Resize a container TTY
|
||||
#### Resize a container TTY
|
||||
|
||||
`POST /containers/(id or name)/resize`
|
||||
|
||||
|
@ -984,7 +982,7 @@ Resize the TTY for container with `id`. The unit is number of characters. You m
|
|||
- **404** – No such container
|
||||
- **500** – Cannot resize container
|
||||
|
||||
### Start a container
|
||||
#### Start a container
|
||||
|
||||
`POST /containers/(id or name)/start`
|
||||
|
||||
|
@ -1015,7 +1013,7 @@ Start the container `id`
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Stop a container
|
||||
#### Stop a container
|
||||
|
||||
`POST /containers/(id or name)/stop`
|
||||
|
||||
|
@ -1040,7 +1038,7 @@ Stop the container `id`
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Restart a container
|
||||
#### Restart a container
|
||||
|
||||
`POST /containers/(id or name)/restart`
|
||||
|
||||
|
@ -1064,7 +1062,7 @@ Restart the container `id`
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Kill a container
|
||||
#### Kill a container
|
||||
|
||||
`POST /containers/(id or name)/kill`
|
||||
|
||||
|
@ -1089,7 +1087,7 @@ Kill the container `id`
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Update a container
|
||||
#### Update a container
|
||||
|
||||
`POST /containers/(id or name)/update`
|
||||
|
||||
|
@ -1129,7 +1127,7 @@ Update resource configs of one or more containers.
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Rename a container
|
||||
#### Rename a container
|
||||
|
||||
`POST /containers/(id or name)/rename`
|
||||
|
||||
|
@ -1154,7 +1152,7 @@ Rename the container `id` to a `new_name`
|
|||
- **409** - conflict name already assigned
|
||||
- **500** – server error
|
||||
|
||||
### Pause a container
|
||||
#### Pause a container
|
||||
|
||||
`POST /containers/(id or name)/pause`
|
||||
|
||||
|
@ -1174,7 +1172,7 @@ Pause the container `id`
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Unpause a container
|
||||
#### Unpause a container
|
||||
|
||||
`POST /containers/(id or name)/unpause`
|
||||
|
||||
|
@ -1194,7 +1192,7 @@ Unpause the container `id`
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Attach to a container
|
||||
#### Attach to a container
|
||||
|
||||
`POST /containers/(id or name)/attach`
|
||||
|
||||
|
@ -1283,7 +1281,7 @@ The simplest way to implement the Attach protocol is the following:
|
|||
4. Read the extracted size and output it on the correct output.
|
||||
5. Goto 1.
|
||||
|
||||
### Attach to a container (websocket)
|
||||
#### Attach to a container (websocket)
|
||||
|
||||
`GET /containers/(id or name)/attach/ws`
|
||||
|
||||
|
@ -1323,7 +1321,7 @@ Implements websocket protocol handshake according to [RFC 6455](http://tools.iet
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Wait a container
|
||||
#### Wait a container
|
||||
|
||||
`POST /containers/(id or name)/wait`
|
||||
|
||||
|
@ -1346,7 +1344,7 @@ Block until container `id` stops, then returns the exit code
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Remove a container
|
||||
#### Remove a container
|
||||
|
||||
`DELETE /containers/(id or name)`
|
||||
|
||||
|
@ -1375,7 +1373,7 @@ Remove the container `id` from the filesystem
|
|||
- **409** – conflict
|
||||
- **500** – server error
|
||||
|
||||
### Copy files or folders from a container
|
||||
#### Copy files or folders from a container
|
||||
|
||||
`POST /containers/(id or name)/copy`
|
||||
|
||||
|
@ -1407,14 +1405,14 @@ Copy files or folders of container `id`
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Retrieving information about files and folders in a container
|
||||
#### Retrieving information about files and folders in a container
|
||||
|
||||
`HEAD /containers/(id or name)/archive`
|
||||
|
||||
See the description of the `X-Docker-Container-Path-Stat` header in the
|
||||
following section.
|
||||
|
||||
### Get an archive of a filesystem resource in a container
|
||||
#### Get an archive of a filesystem resource in a container
|
||||
|
||||
`GET /containers/(id or name)/archive`
|
||||
|
||||
|
@ -1479,7 +1477,7 @@ desired.
|
|||
- no such file or directory (**path** does not exist)
|
||||
- **500** - server error
|
||||
|
||||
### Extract an archive of files or folders to a directory in a container
|
||||
#### Extract an archive of files or folders to a directory in a container
|
||||
|
||||
`PUT /containers/(id or name)/archive`
|
||||
|
||||
|
@ -1527,9 +1525,9 @@ Upload a tar archive to be extracted to a path in the filesystem of container
|
|||
- no such file or directory (**path** resource does not exist)
|
||||
- **500** – server error
|
||||
|
||||
## 2.2 Images
|
||||
### 2.2 Images
|
||||
|
||||
### List Images
|
||||
#### List Images
|
||||
|
||||
`GET /images/json`
|
||||
|
||||
|
@ -1620,7 +1618,7 @@ references on the command line.
|
|||
- `label=key` or `label="key=value"` of an image label
|
||||
- **filter** - only return images with the specified name
|
||||
|
||||
### Build image from a Dockerfile
|
||||
#### Build image from a Dockerfile
|
||||
|
||||
`POST /build`
|
||||
|
||||
|
@ -1725,7 +1723,7 @@ or being killed.
|
|||
- **200** – no error
|
||||
- **500** – server error
|
||||
|
||||
### Create an image
|
||||
#### Create an image
|
||||
|
||||
`POST /images/create`
|
||||
|
||||
|
@ -1791,7 +1789,7 @@ a base64-encoded AuthConfig object.
|
|||
|
||||
|
||||
|
||||
### Inspect an image
|
||||
#### Inspect an image
|
||||
|
||||
`GET /images/(name)/json`
|
||||
|
||||
|
@ -1902,7 +1900,7 @@ Return low-level information on the image `name`
|
|||
- **404** – no such image
|
||||
- **500** – server error
|
||||
|
||||
### Get the history of an image
|
||||
#### Get the history of an image
|
||||
|
||||
`GET /images/(name)/history`
|
||||
|
||||
|
@ -1956,7 +1954,7 @@ Return the history of the image `name`
|
|||
- **404** – no such image
|
||||
- **500** – server error
|
||||
|
||||
### Push an image on the registry
|
||||
#### Push an image on the registry
|
||||
|
||||
`POST /images/(name)/push`
|
||||
|
||||
|
@ -2018,7 +2016,7 @@ The push is cancelled if the HTTP connection is closed.
|
|||
- **404** – no such image
|
||||
- **500** – server error
|
||||
|
||||
### Tag an image into a repository
|
||||
#### Tag an image into a repository
|
||||
|
||||
`POST /images/(name)/tag`
|
||||
|
||||
|
@ -2046,7 +2044,7 @@ Tag the image `name` into a repository
|
|||
- **409** – conflict
|
||||
- **500** – server error
|
||||
|
||||
### Remove an image
|
||||
#### Remove an image
|
||||
|
||||
`DELETE /images/(name)`
|
||||
|
||||
|
@ -2079,7 +2077,7 @@ Remove the image `name` from the filesystem
|
|||
- **409** – conflict
|
||||
- **500** – server error
|
||||
|
||||
### Search images
|
||||
#### Search images
|
||||
|
||||
`GET /images/search`
|
||||
|
||||
|
@ -2132,9 +2130,9 @@ Search for an image on [Docker Hub](https://hub.docker.com).
|
|||
- **200** – no error
|
||||
- **500** – server error
|
||||
|
||||
## 2.3 Misc
|
||||
### 2.3 Misc
|
||||
|
||||
### Check auth configuration
|
||||
#### Check auth configuration
|
||||
|
||||
`POST /auth`
|
||||
|
||||
|
@ -2162,7 +2160,7 @@ Get the default username and email
|
|||
- **204** – no error
|
||||
- **500** – server error
|
||||
|
||||
### Display system-wide information
|
||||
#### Display system-wide information
|
||||
|
||||
`GET /info`
|
||||
|
||||
|
@ -2249,7 +2247,7 @@ Display system-wide information
|
|||
- **200** – no error
|
||||
- **500** – server error
|
||||
|
||||
### Show the docker version information
|
||||
#### Show the docker version information
|
||||
|
||||
`GET /version`
|
||||
|
||||
|
@ -2281,7 +2279,7 @@ Show the docker version information
|
|||
- **200** – no error
|
||||
- **500** – server error
|
||||
|
||||
### Ping the docker server
|
||||
#### Ping the docker server
|
||||
|
||||
`GET /_ping`
|
||||
|
||||
|
@ -2303,7 +2301,7 @@ Ping the docker server
|
|||
- **200** - no error
|
||||
- **500** - server error
|
||||
|
||||
### Create a new image from a container's changes
|
||||
#### Create a new image from a container's changes
|
||||
|
||||
`POST /commit`
|
||||
|
||||
|
@ -2375,7 +2373,7 @@ Create a new image from a container's changes
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Monitor Docker's events
|
||||
#### Monitor Docker's events
|
||||
|
||||
`GET /events`
|
||||
|
||||
|
@ -2575,7 +2573,7 @@ Docker networks report the following events:
|
|||
- **200** – no error
|
||||
- **500** – server error
|
||||
|
||||
### Get a tarball containing all images in a repository
|
||||
#### Get a tarball containing all images in a repository
|
||||
|
||||
`GET /images/(name)/get`
|
||||
|
||||
|
@ -2605,7 +2603,7 @@ See the [image tarball format](#image-tarball-format) for more details.
|
|||
- **200** – no error
|
||||
- **500** – server error
|
||||
|
||||
### Get a tarball containing all images
|
||||
#### Get a tarball containing all images
|
||||
|
||||
`GET /images/get`
|
||||
|
||||
|
@ -2634,7 +2632,7 @@ See the [image tarball format](#image-tarball-format) for more details.
|
|||
- **200** – no error
|
||||
- **500** – server error
|
||||
|
||||
### Load a tarball with a set of images and tags into docker
|
||||
#### Load a tarball with a set of images and tags into docker
|
||||
|
||||
`POST /images/load`
|
||||
|
||||
|
@ -2657,7 +2655,7 @@ See the [image tarball format](#image-tarball-format) for more details.
|
|||
- **200** – no error
|
||||
- **500** – server error
|
||||
|
||||
### Image tarball format
|
||||
#### Image tarball format
|
||||
|
||||
An image tarball contains one directory per image layer (named using its long ID),
|
||||
each containing these files:
|
||||
|
@ -2678,7 +2676,7 @@ the root that contains a list of repository and tag names mapped to layer IDs.
|
|||
}
|
||||
```
|
||||
|
||||
### Exec Create
|
||||
#### Exec Create
|
||||
|
||||
`POST /containers/(id or name)/exec`
|
||||
|
||||
|
@ -2732,7 +2730,7 @@ Sets up an exec instance in a running container `id`
|
|||
- **409** - container is paused
|
||||
- **500** - server error
|
||||
|
||||
### Exec Start
|
||||
#### Exec Start
|
||||
|
||||
`POST /exec/(id)/start`
|
||||
|
||||
|
@ -2774,7 +2772,7 @@ interactive session with the `exec` command.
|
|||
|
||||
Similar to the stream behavior of `POST /containers/(id or name)/attach` API
|
||||
|
||||
### Exec Resize
|
||||
#### Exec Resize
|
||||
|
||||
`POST /exec/(id)/resize`
|
||||
|
||||
|
@ -2801,7 +2799,7 @@ This API is valid only if `tty` was specified as part of creating and starting t
|
|||
- **201** – no error
|
||||
- **404** – no such exec instance
|
||||
|
||||
### Exec Inspect
|
||||
#### Exec Inspect
|
||||
|
||||
`GET /exec/(id)/json`
|
||||
|
||||
|
@ -2844,9 +2842,9 @@ Return low-level information about the `exec` command `id`.
|
|||
- **404** – no such exec instance
|
||||
- **500** - server error
|
||||
|
||||
## 2.4 Volumes
|
||||
### 2.4 Volumes
|
||||
|
||||
### List volumes
|
||||
#### List volumes
|
||||
|
||||
`GET /volumes`
|
||||
|
||||
|
@ -2879,7 +2877,7 @@ Return low-level information about the `exec` command `id`.
|
|||
- **200** - no error
|
||||
- **500** - server error
|
||||
|
||||
### Create a volume
|
||||
#### Create a volume
|
||||
|
||||
`POST /volumes/create`
|
||||
|
||||
|
@ -2917,7 +2915,7 @@ Create a volume
|
|||
- **DriverOpts** - A mapping of driver options and values. These options are
|
||||
passed directly to the driver and are driver specific.
|
||||
|
||||
### Inspect a volume
|
||||
#### Inspect a volume
|
||||
|
||||
`GET /volumes/(name)`
|
||||
|
||||
|
@ -2944,7 +2942,7 @@ Return low-level information on the volume `name`
|
|||
- **404** - no such volume
|
||||
- **500** - server error
|
||||
|
||||
### Remove a volume
|
||||
#### Remove a volume
|
||||
|
||||
`DELETE /volumes/(name)`
|
||||
|
||||
|
@ -2965,9 +2963,9 @@ Instruct the driver to remove the volume (`name`).
|
|||
- **409** - volume is in use and cannot be removed
|
||||
- **500** - server error
|
||||
|
||||
## 2.5 Networks
|
||||
### 2.5 Networks
|
||||
|
||||
### List networks
|
||||
#### List networks
|
||||
|
||||
`GET /networks`
|
||||
|
||||
|
@ -3051,7 +3049,7 @@ Content-Type: application/json
|
|||
- **200** - no error
|
||||
- **500** - server error
|
||||
|
||||
### Inspect network
|
||||
#### Inspect network
|
||||
|
||||
`GET /networks/<network-id>`
|
||||
|
||||
|
@ -3107,7 +3105,7 @@ Content-Type: application/json
|
|||
- **200** - no error
|
||||
- **404** - network not found
|
||||
|
||||
### Create a network
|
||||
#### Create a network
|
||||
|
||||
`POST /networks/create`
|
||||
|
||||
|
@ -3174,7 +3172,7 @@ Content-Type: application/json
|
|||
- **Options** - Driver-specific options, specified as a map: `{"option":"value" [,"option2":"value2"]}`
|
||||
- **Options** - Network specific options to be used by the drivers
|
||||
|
||||
### Connect a container to a network
|
||||
#### Connect a container to a network
|
||||
|
||||
`POST /networks/(id)/connect`
|
||||
|
||||
|
@ -3211,7 +3209,7 @@ Content-Type: application/json
|
|||
|
||||
- **container** - container-id/name to be connected to the network
|
||||
|
||||
### Disconnect a container from a network
|
||||
#### Disconnect a container from a network
|
||||
|
||||
`POST /networks/(id)/disconnect`
|
||||
|
||||
|
@ -3244,7 +3242,7 @@ Content-Type: application/json
|
|||
- **Container** - container-id/name to be disconnected from a network
|
||||
- **Force** - Force the container to disconnect from a network
|
||||
|
||||
### Remove a network
|
||||
#### Remove a network
|
||||
|
||||
`DELETE /networks/(id)`
|
||||
|
||||
|
@ -3264,9 +3262,9 @@ Instruct the driver to remove the network (`id`).
|
|||
- **404** - no such network
|
||||
- **500** - server error
|
||||
|
||||
# 3. Going further
|
||||
## 3. Going further
|
||||
|
||||
## 3.1 Inside `docker run`
|
||||
### 3.1 Inside `docker run`
|
||||
|
||||
As an example, the `docker run` command line makes the following API calls:
|
||||
|
||||
|
@ -3284,7 +3282,7 @@ As an example, the `docker run` command line makes the following API calls:
|
|||
|
||||
- If in detached mode or only `stdin` is attached, display the container's id.
|
||||
|
||||
## 3.2 Hijacking
|
||||
### 3.2 Hijacking
|
||||
|
||||
In this version of the API, `/attach`, uses hijacking to transport `stdin`,
|
||||
`stdout`, and `stderr` on the same socket.
|
||||
|
@ -3299,7 +3297,7 @@ When Docker daemon detects the `Upgrade` header, it switches its status code
|
|||
from **200 OK** to **101 UPGRADED** and resends the same headers.
|
||||
|
||||
|
||||
## 3.3 CORS Requests
|
||||
### 3.3 CORS Requests
|
||||
|
||||
To set cross origin requests to the Engine API please give values to
|
||||
`--api-cors-header` when running Docker in daemon mode. Set * (asterisk) allows all,
|
||||
|
|
|
@ -16,8 +16,6 @@ redirect_from:
|
|||
will be rejected.
|
||||
-->
|
||||
|
||||
# Docker Engine API v1.23
|
||||
|
||||
## 1. Brief introduction
|
||||
|
||||
- The daemon listens on `unix:///var/run/docker.sock` but you can
|
||||
|
@ -28,11 +26,11 @@ redirect_from:
|
|||
- When the client API version is newer than the daemon's, these calls return an HTTP
|
||||
`400 Bad Request` error message.
|
||||
|
||||
# 2. Endpoints
|
||||
## 2. Endpoints
|
||||
|
||||
## 2.1 Containers
|
||||
### 2.1 Containers
|
||||
|
||||
### List containers
|
||||
#### List containers
|
||||
|
||||
`GET /containers/json`
|
||||
|
||||
|
@ -236,7 +234,7 @@ List containers
|
|||
- **400** – bad parameter
|
||||
- **500** – server error
|
||||
|
||||
### Create a container
|
||||
#### Create a container
|
||||
|
||||
`POST /containers/create`
|
||||
|
||||
|
@ -488,7 +486,7 @@ Create a container
|
|||
- **409** – conflict
|
||||
- **500** – server error
|
||||
|
||||
### Inspect a container
|
||||
#### Inspect a container
|
||||
|
||||
`GET /containers/(id or name)/json`
|
||||
|
||||
|
@ -691,7 +689,7 @@ Return low-level information on the container `id`
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### List processes running inside a container
|
||||
#### List processes running inside a container
|
||||
|
||||
`GET /containers/(id or name)/top`
|
||||
|
||||
|
@ -755,7 +753,7 @@ supported on Windows.
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Get container logs
|
||||
#### Get container logs
|
||||
|
||||
`GET /containers/(id or name)/logs`
|
||||
|
||||
|
@ -797,7 +795,7 @@ Get `stdout` and `stderr` logs from the container ``id``
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Inspect changes on a container's filesystem
|
||||
#### Inspect changes on a container's filesystem
|
||||
|
||||
`GET /containers/(id or name)/changes`
|
||||
|
||||
|
@ -839,7 +837,7 @@ Values for `Kind`:
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Export a container
|
||||
#### Export a container
|
||||
|
||||
`GET /containers/(id or name)/export`
|
||||
|
||||
|
@ -864,7 +862,7 @@ Export the contents of container `id`
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Get container stats based on resource usage
|
||||
#### Get container stats based on resource usage
|
||||
|
||||
`GET /containers/(id or name)/stats`
|
||||
|
||||
|
@ -988,7 +986,7 @@ The precpu_stats is the cpu statistic of last read, which is used for calculatin
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Resize a container TTY
|
||||
#### Resize a container TTY
|
||||
|
||||
`POST /containers/(id or name)/resize`
|
||||
|
||||
|
@ -1015,7 +1013,7 @@ Resize the TTY for container with `id`. The unit is number of characters. You m
|
|||
- **404** – No such container
|
||||
- **500** – Cannot resize container
|
||||
|
||||
### Start a container
|
||||
#### Start a container
|
||||
|
||||
`POST /containers/(id or name)/start`
|
||||
|
||||
|
@ -1046,7 +1044,7 @@ Start the container `id`
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Stop a container
|
||||
#### Stop a container
|
||||
|
||||
`POST /containers/(id or name)/stop`
|
||||
|
||||
|
@ -1071,7 +1069,7 @@ Stop the container `id`
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Restart a container
|
||||
#### Restart a container
|
||||
|
||||
`POST /containers/(id or name)/restart`
|
||||
|
||||
|
@ -1095,7 +1093,7 @@ Restart the container `id`
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Kill a container
|
||||
#### Kill a container
|
||||
|
||||
`POST /containers/(id or name)/kill`
|
||||
|
||||
|
@ -1120,7 +1118,7 @@ Kill the container `id`
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Update a container
|
||||
#### Update a container
|
||||
|
||||
`POST /containers/(id or name)/update`
|
||||
|
||||
|
@ -1164,7 +1162,7 @@ Update configuration of one or more containers.
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Rename a container
|
||||
#### Rename a container
|
||||
|
||||
`POST /containers/(id or name)/rename`
|
||||
|
||||
|
@ -1189,7 +1187,7 @@ Rename the container `id` to a `new_name`
|
|||
- **409** - conflict name already assigned
|
||||
- **500** – server error
|
||||
|
||||
### Pause a container
|
||||
#### Pause a container
|
||||
|
||||
`POST /containers/(id or name)/pause`
|
||||
|
||||
|
@ -1209,7 +1207,7 @@ Pause the container `id`
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Unpause a container
|
||||
#### Unpause a container
|
||||
|
||||
`POST /containers/(id or name)/unpause`
|
||||
|
||||
|
@ -1229,7 +1227,7 @@ Unpause the container `id`
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Attach to a container
|
||||
#### Attach to a container
|
||||
|
||||
`POST /containers/(id or name)/attach`
|
||||
|
||||
|
@ -1318,7 +1316,7 @@ The simplest way to implement the Attach protocol is the following:
|
|||
4. Read the extracted size and output it on the correct output.
|
||||
5. Goto 1.
|
||||
|
||||
### Attach to a container (websocket)
|
||||
#### Attach to a container (websocket)
|
||||
|
||||
`GET /containers/(id or name)/attach/ws`
|
||||
|
||||
|
@ -1358,7 +1356,7 @@ Implements websocket protocol handshake according to [RFC 6455](http://tools.iet
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Wait a container
|
||||
#### Wait a container
|
||||
|
||||
`POST /containers/(id or name)/wait`
|
||||
|
||||
|
@ -1381,7 +1379,7 @@ Block until container `id` stops, then returns the exit code
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Remove a container
|
||||
#### Remove a container
|
||||
|
||||
`DELETE /containers/(id or name)`
|
||||
|
||||
|
@ -1410,7 +1408,7 @@ Remove the container `id` from the filesystem
|
|||
- **409** – conflict
|
||||
- **500** – server error
|
||||
|
||||
### Copy files or folders from a container
|
||||
#### Copy files or folders from a container
|
||||
|
||||
`POST /containers/(id or name)/copy`
|
||||
|
||||
|
@ -1442,14 +1440,14 @@ Copy files or folders of container `id`
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Retrieving information about files and folders in a container
|
||||
#### Retrieving information about files and folders in a container
|
||||
|
||||
`HEAD /containers/(id or name)/archive`
|
||||
|
||||
See the description of the `X-Docker-Container-Path-Stat` header in the
|
||||
following section.
|
||||
|
||||
### Get an archive of a filesystem resource in a container
|
||||
#### Get an archive of a filesystem resource in a container
|
||||
|
||||
`GET /containers/(id or name)/archive`
|
||||
|
||||
|
@ -1514,7 +1512,7 @@ desired.
|
|||
- no such file or directory (**path** does not exist)
|
||||
- **500** - server error
|
||||
|
||||
### Extract an archive of files or folders to a directory in a container
|
||||
#### Extract an archive of files or folders to a directory in a container
|
||||
|
||||
`PUT /containers/(id or name)/archive`
|
||||
|
||||
|
@ -1562,9 +1560,9 @@ Upload a tar archive to be extracted to a path in the filesystem of container
|
|||
- no such file or directory (**path** resource does not exist)
|
||||
- **500** – server error
|
||||
|
||||
## 2.2 Images
|
||||
### 2.2 Images
|
||||
|
||||
### List Images
|
||||
#### List Images
|
||||
|
||||
`GET /images/json`
|
||||
|
||||
|
@ -1655,7 +1653,7 @@ references on the command line.
|
|||
- `label=key` or `label="key=value"` of an image label
|
||||
- **filter** - only return images with the specified name
|
||||
|
||||
### Build image from a Dockerfile
|
||||
#### Build image from a Dockerfile
|
||||
|
||||
`POST /build`
|
||||
|
||||
|
@ -1761,7 +1759,7 @@ or being killed.
|
|||
- **200** – no error
|
||||
- **500** – server error
|
||||
|
||||
### Create an image
|
||||
#### Create an image
|
||||
|
||||
`POST /images/create`
|
||||
|
||||
|
@ -1827,7 +1825,7 @@ a base64-encoded AuthConfig object.
|
|||
|
||||
|
||||
|
||||
### Inspect an image
|
||||
#### Inspect an image
|
||||
|
||||
`GET /images/(name)/json`
|
||||
|
||||
|
@ -1945,7 +1943,7 @@ Return low-level information on the image `name`
|
|||
- **404** – no such image
|
||||
- **500** – server error
|
||||
|
||||
### Get the history of an image
|
||||
#### Get the history of an image
|
||||
|
||||
`GET /images/(name)/history`
|
||||
|
||||
|
@ -1999,7 +1997,7 @@ Return the history of the image `name`
|
|||
- **404** – no such image
|
||||
- **500** – server error
|
||||
|
||||
### Push an image on the registry
|
||||
#### Push an image on the registry
|
||||
|
||||
`POST /images/(name)/push`
|
||||
|
||||
|
@ -2061,7 +2059,7 @@ The push is cancelled if the HTTP connection is closed.
|
|||
- **404** – no such image
|
||||
- **500** – server error
|
||||
|
||||
### Tag an image into a repository
|
||||
#### Tag an image into a repository
|
||||
|
||||
`POST /images/(name)/tag`
|
||||
|
||||
|
@ -2089,7 +2087,7 @@ Tag the image `name` into a repository
|
|||
- **409** – conflict
|
||||
- **500** – server error
|
||||
|
||||
### Remove an image
|
||||
#### Remove an image
|
||||
|
||||
`DELETE /images/(name)`
|
||||
|
||||
|
@ -2122,7 +2120,7 @@ Remove the image `name` from the filesystem
|
|||
- **409** – conflict
|
||||
- **500** – server error
|
||||
|
||||
### Search images
|
||||
#### Search images
|
||||
|
||||
`GET /images/search`
|
||||
|
||||
|
@ -2175,9 +2173,9 @@ Search for an image on [Docker Hub](https://hub.docker.com).
|
|||
- **200** – no error
|
||||
- **500** – server error
|
||||
|
||||
## 2.3 Misc
|
||||
### 2.3 Misc
|
||||
|
||||
### Check auth configuration
|
||||
#### Check auth configuration
|
||||
|
||||
`POST /auth`
|
||||
|
||||
|
@ -2210,7 +2208,7 @@ if available, for accessing the registry without password.
|
|||
- **204** – no error
|
||||
- **500** – server error
|
||||
|
||||
### Display system-wide information
|
||||
#### Display system-wide information
|
||||
|
||||
`GET /info`
|
||||
|
||||
|
@ -2299,7 +2297,7 @@ Display system-wide information
|
|||
- **200** – no error
|
||||
- **500** – server error
|
||||
|
||||
### Show the docker version information
|
||||
#### Show the docker version information
|
||||
|
||||
`GET /version`
|
||||
|
||||
|
@ -2331,7 +2329,7 @@ Show the docker version information
|
|||
- **200** – no error
|
||||
- **500** – server error
|
||||
|
||||
### Ping the docker server
|
||||
#### Ping the docker server
|
||||
|
||||
`GET /_ping`
|
||||
|
||||
|
@ -2353,7 +2351,7 @@ Ping the docker server
|
|||
- **200** - no error
|
||||
- **500** - server error
|
||||
|
||||
### Create a new image from a container's changes
|
||||
#### Create a new image from a container's changes
|
||||
|
||||
`POST /commit`
|
||||
|
||||
|
@ -2425,7 +2423,7 @@ Create a new image from a container's changes
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Monitor Docker's events
|
||||
#### Monitor Docker's events
|
||||
|
||||
`GET /events`
|
||||
|
||||
|
@ -2625,7 +2623,7 @@ Docker networks report the following events:
|
|||
- **200** – no error
|
||||
- **500** – server error
|
||||
|
||||
### Get a tarball containing all images in a repository
|
||||
#### Get a tarball containing all images in a repository
|
||||
|
||||
`GET /images/(name)/get`
|
||||
|
||||
|
@ -2655,7 +2653,7 @@ See the [image tarball format](#image-tarball-format) for more details.
|
|||
- **200** – no error
|
||||
- **500** – server error
|
||||
|
||||
### Get a tarball containing all images
|
||||
#### Get a tarball containing all images
|
||||
|
||||
`GET /images/get`
|
||||
|
||||
|
@ -2684,7 +2682,7 @@ See the [image tarball format](#image-tarball-format) for more details.
|
|||
- **200** – no error
|
||||
- **500** – server error
|
||||
|
||||
### Load a tarball with a set of images and tags into docker
|
||||
#### Load a tarball with a set of images and tags into docker
|
||||
|
||||
`POST /images/load`
|
||||
|
||||
|
@ -2733,7 +2731,7 @@ action completes.
|
|||
- **200** – no error
|
||||
- **500** – server error
|
||||
|
||||
### Image tarball format
|
||||
#### Image tarball format
|
||||
|
||||
An image tarball contains one directory per image layer (named using its long ID),
|
||||
each containing these files:
|
||||
|
@ -2754,7 +2752,7 @@ the root that contains a list of repository and tag names mapped to layer IDs.
|
|||
}
|
||||
```
|
||||
|
||||
### Exec Create
|
||||
#### Exec Create
|
||||
|
||||
`POST /containers/(id or name)/exec`
|
||||
|
||||
|
@ -2808,7 +2806,7 @@ Sets up an exec instance in a running container `id`
|
|||
- **409** - container is paused
|
||||
- **500** - server error
|
||||
|
||||
### Exec Start
|
||||
#### Exec Start
|
||||
|
||||
`POST /exec/(id)/start`
|
||||
|
||||
|
@ -2850,7 +2848,7 @@ interactive session with the `exec` command.
|
|||
|
||||
Similar to the stream behavior of `POST /containers/(id or name)/attach` API
|
||||
|
||||
### Exec Resize
|
||||
#### Exec Resize
|
||||
|
||||
`POST /exec/(id)/resize`
|
||||
|
||||
|
@ -2877,7 +2875,7 @@ This API is valid only if `tty` was specified as part of creating and starting t
|
|||
- **201** – no error
|
||||
- **404** – no such exec instance
|
||||
|
||||
### Exec Inspect
|
||||
#### Exec Inspect
|
||||
|
||||
`GET /exec/(id)/json`
|
||||
|
||||
|
@ -2920,9 +2918,9 @@ Return low-level information about the `exec` command `id`.
|
|||
- **404** – no such exec instance
|
||||
- **500** - server error
|
||||
|
||||
## 2.4 Volumes
|
||||
### 2.4 Volumes
|
||||
|
||||
### List volumes
|
||||
#### List volumes
|
||||
|
||||
`GET /volumes`
|
||||
|
||||
|
@ -2955,7 +2953,7 @@ Return low-level information about the `exec` command `id`.
|
|||
- **200** - no error
|
||||
- **500** - server error
|
||||
|
||||
### Create a volume
|
||||
#### Create a volume
|
||||
|
||||
`POST /volumes/create`
|
||||
|
||||
|
@ -3002,7 +3000,7 @@ Create a volume
|
|||
passed directly to the driver and are driver specific.
|
||||
- **Labels** - Labels to set on the volume, specified as a map: `{"key":"value","key2":"value2"}`
|
||||
|
||||
### Inspect a volume
|
||||
#### Inspect a volume
|
||||
|
||||
`GET /volumes/(name)`
|
||||
|
||||
|
@ -3033,7 +3031,7 @@ Return low-level information on the volume `name`
|
|||
- **404** - no such volume
|
||||
- **500** - server error
|
||||
|
||||
### Remove a volume
|
||||
#### Remove a volume
|
||||
|
||||
`DELETE /volumes/(name)`
|
||||
|
||||
|
@ -3054,9 +3052,9 @@ Instruct the driver to remove the volume (`name`).
|
|||
- **409** - volume is in use and cannot be removed
|
||||
- **500** - server error
|
||||
|
||||
## 3.5 Networks
|
||||
### 3.5 Networks
|
||||
|
||||
### List networks
|
||||
#### List networks
|
||||
|
||||
`GET /networks`
|
||||
|
||||
|
@ -3146,7 +3144,7 @@ Content-Type: application/json
|
|||
- **200** - no error
|
||||
- **500** - server error
|
||||
|
||||
### Inspect network
|
||||
#### Inspect network
|
||||
|
||||
`GET /networks/<network-id>`
|
||||
|
||||
|
@ -3208,7 +3206,7 @@ Content-Type: application/json
|
|||
- **200** - no error
|
||||
- **404** - network not found
|
||||
|
||||
### Create a network
|
||||
#### Create a network
|
||||
|
||||
`POST /networks/create`
|
||||
|
||||
|
@ -3291,7 +3289,7 @@ Content-Type: application/json
|
|||
- **Options** - Network specific options to be used by the drivers
|
||||
- **Labels** - Labels to set on the network, specified as a map: `{"key":"value" [,"key2":"value2"]}`
|
||||
|
||||
### Connect a container to a network
|
||||
#### Connect a container to a network
|
||||
|
||||
`POST /networks/(id)/connect`
|
||||
|
||||
|
@ -3328,7 +3326,7 @@ Content-Type: application/json
|
|||
|
||||
- **container** - container-id/name to be connected to the network
|
||||
|
||||
### Disconnect a container from a network
|
||||
#### Disconnect a container from a network
|
||||
|
||||
`POST /networks/(id)/disconnect`
|
||||
|
||||
|
@ -3361,7 +3359,7 @@ Content-Type: application/json
|
|||
- **Container** - container-id/name to be disconnected from a network
|
||||
- **Force** - Force the container to disconnect from a network
|
||||
|
||||
### Remove a network
|
||||
#### Remove a network
|
||||
|
||||
`DELETE /networks/(id)`
|
||||
|
||||
|
@ -3381,9 +3379,9 @@ Instruct the driver to remove the network (`id`).
|
|||
- **404** - no such network
|
||||
- **500** - server error
|
||||
|
||||
# 3. Going further
|
||||
## 3. Going further
|
||||
|
||||
## 3.1 Inside `docker run`
|
||||
### 3.1 Inside `docker run`
|
||||
|
||||
As an example, the `docker run` command line makes the following API calls:
|
||||
|
||||
|
@ -3401,7 +3399,7 @@ As an example, the `docker run` command line makes the following API calls:
|
|||
|
||||
- If in detached mode or only `stdin` is attached, display the container's id.
|
||||
|
||||
## 3.2 Hijacking
|
||||
### 3.2 Hijacking
|
||||
|
||||
In this version of the API, `/attach`, uses hijacking to transport `stdin`,
|
||||
`stdout`, and `stderr` on the same socket.
|
||||
|
@ -3416,7 +3414,7 @@ When Docker daemon detects the `Upgrade` header, it switches its status code
|
|||
from **200 OK** to **101 UPGRADED** and resends the same headers.
|
||||
|
||||
|
||||
## 3.3 CORS Requests
|
||||
### 3.3 CORS Requests
|
||||
|
||||
To set cross origin requests to the Engine API please give values to
|
||||
`--api-cors-header` when running Docker in daemon mode. Set * (asterisk) allows all,
|
||||
|
|
|
@ -16,9 +16,7 @@ redirect_from:
|
|||
will be rejected.
|
||||
-->
|
||||
|
||||
# Docker Engine API v1.24
|
||||
|
||||
# 1. Brief introduction
|
||||
## 1. Brief introduction
|
||||
|
||||
- The daemon listens on `unix:///var/run/docker.sock` but you can
|
||||
[Bind Docker to another host/port or a Unix socket](../commandline/dockerd.md#bind-docker-to-another-host-port-or-a-unix-socket).
|
||||
|
@ -26,7 +24,7 @@ redirect_from:
|
|||
or `pull`, the HTTP connection is hijacked to transport `stdout`,
|
||||
`stdin` and `stderr`.
|
||||
|
||||
# 2. Errors
|
||||
## 2. Errors
|
||||
|
||||
The Engine API uses standard HTTP status codes to indicate the success or failure of the API call. The body of the response will be JSON in the following format:
|
||||
|
||||
|
@ -36,11 +34,11 @@ The Engine API uses standard HTTP status codes to indicate the success or failur
|
|||
|
||||
The status codes that are returned for each endpoint are specified in the endpoint documentation below.
|
||||
|
||||
# 3. Endpoints
|
||||
## 3. Endpoints
|
||||
|
||||
## 3.1 Containers
|
||||
### 3.1 Containers
|
||||
|
||||
### List containers
|
||||
#### List containers
|
||||
|
||||
`GET /containers/json`
|
||||
|
||||
|
@ -245,7 +243,7 @@ List containers
|
|||
- **400** – bad parameter
|
||||
- **500** – server error
|
||||
|
||||
### Create a container
|
||||
#### Create a container
|
||||
|
||||
`POST /containers/create`
|
||||
|
||||
|
@ -511,7 +509,7 @@ Create a container
|
|||
- **409** – conflict
|
||||
- **500** – server error
|
||||
|
||||
### Inspect a container
|
||||
#### Inspect a container
|
||||
|
||||
`GET /containers/(id or name)/json`
|
||||
|
||||
|
@ -721,7 +719,7 @@ Return low-level information on the container `id`
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### List processes running inside a container
|
||||
#### List processes running inside a container
|
||||
|
||||
`GET /containers/(id or name)/top`
|
||||
|
||||
|
@ -785,7 +783,7 @@ supported on Windows.
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Get container logs
|
||||
#### Get container logs
|
||||
|
||||
`GET /containers/(id or name)/logs`
|
||||
|
||||
|
@ -828,7 +826,7 @@ Get `stdout` and `stderr` logs from the container ``id``
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Inspect changes on a container's filesystem
|
||||
#### Inspect changes on a container's filesystem
|
||||
|
||||
`GET /containers/(id or name)/changes`
|
||||
|
||||
|
@ -870,7 +868,7 @@ Values for `Kind`:
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Export a container
|
||||
#### Export a container
|
||||
|
||||
`GET /containers/(id or name)/export`
|
||||
|
||||
|
@ -895,7 +893,7 @@ Export the contents of container `id`
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Get container stats based on resource usage
|
||||
#### Get container stats based on resource usage
|
||||
|
||||
`GET /containers/(id or name)/stats`
|
||||
|
||||
|
@ -1019,7 +1017,7 @@ The precpu_stats is the cpu statistic of last read, which is used for calculatin
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Resize a container TTY
|
||||
#### Resize a container TTY
|
||||
|
||||
`POST /containers/(id or name)/resize`
|
||||
|
||||
|
@ -1046,7 +1044,7 @@ Resize the TTY for container with `id`. The unit is number of characters. You m
|
|||
- **404** – No such container
|
||||
- **500** – Cannot resize container
|
||||
|
||||
### Start a container
|
||||
#### Start a container
|
||||
|
||||
`POST /containers/(id or name)/start`
|
||||
|
||||
|
@ -1073,7 +1071,7 @@ Start the container `id`
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Stop a container
|
||||
#### Stop a container
|
||||
|
||||
`POST /containers/(id or name)/stop`
|
||||
|
||||
|
@ -1098,7 +1096,7 @@ Stop the container `id`
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Restart a container
|
||||
#### Restart a container
|
||||
|
||||
`POST /containers/(id or name)/restart`
|
||||
|
||||
|
@ -1122,7 +1120,7 @@ Restart the container `id`
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Kill a container
|
||||
#### Kill a container
|
||||
|
||||
`POST /containers/(id or name)/kill`
|
||||
|
||||
|
@ -1147,7 +1145,7 @@ Kill the container `id`
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Update a container
|
||||
#### Update a container
|
||||
|
||||
`POST /containers/(id or name)/update`
|
||||
|
||||
|
@ -1191,7 +1189,7 @@ Update configuration of one or more containers.
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Rename a container
|
||||
#### Rename a container
|
||||
|
||||
`POST /containers/(id or name)/rename`
|
||||
|
||||
|
@ -1216,7 +1214,7 @@ Rename the container `id` to a `new_name`
|
|||
- **409** - conflict name already assigned
|
||||
- **500** – server error
|
||||
|
||||
### Pause a container
|
||||
#### Pause a container
|
||||
|
||||
`POST /containers/(id or name)/pause`
|
||||
|
||||
|
@ -1236,7 +1234,7 @@ Pause the container `id`
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Unpause a container
|
||||
#### Unpause a container
|
||||
|
||||
`POST /containers/(id or name)/unpause`
|
||||
|
||||
|
@ -1256,7 +1254,7 @@ Unpause the container `id`
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Attach to a container
|
||||
#### Attach to a container
|
||||
|
||||
`POST /containers/(id or name)/attach`
|
||||
|
||||
|
@ -1345,7 +1343,7 @@ The simplest way to implement the Attach protocol is the following:
|
|||
4. Read the extracted size and output it on the correct output.
|
||||
5. Goto 1.
|
||||
|
||||
### Attach to a container (websocket)
|
||||
#### Attach to a container (websocket)
|
||||
|
||||
`GET /containers/(id or name)/attach/ws`
|
||||
|
||||
|
@ -1385,7 +1383,7 @@ Implements websocket protocol handshake according to [RFC 6455](http://tools.iet
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Wait a container
|
||||
#### Wait a container
|
||||
|
||||
`POST /containers/(id or name)/wait`
|
||||
|
||||
|
@ -1408,7 +1406,7 @@ Block until container `id` stops, then returns the exit code
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Remove a container
|
||||
#### Remove a container
|
||||
|
||||
`DELETE /containers/(id or name)`
|
||||
|
||||
|
@ -1437,14 +1435,14 @@ Remove the container `id` from the filesystem
|
|||
- **409** – conflict
|
||||
- **500** – server error
|
||||
|
||||
### Retrieving information about files and folders in a container
|
||||
#### Retrieving information about files and folders in a container
|
||||
|
||||
`HEAD /containers/(id or name)/archive`
|
||||
|
||||
See the description of the `X-Docker-Container-Path-Stat` header in the
|
||||
following section.
|
||||
|
||||
### Get an archive of a filesystem resource in a container
|
||||
#### Get an archive of a filesystem resource in a container
|
||||
|
||||
`GET /containers/(id or name)/archive`
|
||||
|
||||
|
@ -1509,7 +1507,7 @@ desired.
|
|||
- no such file or directory (**path** does not exist)
|
||||
- **500** - server error
|
||||
|
||||
### Extract an archive of files or folders to a directory in a container
|
||||
#### Extract an archive of files or folders to a directory in a container
|
||||
|
||||
`PUT /containers/(id or name)/archive`
|
||||
|
||||
|
@ -1557,9 +1555,9 @@ Upload a tar archive to be extracted to a path in the filesystem of container
|
|||
- no such file or directory (**path** resource does not exist)
|
||||
- **500** – server error
|
||||
|
||||
## 3.2 Images
|
||||
### 3.2 Images
|
||||
|
||||
### List Images
|
||||
#### List Images
|
||||
|
||||
`GET /images/json`
|
||||
|
||||
|
@ -1652,7 +1650,7 @@ references on the command line.
|
|||
- `since`=(`<image-name>[:<tag>]`, `<image id>` or `<image@digest>`)
|
||||
- **filter** - only return images with the specified name
|
||||
|
||||
### Build image from a Dockerfile
|
||||
#### Build image from a Dockerfile
|
||||
|
||||
`POST /build`
|
||||
|
||||
|
@ -1758,7 +1756,7 @@ or being killed.
|
|||
- **200** – no error
|
||||
- **500** – server error
|
||||
|
||||
### Create an image
|
||||
#### Create an image
|
||||
|
||||
`POST /images/create`
|
||||
|
||||
|
@ -1824,7 +1822,7 @@ a base64-encoded AuthConfig object.
|
|||
|
||||
|
||||
|
||||
### Inspect an image
|
||||
#### Inspect an image
|
||||
|
||||
`GET /images/(name)/json`
|
||||
|
||||
|
@ -1942,7 +1940,7 @@ Return low-level information on the image `name`
|
|||
- **404** – no such image
|
||||
- **500** – server error
|
||||
|
||||
### Get the history of an image
|
||||
#### Get the history of an image
|
||||
|
||||
`GET /images/(name)/history`
|
||||
|
||||
|
@ -1996,7 +1994,7 @@ Return the history of the image `name`
|
|||
- **404** – no such image
|
||||
- **500** – server error
|
||||
|
||||
### Push an image on the registry
|
||||
#### Push an image on the registry
|
||||
|
||||
`POST /images/(name)/push`
|
||||
|
||||
|
@ -2058,7 +2056,7 @@ The push is cancelled if the HTTP connection is closed.
|
|||
- **404** – no such image
|
||||
- **500** – server error
|
||||
|
||||
### Tag an image into a repository
|
||||
#### Tag an image into a repository
|
||||
|
||||
`POST /images/(name)/tag`
|
||||
|
||||
|
@ -2085,7 +2083,7 @@ Tag the image `name` into a repository
|
|||
- **409** – conflict
|
||||
- **500** – server error
|
||||
|
||||
### Remove an image
|
||||
#### Remove an image
|
||||
|
||||
`DELETE /images/(name)`
|
||||
|
||||
|
@ -2118,7 +2116,7 @@ Remove the image `name` from the filesystem
|
|||
- **409** – conflict
|
||||
- **500** – server error
|
||||
|
||||
### Search images
|
||||
#### Search images
|
||||
|
||||
`GET /images/search`
|
||||
|
||||
|
@ -2176,9 +2174,9 @@ Search for an image on [Docker Hub](https://hub.docker.com).
|
|||
- **200** – no error
|
||||
- **500** – server error
|
||||
|
||||
## 3.3 Misc
|
||||
### 3.3 Misc
|
||||
|
||||
### Check auth configuration
|
||||
#### Check auth configuration
|
||||
|
||||
`POST /auth`
|
||||
|
||||
|
@ -2211,7 +2209,7 @@ if available, for accessing the registry without password.
|
|||
- **204** – no error
|
||||
- **500** – server error
|
||||
|
||||
### Display system-wide information
|
||||
#### Display system-wide information
|
||||
|
||||
`GET /info`
|
||||
|
||||
|
@ -2304,7 +2302,7 @@ Display system-wide information
|
|||
- **200** – no error
|
||||
- **500** – server error
|
||||
|
||||
### Show the docker version information
|
||||
#### Show the docker version information
|
||||
|
||||
`GET /version`
|
||||
|
||||
|
@ -2336,7 +2334,7 @@ Show the docker version information
|
|||
- **200** – no error
|
||||
- **500** – server error
|
||||
|
||||
### Ping the docker server
|
||||
#### Ping the docker server
|
||||
|
||||
`GET /_ping`
|
||||
|
||||
|
@ -2358,7 +2356,7 @@ Ping the docker server
|
|||
- **200** - no error
|
||||
- **500** - server error
|
||||
|
||||
### Create a new image from a container's changes
|
||||
#### Create a new image from a container's changes
|
||||
|
||||
`POST /commit`
|
||||
|
||||
|
@ -2430,7 +2428,7 @@ Create a new image from a container's changes
|
|||
- **404** – no such container
|
||||
- **500** – server error
|
||||
|
||||
### Monitor Docker's events
|
||||
#### Monitor Docker's events
|
||||
|
||||
`GET /events`
|
||||
|
||||
|
@ -2635,7 +2633,7 @@ Docker daemon report the following event:
|
|||
- **200** – no error
|
||||
- **500** – server error
|
||||
|
||||
### Get a tarball containing all images in a repository
|
||||
#### Get a tarball containing all images in a repository
|
||||
|
||||
`GET /images/(name)/get`
|
||||
|
||||
|
@ -2665,7 +2663,7 @@ See the [image tarball format](#image-tarball-format) for more details.
|
|||
- **200** – no error
|
||||
- **500** – server error
|
||||
|
||||
### Get a tarball containing all images
|
||||
#### Get a tarball containing all images
|
||||
|
||||
`GET /images/get`
|
||||
|
||||
|
@ -2694,7 +2692,7 @@ See the [image tarball format](#image-tarball-format) for more details.
|
|||
- **200** – no error
|
||||
- **500** – server error
|
||||
|
||||
### Load a tarball with a set of images and tags into docker
|
||||
#### Load a tarball with a set of images and tags into docker
|
||||
|
||||
`POST /images/load`
|
||||
|
||||
|
@ -2743,7 +2741,7 @@ action completes.
|
|||
- **200** – no error
|
||||
- **500** – server error
|
||||
|
||||
### Image tarball format
|
||||
#### Image tarball format
|
||||
|
||||
An image tarball contains one directory per image layer (named using its long ID),
|
||||
each containing these files:
|
||||
|
@ -2764,7 +2762,7 @@ the root that contains a list of repository and tag names mapped to layer IDs.
|
|||
}
|
||||
```
|
||||
|
||||
### Exec Create
|
||||
#### Exec Create
|
||||
|
||||
`POST /containers/(id or name)/exec`
|
||||
|
||||
|
@ -2818,7 +2816,7 @@ Sets up an exec instance in a running container `id`
|
|||
- **409** - container is paused
|
||||
- **500** - server error
|
||||
|
||||
### Exec Start
|
||||
#### Exec Start
|
||||
|
||||
`POST /exec/(id)/start`
|
||||
|
||||
|
@ -2860,7 +2858,7 @@ interactive session with the `exec` command.
|
|||
|
||||
Similar to the stream behavior of `POST /containers/(id or name)/attach` API
|
||||
|
||||
### Exec Resize
|
||||
#### Exec Resize
|
||||
|
||||
`POST /exec/(id)/resize`
|
||||
|
||||
|
@ -2887,7 +2885,7 @@ This API is valid only if `tty` was specified as part of creating and starting t
|
|||
- **201** – no error
|
||||
- **404** – no such exec instance
|
||||
|
||||
### Exec Inspect
|
||||
#### Exec Inspect
|
||||
|
||||
`GET /exec/(id)/json`
|
||||
|
||||
|
@ -2930,9 +2928,9 @@ Return low-level information about the `exec` command `id`.
|
|||
- **404** – no such exec instance
|
||||
- **500** - server error
|
||||
|
||||
## 3.4 Volumes
|
||||
### 3.4 Volumes
|
||||
|
||||
### List volumes
|
||||
#### List volumes
|
||||
|
||||
`GET /volumes`
|
||||
|
||||
|
@ -2970,7 +2968,7 @@ Return low-level information about the `exec` command `id`.
|
|||
- **200** - no error
|
||||
- **500** - server error
|
||||
|
||||
### Create a volume
|
||||
#### Create a volume
|
||||
|
||||
`POST /volumes/create`
|
||||
|
||||
|
@ -3027,7 +3025,7 @@ Create a volume
|
|||
Refer to the [inspect a volume](#inspect-a-volume) section or details about the
|
||||
JSON fields returned in the response.
|
||||
|
||||
### Inspect a volume
|
||||
#### Inspect a volume
|
||||
|
||||
`GET /volumes/(name)`
|
||||
|
||||
|
@ -3079,7 +3077,7 @@ response.
|
|||
- **Scope** - Scope describes the level at which the volume exists, can be one of
|
||||
`global` for cluster-wide or `local` for machine level. The default is `local`.
|
||||
|
||||
### Remove a volume
|
||||
#### Remove a volume
|
||||
|
||||
`DELETE /volumes/(name)`
|
||||
|
||||
|
@ -3100,9 +3098,9 @@ Instruct the driver to remove the volume (`name`).
|
|||
- **409** - volume is in use and cannot be removed
|
||||
- **500** - server error
|
||||
|
||||
## 3.5 Networks
|
||||
### 3.5 Networks
|
||||
|
||||
### List networks
|
||||
#### List networks
|
||||
|
||||
`GET /networks`
|
||||
|
||||
|
@ -3194,7 +3192,7 @@ Content-Type: application/json
|
|||
- **200** - no error
|
||||
- **500** - server error
|
||||
|
||||
### Inspect network
|
||||
#### Inspect network
|
||||
|
||||
`GET /networks/<network-id>`
|
||||
|
||||
|
@ -3256,7 +3254,7 @@ Content-Type: application/json
|
|||
- **200** - no error
|
||||
- **404** - network not found
|
||||
|
||||
### Create a network
|
||||
#### Create a network
|
||||
|
||||
`POST /networks/create`
|
||||
|
||||
|
@ -3339,7 +3337,7 @@ Content-Type: application/json
|
|||
- **Options** - Network specific options to be used by the drivers
|
||||
- **Labels** - Labels to set on the network, specified as a map: `{"key":"value" [,"key2":"value2"]}`
|
||||
|
||||
### Connect a container to a network
|
||||
#### Connect a container to a network
|
||||
|
||||
`POST /networks/(id)/connect`
|
||||
|
||||
|
@ -3377,7 +3375,7 @@ Content-Type: application/json
|
|||
|
||||
- **container** - container-id/name to be connected to the network
|
||||
|
||||
### Disconnect a container from a network
|
||||
#### Disconnect a container from a network
|
||||
|
||||
`POST /networks/(id)/disconnect`
|
||||
|
||||
|
@ -3411,7 +3409,7 @@ Content-Type: application/json
|
|||
- **Container** - container-id/name to be disconnected from a network
|
||||
- **Force** - Force the container to disconnect from a network
|
||||
|
||||
### Remove a network
|
||||
#### Remove a network
|
||||
|
||||
`DELETE /networks/(id)`
|
||||
|
||||
|
@ -3431,9 +3429,9 @@ Instruct the driver to remove the network (`id`).
|
|||
- **404** - no such network
|
||||
- **500** - server error
|
||||
|
||||
## 3.6 Plugins (experimental)
|
||||
### 3.6 Plugins (experimental)
|
||||
|
||||
### List plugins
|
||||
#### List plugins
|
||||
|
||||
`GET /plugins`
|
||||
|
||||
|
@ -3563,7 +3561,7 @@ Content-Type: application/json
|
|||
- **200** - no error
|
||||
- **500** - server error
|
||||
|
||||
### Install a plugin
|
||||
#### Install a plugin
|
||||
|
||||
`POST /plugins/pull?name=<plugin name>`
|
||||
|
||||
|
@ -3625,7 +3623,7 @@ Content-Length: 175
|
|||
name must have at least one component
|
||||
- **500** - plugin already exists
|
||||
|
||||
### Inspect a plugin
|
||||
#### Inspect a plugin
|
||||
|
||||
`GET /plugins/(plugin name)`
|
||||
|
||||
|
@ -3758,7 +3756,7 @@ Content-Type: application/json
|
|||
- **200** - no error
|
||||
- **404** - plugin not installed
|
||||
|
||||
### Enable a plugin
|
||||
#### Enable a plugin
|
||||
|
||||
`POST /plugins/(plugin name)/enable`
|
||||
|
||||
|
@ -3786,7 +3784,7 @@ Content-Type: text/plain; charset=utf-8
|
|||
- **200** - no error
|
||||
- **500** - plugin is already enabled
|
||||
|
||||
### Disable a plugin
|
||||
#### Disable a plugin
|
||||
|
||||
`POST /plugins/(plugin name)/disable`
|
||||
|
||||
|
@ -3814,7 +3812,7 @@ Content-Type: text/plain; charset=utf-8
|
|||
- **200** - no error
|
||||
- **500** - plugin is already disabled
|
||||
|
||||
### Remove a plugin
|
||||
#### Remove a plugin
|
||||
|
||||
`DELETE /plugins/(plugin name)`
|
||||
|
||||
|
@ -3844,7 +3842,7 @@ Content-Type: text/plain; charset=utf-8
|
|||
|
||||
<!-- TODO Document "docker plugin push" endpoint once we have "plugin build"
|
||||
|
||||
### Push a plugin
|
||||
#### Push a plugin
|
||||
|
||||
`POST /v1.24/plugins/tiborvass/(plugin name)/push HTTP/1.1`
|
||||
|
||||
|
@ -3870,11 +3868,11 @@ an image](#create-an-image) section for more details.
|
|||
|
||||
-->
|
||||
|
||||
## 3.7 Nodes
|
||||
### 3.7 Nodes
|
||||
|
||||
**Note**: Node operations require the engine to be part of a swarm.
|
||||
|
||||
### List nodes
|
||||
#### List nodes
|
||||
|
||||
|
||||
`GET /nodes`
|
||||
|
@ -3967,7 +3965,7 @@ List nodes
|
|||
- **200** – no error
|
||||
- **500** – server error
|
||||
|
||||
### Inspect a node
|
||||
#### Inspect a node
|
||||
|
||||
|
||||
`GET /nodes/(id or name)`
|
||||
|
@ -4049,7 +4047,7 @@ Return low-level information on the node `id`
|
|||
- **404** – no such node
|
||||
- **500** – server error
|
||||
|
||||
### Remove a node
|
||||
#### Remove a node
|
||||
|
||||
|
||||
`DELETE /nodes/(id or name)`
|
||||
|
@ -4077,7 +4075,7 @@ Remove a node from the swarm.
|
|||
- **404** – no such node
|
||||
- **500** – server error
|
||||
|
||||
### Update a node
|
||||
#### Update a node
|
||||
|
||||
|
||||
`POST /nodes/(id)/update`
|
||||
|
@ -4132,9 +4130,9 @@ JSON Parameters:
|
|||
- **404** – no such node
|
||||
- **500** – server error
|
||||
|
||||
## 3.8 Swarm
|
||||
### 3.8 Swarm
|
||||
|
||||
### Inspect swarm
|
||||
#### Inspect swarm
|
||||
|
||||
|
||||
`GET /swarm`
|
||||
|
@ -4182,7 +4180,7 @@ Inspect swarm
|
|||
|
||||
- **200** - no error
|
||||
|
||||
### Initialize a new swarm
|
||||
#### Initialize a new swarm
|
||||
|
||||
|
||||
`POST /swarm/init`
|
||||
|
@ -4258,7 +4256,7 @@ JSON Parameters:
|
|||
- **Options** - An object with key/value pairs that are interpreted
|
||||
as protocol-specific options for the external CA driver.
|
||||
|
||||
### Join an existing swarm
|
||||
#### Join an existing swarm
|
||||
|
||||
`POST /swarm/join`
|
||||
|
||||
|
@ -4300,7 +4298,7 @@ JSON Parameters:
|
|||
- **RemoteAddr** – Address of any manager node already participating in the swarm.
|
||||
- **JoinToken** – Secret token for joining this swarm.
|
||||
|
||||
### Leave a swarm
|
||||
#### Leave a swarm
|
||||
|
||||
|
||||
`POST /swarm/leave`
|
||||
|
@ -4326,7 +4324,7 @@ Leave a swarm
|
|||
- **200** – no error
|
||||
- **406** – node is not part of a swarm
|
||||
|
||||
### Update a swarm
|
||||
#### Update a swarm
|
||||
|
||||
|
||||
`POST /swarm/update`
|
||||
|
@ -4407,11 +4405,11 @@ JSON Parameters:
|
|||
- **Worker** - Token to use for joining as a worker.
|
||||
- **Manager** - Token to use for joining as a manager.
|
||||
|
||||
## 3.9 Services
|
||||
### 3.9 Services
|
||||
|
||||
**Note**: Service operations require to first be part of a swarm.
|
||||
|
||||
### List services
|
||||
#### List services
|
||||
|
||||
|
||||
`GET /services`
|
||||
|
@ -4516,7 +4514,7 @@ List services
|
|||
- **200** – no error
|
||||
- **500** – server error
|
||||
|
||||
### Create a service
|
||||
#### Create a service
|
||||
|
||||
`POST /services/create`
|
||||
|
||||
|
@ -4689,7 +4687,7 @@ image](#create-an-image) section for more details.
|
|||
section for more details.
|
||||
|
||||
|
||||
### Remove a service
|
||||
#### Remove a service
|
||||
|
||||
|
||||
`DELETE /services/(id or name)`
|
||||
|
@ -4712,7 +4710,7 @@ Stop and remove the service `id`
|
|||
- **404** – no such service
|
||||
- **500** – server error
|
||||
|
||||
### Inspect one or more services
|
||||
#### Inspect one or more services
|
||||
|
||||
|
||||
`GET /services/(id or name)`
|
||||
|
@ -4801,7 +4799,7 @@ Return information on the service `id`.
|
|||
- **404** – no such service
|
||||
- **500** – server error
|
||||
|
||||
### Update a service
|
||||
#### Update a service
|
||||
|
||||
`POST /services/(id or name)/update`
|
||||
|
||||
|
@ -4934,11 +4932,11 @@ image](#create-an-image) section for more details.
|
|||
- **404** – no such service
|
||||
- **500** – server error
|
||||
|
||||
## 3.10 Tasks
|
||||
### 3.10 Tasks
|
||||
|
||||
**Note**: Task operations require the engine to be part of a swarm.
|
||||
|
||||
### List tasks
|
||||
#### List tasks
|
||||
|
||||
|
||||
`GET /tasks`
|
||||
|
@ -5136,7 +5134,7 @@ List tasks
|
|||
- **200** – no error
|
||||
- **500** – server error
|
||||
|
||||
### Inspect a task
|
||||
#### Inspect a task
|
||||
|
||||
|
||||
`GET /tasks/(task id)`
|
||||
|
@ -5239,9 +5237,9 @@ Get details on a task
|
|||
- **404** – unknown task
|
||||
- **500** – server error
|
||||
|
||||
# 4. Going further
|
||||
## 4. Going further
|
||||
|
||||
## 4.1 Inside `docker run`
|
||||
### 4.1 Inside `docker run`
|
||||
|
||||
As an example, the `docker run` command line makes the following API calls:
|
||||
|
||||
|
@ -5259,7 +5257,7 @@ As an example, the `docker run` command line makes the following API calls:
|
|||
|
||||
- If in detached mode or only `stdin` is attached, display the container's id.
|
||||
|
||||
## 4.2 Hijacking
|
||||
### 4.2 Hijacking
|
||||
|
||||
In this version of the API, `/attach`, uses hijacking to transport `stdin`,
|
||||
`stdout`, and `stderr` on the same socket.
|
||||
|
@ -5274,7 +5272,7 @@ When Docker daemon detects the `Upgrade` header, it switches its status code
|
|||
from **200 OK** to **101 UPGRADED** and resends the same headers.
|
||||
|
||||
|
||||
## 4.3 CORS Requests
|
||||
### 4.3 CORS Requests
|
||||
|
||||
To set cross origin requests to the Engine API please give values to
|
||||
`--api-cors-header` when running Docker in daemon mode. Set * (asterisk) allows all,
|
||||
|
|
Loading…
Reference in a new issue