summaryrefslogtreecommitdiff
path: root/devdocs/docker/engine%2Freference%2Fcommandline%2Fversion%2Findex.html
diff options
context:
space:
mode:
Diffstat (limited to 'devdocs/docker/engine%2Freference%2Fcommandline%2Fversion%2Findex.html')
-rw-r--r--devdocs/docker/engine%2Freference%2Fcommandline%2Fversion%2Findex.html64
1 files changed, 64 insertions, 0 deletions
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 @@
+<h1>docker version</h1> <p><br></p> <p>Show the Docker version information</p> <h2 id="usage">Usage</h2> <div class="highlight"><pre class="highlight" data-language="">$ docker version [OPTIONS]
+</pre></div> <p>Refer to the <a href="#options">options section</a> for an overview of available <a href="#options"><code class="language-plaintext highlighter-rouge">OPTIONS</code></a> for this command.</p> <h2 id="description">Description</h2> <p name="extended-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.</p> <p>Go’s <a href="https://golang.org/pkg/text/template/">text/template</a> package describes all the details of the format.</p> <p>For example uses of this command, refer to the <a href="#examples">examples section</a> below.</p> <h2 id="options">Options</h2> <table> <thead> <tr> <td>Name, shorthand</td> <td>Default</td> <td>Description</td> </tr> </thead> <tbody> <tr> <td>
+<code class="language-plaintext highlighter-rouge">--format</code> , <code class="language-plaintext highlighter-rouge">-f</code>
+</td> <td></td> <td>Format the output using the given Go template</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--kubeconfig</code></td> <td></td> <td>
+<a href="../../../deprecated/index" target="_blank" rel="noopener" class="_"><span class="badge badge-danger" data-toggle="tooltip" title="Read the deprecation reference (in a new window).">deprecated</span></a><span class="badge badge-info" data-toggle="tooltip" title="This option works for the Kubernetes orchestrator.">Kubernetes</span><br>Kubernetes config file</td> </tr> </tbody> </table> <h2 id="examples">Examples</h2> <h3 id="default-output">Default output</h3> <div class="highlight"><pre class="highlight" data-language="">$ 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
+</pre></div> <h3 id="get-the-server-version">Get the server version</h3> <div class="highlight"><pre class="highlight" data-language="">$ docker version --format '{{.Server.Version}}'
+
+19.03.8
+</pre></div> <h3 id="dump-raw-json-data">Dump raw JSON data</h3> <div class="highlight"><pre class="highlight" data-language="">$ 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"}}
+</pre></div> <h3 id="print-the-current-context">Print the current context</h3> <p>The following example prints the currently used <a href="../context/index"><code class="language-plaintext highlighter-rouge">docker context</code></a>:</p> <div class="highlight"><pre class="highlight" data-language="">$ docker version --format='{{.Client.Context}}'
+default
+</pre></div> <p>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.</p> <p>Declare a function to obtain the current context in your <code class="language-plaintext highlighter-rouge">~/.bashrc</code>, and set this command as your <code class="language-plaintext highlighter-rouge">PROMPT_COMMAND</code></p> <div class="highlight"><pre class="highlight" data-language="">function docker_context_prompt() {
+ PS1="context: $(docker version --format='{{.Client.Context}}')&gt; "
+}
+
+PROMPT_COMMAND=docker_context_prompt
+</pre></div> <p>After reloading the <code class="language-plaintext highlighter-rouge">~/.bashrc</code>, the prompt now shows the currently selected <code class="language-plaintext highlighter-rouge">docker context</code>:</p> <div class="highlight"><pre class="highlight" data-language="">$ source ~/.bashrc
+context: default&gt; docker context create --docker host=unix:///var/run/docker.sock my-context
+my-context
+Successfully created context "my-context"
+context: default&gt; docker context use my-context
+my-context
+Current context is now "my-context"
+context: my-context&gt; docker context use default
+default
+Current context is now "default"
+context: default&gt;
+</pre></div> <p>Refer to the <a href="../context/index"><code class="language-plaintext highlighter-rouge">docker context</code> section</a> in the command line reference for more information about <code class="language-plaintext highlighter-rouge">docker context</code>.</p> <div class="_attribution">
+ <p class="_attribution-p">
+ &copy; 2019 Docker, Inc.<br>Licensed under the Apache License, Version 2.0.<br>Docker and the Docker logo are trademarks or registered trademarks of Docker, Inc. in the United States and/or other countries.<br>Docker, Inc. and other parties may also have trademark rights in other terms used herein.<br>
+ <a href="https://docs.docker.com/engine/reference/commandline/version/" class="_attribution-link">https://docs.docker.com/engine/reference/commandline/version/</a>
+ </p>
+</div>