From 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 7 Apr 2024 13:41:34 -0500 Subject: new repository --- ...Freference%2Fcommandline%2Fversion%2Findex.html | 64 ++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 devdocs/docker/engine%2Freference%2Fcommandline%2Fversion%2Findex.html (limited to 'devdocs/docker/engine%2Freference%2Fcommandline%2Fversion%2Findex.html') diff --git a/devdocs/docker/engine%2Freference%2Fcommandline%2Fversion%2Findex.html b/devdocs/docker/engine%2Freference%2Fcommandline%2Fversion%2Findex.html new file mode 100644 index 00000000..e5b59c7f --- /dev/null +++ b/devdocs/docker/engine%2Freference%2Fcommandline%2Fversion%2Findex.html @@ -0,0 +1,64 @@ +

docker version


Show the Docker version information

Usage

$ docker version [OPTIONS]
+

Refer to the options section for an overview of available OPTIONS for this command.

Description

By default, this will render all version information in an easy to read layout. If a format is specified, the given template will be executed instead.

Go’s text/template package describes all the details of the format.

For example uses of this command, refer to the examples section below.

Options

Name, shorthand Default Description
+--format , -f + Format the output using the given Go template
--kubeconfig +deprecatedKubernetes
Kubernetes config file

Examples

Default output

$ docker version
+
+Client:
+ Version:           19.03.8
+ API version:       1.40
+ Go version:        go1.12.17
+ Git commit:        afacb8b
+ Built:             Wed Mar 11 01:21:11 2020
+ OS/Arch:           darwin/amd64
+ Context:           default
+ Experimental:      true
+
+Server:
+ Engine:
+  Version:          19.03.8
+  API version:      1.40 (minimum version 1.12)
+  Go version:       go1.12.17
+  Git commit:       afacb8b
+  Built:            Wed Mar 11 01:29:16 2020
+  OS/Arch:          linux/amd64
+  Experimental:     true
+ containerd:
+  Version:          v1.2.13
+  GitCommit:        7ad184331fa3e55e52b890ea95e65ba581ae3429
+ runc:
+  Version:          1.0.0-rc10
+  GitCommit:        dc9208a3303feef5b3839f4323d9beb36df0a9dd
+ docker-init:
+  Version:          0.18.0
+  GitCommit:        fec3683
+

Get the server version

$ docker version --format '{{.Server.Version}}'
+
+19.03.8
+

Dump raw JSON data

$ docker version --format '{{json .}}'
+
+{"Client":{"Platform":{"Name":"Docker Engine - Community"},"Version":"19.03.8","ApiVersion":"1.40","DefaultAPIVersion":"1.40","GitCommit":"afacb8b","GoVersion":"go1.12.17","Os":"darwin","Arch":"amd64","BuildTime":"Wed Mar 11 01:21:11 2020","Experimental":true},"Server":{"Platform":{"Name":"Docker Engine - Community"},"Components":[{"Name":"Engine","Version":"19.03.8","Details":{"ApiVersion":"1.40","Arch":"amd64","BuildTime":"Wed Mar 11 01:29:16 2020","Experimental":"true","GitCommit":"afacb8b","GoVersion":"go1.12.17","KernelVersion":"4.19.76-linuxkit","MinAPIVersion":"1.12","Os":"linux"}},{"Name":"containerd","Version":"v1.2.13","Details":{"GitCommit":"7ad184331fa3e55e52b890ea95e65ba581ae3429"}},{"Name":"runc","Version":"1.0.0-rc10","Details":{"GitCommit":"dc9208a3303feef5b3839f4323d9beb36df0a9dd"}},{"Name":"docker-init","Version":"0.18.0","Details":{"GitCommit":"fec3683"}}],"Version":"19.03.8","ApiVersion":"1.40","MinAPIVersion":"1.12","GitCommit":"afacb8b","GoVersion":"go1.12.17","Os":"linux","Arch":"amd64","KernelVersion":"4.19.76-linuxkit","Experimental":true,"BuildTime":"2020-03-11T01:29:16.000000000+00:00"}}
+

The following example prints the currently used docker context:

$ docker version --format='{{.Client.Context}}'
+default
+

As an example, this output can be used to dynamically change your shell prompt to indicate your active context. The example below illustrates how this output could be used when using Bash as your shell.

Declare a function to obtain the current context in your ~/.bashrc, and set this command as your PROMPT_COMMAND

function docker_context_prompt() {
+        PS1="context: $(docker version --format='{{.Client.Context}}')> "
+}
+
+PROMPT_COMMAND=docker_context_prompt
+

After reloading the ~/.bashrc, the prompt now shows the currently selected docker context:

$ source ~/.bashrc
+context: default> docker context create --docker host=unix:///var/run/docker.sock my-context
+my-context
+Successfully created context "my-context"
+context: default> docker context use my-context
+my-context
+Current context is now "my-context"
+context: my-context> docker context use default
+default
+Current context is now "default"
+context: default>
+

Refer to the docker context section in the command line reference for more information about docker context.

+

+ © 2019 Docker, Inc.
Licensed under the Apache License, Version 2.0.
Docker and the Docker logo are trademarks or registered trademarks of Docker, Inc. in the United States and/or other countries.
Docker, Inc. and other parties may also have trademark rights in other terms used herein.
+ https://docs.docker.com/engine/reference/commandline/version/ +

+
-- cgit v1.2.3