github.com/pwn-term/docker@v0.0.0-20210616085119-6e977cce2565/cli/docs/reference/commandline/version.md (about)

     1  ---
     2  title: "version"
     3  description: "The version command description and usage"
     4  keywords: "version, architecture, api"
     5  ---
     6  
     7  # version
     8  
     9  ```markdown
    10  Usage:  docker version [OPTIONS]
    11  
    12  Show the Docker version information
    13  
    14  Options:
    15    -f, --format string       Format the output using the given Go template
    16        --help                Print usage
    17        --kubeconfig string   Kubernetes config file
    18  ```
    19  
    20  ## Description
    21  
    22  By default, this will render all version information in an easy to read
    23  layout. If a format is specified, the given template will be executed instead.
    24  
    25  Go's [text/template](http://golang.org/pkg/text/template/) package
    26  describes all the details of the format.
    27  
    28  ## Examples
    29  
    30  ### Default output
    31  
    32  ```bash
    33  $ docker version
    34  
    35  Client:
    36   Version:           19.03.8
    37   API version:       1.40
    38   Go version:        go1.12.17
    39   Git commit:        afacb8b
    40   Built:             Wed Mar 11 01:21:11 2020
    41   OS/Arch:           darwin/amd64
    42   Context:           default
    43   Experimental:      true
    44  
    45  Server:
    46   Engine:
    47    Version:          19.03.8
    48    API version:      1.40 (minimum version 1.12)
    49    Go version:       go1.12.17
    50    Git commit:       afacb8b
    51    Built:            Wed Mar 11 01:29:16 2020
    52    OS/Arch:          linux/amd64
    53    Experimental:     true
    54   containerd:
    55    Version:          v1.2.13
    56    GitCommit:        7ad184331fa3e55e52b890ea95e65ba581ae3429
    57   runc:
    58    Version:          1.0.0-rc10
    59    GitCommit:        dc9208a3303feef5b3839f4323d9beb36df0a9dd
    60   docker-init:
    61    Version:          0.18.0
    62    GitCommit:        fec3683
    63  ```
    64  
    65  ### Get the server version
    66  
    67  ```bash
    68  $ docker version --format '{{.Server.Version}}'
    69  
    70  19.03.8
    71  ```
    72  
    73  ### Dump raw JSON data
    74  
    75  ```bash
    76  $ docker version --format '{{json .}}'
    77  
    78  {"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"}}
    79  ```
    80  
    81  ### Print the current context
    82  
    83  The following example prints the currently used [`docker context`](context.md):
    84  
    85  ```bash
    86  $ docker version --format='{{.Client.Context}}'
    87  default
    88  ```
    89  
    90  As an example, this output can be used to dynamically change your shell prompt
    91  to indicate your active context. The example below illustrates how this output
    92  could be used when using Bash as your shell.
    93  
    94  Declare a function to obtain the current context in your `~/.bashrc`, and set
    95  this command as your `PROMPT_COMMAND`
    96  
    97  ```bash
    98  function docker_context_prompt() {
    99          PS1="context: $(docker version --format='{{.Client.Context}}')> "
   100  }
   101  
   102  PROMPT_COMMAND=docker_context_prompt
   103  ```
   104  
   105  After reloading the `~/.bashrc`, the prompt now shows the currently selected
   106  `docker context`:
   107  
   108  ```bash
   109  $ source ~/.bashrc
   110  context: default> docker context create --docker host=unix:///data/docker/run/docker.sock my-context
   111  my-context
   112  Successfully created context "my-context"
   113  context: default> docker context use my-context
   114  my-context
   115  Current context is now "my-context"
   116  context: my-context> docker context use default
   117  default
   118  Current context is now "default"
   119  context: default>
   120  ```
   121  
   122  Refer to the [`docker context` section](context.md) in the command line reference
   123  for more information about `docker context`.