From 2477916f59dda0f17bf5dd7cea77cb62fe978b33 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Fri, 6 Aug 2021 17:09:19 +0200 Subject: [PATCH] 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 --- engine/api/index.md | 6 +++--- engine/api/sdk/examples.md | 18 +++++++++--------- engine/api/sdk/index.md | 6 +++--- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/engine/api/index.md b/engine/api/index.md index 8f1ff4876c..9ea0dc2d20 100644 --- a/engine/api/index.md +++ b/engine/api/index.md @@ -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 `docker version`: -```bash +```console $ docker version 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 on Linux, Windows, or macOS clients. - ```bash - DOCKER_API_VERSION='1.41' + ```console + $ DOCKER_API_VERSION='1.41' ``` While the environment variable is set, that version of the API is used, even diff --git a/engine/api/sdk/examples.md b/engine/api/sdk/examples.md index 63b633e314..a984ccd928 100644 --- a/engine/api/sdk/examples.md +++ b/engine/api/sdk/examples.md @@ -109,7 +109,7 @@ print(client.containers.run("alpine", ["echo", "hello", "world"]))
-```bash +```console $ curl --unix-socket /var/run/docker.sock -H "Content-Type: application/json" \ -d '{"Image": "alpine", "Cmd": ["echo", "hello world"]}' \ -X POST http://localhost/v{{ site.latest_engine_api_version}}/containers/create @@ -214,7 +214,7 @@ print(container.id)
-```bash +```console $ curl --unix-socket /var/run/docker.sock -H "Content-Type: application/json" \ -d '{"Image": "bfirsh/reticulate-splines"}' \ -X POST http://localhost/v{{ site.latest_engine_api_version}}/containers/create @@ -285,7 +285,7 @@ for container in client.containers.list():
-```bash +```console $ curl --unix-socket /var/run/docker.sock http://localhost/v{{ site.latest_engine_api_version}}/containers/json [{ "Id":"ae63e8b89a26f01f6b4b2c9a7817c31a1b6196acf560f66586fbc8809ffcd772", @@ -365,7 +365,7 @@ for container in client.containers.list():
-```bash +```console $ curl --unix-socket /var/run/docker.sock http://localhost/v{{ site.latest_engine_api_version}}/containers/json [{ "Id":"ae63e8b89a26f01f6b4b2c9a7817c31a1b6196acf560f66586fbc8809ffcd772", @@ -442,7 +442,7 @@ print(container.logs())
-```bash +```console $ 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 2... @@ -511,7 +511,7 @@ for image in client.images.list():
-```bash +```console $ curl --unix-socket /var/run/docker.sock http://localhost/v{{ site.latest_engine_api_version}}/images/json [{ "Id":"sha256:31d9a31e1dd803470c5a151b8919ef1988ac3efd44281ac59d43ad623f275dcd", @@ -581,7 +581,7 @@ print(image.id)
-```bash +```console $ curl --unix-socket /var/run/docker.sock \ -X POST "http://localhost/v{{ site.latest_engine_api_version}}/images/create?fromImage=alpine" {"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 JSON structure. -```bash +```console $ JSON=$(echo '{"username": "string", "password": "string", "serveraddress": "string"}' | base64) $ curl --unix-socket /var/run/docker.sock \ @@ -775,7 +775,7 @@ print(image.id)
-```bash +```console $ docker run -d alpine touch /helloworld 0888269a9d584f0fa8fc96b3c0d8d57969ceea3a64acf47cd34eebb4744dbc52 $ curl --unix-socket /var/run/docker.sock\ diff --git a/engine/api/sdk/index.md b/engine/api/sdk/index.md index 08d4985274..d8e0ea9926 100644 --- a/engine/api/sdk/index.md +++ b/engine/api/sdk/index.md @@ -22,8 +22,8 @@ installed and coexist together. ### Go SDK -```bash -go get github.com/docker/docker/client +```console +$ go get github.com/docker/docker/client ``` 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"])
-```bash +```console $ curl --unix-socket /var/run/docker.sock -H "Content-Type: application/json" \ -d '{"Image": "alpine", "Cmd": ["echo", "hello world"]}' \ -X POST http://localhost/v{{ site.latest_engine_api_version}}/containers/create