mirror of https://github.com/docker/docs.git
engine/api: use "console" for shell examples
This allows for easier copying of the commands, without selecting the prompt. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
74460241f8
commit
2477916f59
|
@ -70,7 +70,7 @@ unless you need to take advantage of new features.
|
||||||
To see the highest version of the API your Docker daemon and client support, use
|
To see the highest version of the API your Docker daemon and client support, use
|
||||||
`docker version`:
|
`docker version`:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker version
|
$ docker version
|
||||||
|
|
||||||
Client: Docker Engine - Community
|
Client: Docker Engine - Community
|
||||||
|
@ -107,8 +107,8 @@ You can specify the API version to use, in one of the following ways:
|
||||||
environment variable `DOCKER_API_VERSION` to the correct version. This works
|
environment variable `DOCKER_API_VERSION` to the correct version. This works
|
||||||
on Linux, Windows, or macOS clients.
|
on Linux, Windows, or macOS clients.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
DOCKER_API_VERSION='1.41'
|
$ DOCKER_API_VERSION='1.41'
|
||||||
```
|
```
|
||||||
|
|
||||||
While the environment variable is set, that version of the API is used, even
|
While the environment variable is set, that version of the API is used, even
|
||||||
|
|
|
@ -109,7 +109,7 @@ print(client.containers.run("alpine", ["echo", "hello", "world"]))
|
||||||
|
|
||||||
<div id="tab-run-curl" class="tab-pane fade" markdown="1">
|
<div id="tab-run-curl" class="tab-pane fade" markdown="1">
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ curl --unix-socket /var/run/docker.sock -H "Content-Type: application/json" \
|
$ curl --unix-socket /var/run/docker.sock -H "Content-Type: application/json" \
|
||||||
-d '{"Image": "alpine", "Cmd": ["echo", "hello world"]}' \
|
-d '{"Image": "alpine", "Cmd": ["echo", "hello world"]}' \
|
||||||
-X POST http://localhost/v{{ site.latest_engine_api_version}}/containers/create
|
-X POST http://localhost/v{{ site.latest_engine_api_version}}/containers/create
|
||||||
|
@ -214,7 +214,7 @@ print(container.id)
|
||||||
|
|
||||||
<div id="tab-rundetach-curl" class="tab-pane fade" markdown="1">
|
<div id="tab-rundetach-curl" class="tab-pane fade" markdown="1">
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ curl --unix-socket /var/run/docker.sock -H "Content-Type: application/json" \
|
$ curl --unix-socket /var/run/docker.sock -H "Content-Type: application/json" \
|
||||||
-d '{"Image": "bfirsh/reticulate-splines"}' \
|
-d '{"Image": "bfirsh/reticulate-splines"}' \
|
||||||
-X POST http://localhost/v{{ site.latest_engine_api_version}}/containers/create
|
-X POST http://localhost/v{{ site.latest_engine_api_version}}/containers/create
|
||||||
|
@ -285,7 +285,7 @@ for container in client.containers.list():
|
||||||
|
|
||||||
<div id="tab-listcontainers-curl" class="tab-pane fade" markdown="1">
|
<div id="tab-listcontainers-curl" class="tab-pane fade" markdown="1">
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ curl --unix-socket /var/run/docker.sock http://localhost/v{{ site.latest_engine_api_version}}/containers/json
|
$ curl --unix-socket /var/run/docker.sock http://localhost/v{{ site.latest_engine_api_version}}/containers/json
|
||||||
[{
|
[{
|
||||||
"Id":"ae63e8b89a26f01f6b4b2c9a7817c31a1b6196acf560f66586fbc8809ffcd772",
|
"Id":"ae63e8b89a26f01f6b4b2c9a7817c31a1b6196acf560f66586fbc8809ffcd772",
|
||||||
|
@ -365,7 +365,7 @@ for container in client.containers.list():
|
||||||
|
|
||||||
<div id="tab-stopcontainers-curl" class="tab-pane fade" markdown="1">
|
<div id="tab-stopcontainers-curl" class="tab-pane fade" markdown="1">
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ curl --unix-socket /var/run/docker.sock http://localhost/v{{ site.latest_engine_api_version}}/containers/json
|
$ curl --unix-socket /var/run/docker.sock http://localhost/v{{ site.latest_engine_api_version}}/containers/json
|
||||||
[{
|
[{
|
||||||
"Id":"ae63e8b89a26f01f6b4b2c9a7817c31a1b6196acf560f66586fbc8809ffcd772",
|
"Id":"ae63e8b89a26f01f6b4b2c9a7817c31a1b6196acf560f66586fbc8809ffcd772",
|
||||||
|
@ -442,7 +442,7 @@ print(container.logs())
|
||||||
|
|
||||||
<div id="tab-containerlogs-curl" class="tab-pane fade" markdown="1">
|
<div id="tab-containerlogs-curl" class="tab-pane fade" markdown="1">
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ curl --unix-socket /var/run/docker.sock "http://localhost/v{{ site.latest_engine_api_version}}/containers/ca5f55cdb/logs?stdout=1"
|
$ curl --unix-socket /var/run/docker.sock "http://localhost/v{{ site.latest_engine_api_version}}/containers/ca5f55cdb/logs?stdout=1"
|
||||||
Reticulating spline 1...
|
Reticulating spline 1...
|
||||||
Reticulating spline 2...
|
Reticulating spline 2...
|
||||||
|
@ -511,7 +511,7 @@ for image in client.images.list():
|
||||||
|
|
||||||
<div id="tab-listimages-curl" class="tab-pane fade" markdown="1">
|
<div id="tab-listimages-curl" class="tab-pane fade" markdown="1">
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ curl --unix-socket /var/run/docker.sock http://localhost/v{{ site.latest_engine_api_version}}/images/json
|
$ curl --unix-socket /var/run/docker.sock http://localhost/v{{ site.latest_engine_api_version}}/images/json
|
||||||
[{
|
[{
|
||||||
"Id":"sha256:31d9a31e1dd803470c5a151b8919ef1988ac3efd44281ac59d43ad623f275dcd",
|
"Id":"sha256:31d9a31e1dd803470c5a151b8919ef1988ac3efd44281ac59d43ad623f275dcd",
|
||||||
|
@ -581,7 +581,7 @@ print(image.id)
|
||||||
</div>
|
</div>
|
||||||
<div id="tab-pullimages-curl" class="tab-pane fade" markdown="1">
|
<div id="tab-pullimages-curl" class="tab-pane fade" markdown="1">
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ curl --unix-socket /var/run/docker.sock \
|
$ curl --unix-socket /var/run/docker.sock \
|
||||||
-X POST "http://localhost/v{{ site.latest_engine_api_version}}/images/create?fromImage=alpine"
|
-X POST "http://localhost/v{{ site.latest_engine_api_version}}/images/create?fromImage=alpine"
|
||||||
{"status":"Pulling from library/alpine","id":"3.1"}
|
{"status":"Pulling from library/alpine","id":"3.1"}
|
||||||
|
@ -679,7 +679,7 @@ This example leaves the credentials in your shell's history, so consider
|
||||||
this a naive implementation. The credentials are passed as a Base-64-encoded
|
this a naive implementation. The credentials are passed as a Base-64-encoded
|
||||||
JSON structure.
|
JSON structure.
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ JSON=$(echo '{"username": "string", "password": "string", "serveraddress": "string"}' | base64)
|
$ JSON=$(echo '{"username": "string", "password": "string", "serveraddress": "string"}' | base64)
|
||||||
|
|
||||||
$ curl --unix-socket /var/run/docker.sock \
|
$ curl --unix-socket /var/run/docker.sock \
|
||||||
|
@ -775,7 +775,7 @@ print(image.id)
|
||||||
</div>
|
</div>
|
||||||
<div id="tab-commit-curl" class="tab-pane fade" markdown="1">
|
<div id="tab-commit-curl" class="tab-pane fade" markdown="1">
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ docker run -d alpine touch /helloworld
|
$ docker run -d alpine touch /helloworld
|
||||||
0888269a9d584f0fa8fc96b3c0d8d57969ceea3a64acf47cd34eebb4744dbc52
|
0888269a9d584f0fa8fc96b3c0d8d57969ceea3a64acf47cd34eebb4744dbc52
|
||||||
$ curl --unix-socket /var/run/docker.sock\
|
$ curl --unix-socket /var/run/docker.sock\
|
||||||
|
|
|
@ -22,8 +22,8 @@ installed and coexist together.
|
||||||
|
|
||||||
### Go SDK
|
### Go SDK
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
go get github.com/docker/docker/client
|
$ go get github.com/docker/docker/client
|
||||||
```
|
```
|
||||||
|
|
||||||
The client requires a recent version of Go. Run `go version` and ensure that you
|
The client requires a recent version of Go. Run `go version` and ensure that you
|
||||||
|
@ -149,7 +149,7 @@ print client.containers.run("alpine", ["echo", "hello", "world"])
|
||||||
</div>
|
</div>
|
||||||
<div id="curl" class="tab-pane fade" markdown="1">
|
<div id="curl" class="tab-pane fade" markdown="1">
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ curl --unix-socket /var/run/docker.sock -H "Content-Type: application/json" \
|
$ curl --unix-socket /var/run/docker.sock -H "Content-Type: application/json" \
|
||||||
-d '{"Image": "alpine", "Cmd": ["echo", "hello world"]}' \
|
-d '{"Image": "alpine", "Cmd": ["echo", "hello world"]}' \
|
||||||
-X POST http://localhost/v{{ site.latest_engine_api_version}}/containers/create
|
-X POST http://localhost/v{{ site.latest_engine_api_version}}/containers/create
|
||||||
|
|
Loading…
Reference in New Issue