github.com/sld880311/docker@v0.0.0-20200524143708-d5593973a475/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  <!-- This file is maintained within the docker/docker Github
     8       repository at https://github.com/docker/docker/. Make all
     9       pull requests against that repo. If you see this file in
    10       another repository, consider it read-only there, as it will
    11       periodically be overwritten by the definitive file. Pull
    12       requests which include edits to this file in other repositories
    13       will be rejected.
    14  -->
    15  
    16  # version
    17  
    18  ```markdown
    19  Usage:  docker version [OPTIONS]
    20  
    21  Show the Docker version information
    22  
    23  Options:
    24    -f, --format string   Format the output using the given Go template
    25        --help            Print usage
    26  ```
    27  
    28  ## Description
    29  
    30  By default, this will render all version information in an easy to read
    31  layout. If a format is specified, the given template will be executed instead.
    32  
    33  Go's [text/template](http://golang.org/pkg/text/template/) package
    34  describes all the details of the format.
    35  
    36  ## Examples
    37  
    38  ### Default output
    39  
    40  ```bash
    41  $ docker version
    42  
    43  Client:
    44  Version:      1.8.0
    45  API version:  1.20
    46  Go version:   go1.4.2
    47  Git commit:   f5bae0a
    48  Built:        Tue Jun 23 17:56:00 UTC 2015
    49  OS/Arch:      linux/amd64
    50  
    51  Server:
    52  Version:      1.8.0
    53  API version:  1.20
    54  Go version:   go1.4.2
    55  Git commit:   f5bae0a
    56  Built:        Tue Jun 23 17:56:00 UTC 2015
    57  OS/Arch:      linux/amd64
    58  ```
    59  
    60  ### Get the server version
    61  
    62  ```bash
    63  $ docker version --format '{{.Server.Version}}'
    64  
    65  1.8.0
    66  ```
    67  
    68  ### Dump raw JSON data
    69  
    70  ```bash
    71  $ docker version --format '{{json .}}'
    72  
    73  {"Client":{"Version":"1.8.0","ApiVersion":"1.20","GitCommit":"f5bae0a","GoVersion":"go1.4.2","Os":"linux","Arch":"amd64","BuildTime":"Tue Jun 23 17:56:00 UTC 2015"},"ServerOK":true,"Server":{"Version":"1.8.0","ApiVersion":"1.20","GitCommit":"f5bae0a","GoVersion":"go1.4.2","Os":"linux","Arch":"amd64","KernelVersion":"3.13.2-gentoo","BuildTime":"Tue Jun 23 17:56:00 UTC 2015"}}
    74  ```