docker version (original) (raw)
Description | Show the Docker version information |
---|---|
Usage | docker version [OPTIONS] |
The version command prints the current version number for all independently versioned Docker components. Use the--format option to customize the output.
The version command (docker version
) outputs the version numbers of Docker components, while the --version
flag (docker --version
) outputs the version number of the Docker CLI you are using.
Default output
The default output renders all version information divided into two sections; the Client
section contains information about the Docker CLI and client components, and the Server
section contains information about the Docker Engine and components used by the Docker Engine, such as the containerd and runc OCI Runtimes.
The information shown may differ depending on how you installed Docker and what components are in use. The following example shows the output on a macOS machine running Docker Desktop:
Client and server versions
Docker uses a client/server architecture, which allows you to use the Docker CLI on your local machine to control a Docker Engine running on a remote machine, which can be (for example) a machine running in the cloud or inside a virtual machine.
The following example switches the Docker CLI to use acontextnamed remote-test-server
, which runs an older version of the Docker Engine on a Linux server:
API version and version negotiation
The API version used by the client depends on the Docker Engine that the Docker CLI is connecting with. When connecting with the Docker Engine, the Docker CLI and Docker Engine perform API version negotiation, and select the highest API version that is supported by both the Docker CLI and the Docker Engine.
For example, if the CLI is connecting with Docker Engine version 19.03, it downgrades to API version 1.40 (refer to theAPI version matrixto learn about the supported API versions for Docker Engine):
Be aware that API version can also be overridden using the DOCKER_API_VERSION
environment variable, which can be useful for debugging purposes, and disables API version negotiation. The following example illustrates an environment where the DOCKER_API_VERSION
environment variable is set. Unsetting the environment variable removes the override, and re-enables API version negotiation:
Option | Default | Description |
---|---|---|
-f, --format | Format output using a custom template:'json': Print in JSON format'TEMPLATE': Print output using the given Go template.Refer tohttps://docs.docker.com/go/formatting/ for more information about formatting output with templates |
Format the output (--format)
The formatting option (--format
) pretty-prints the output using a Go template, which allows you to customize the output format, or to obtain specific information from the output. Refer to theformat command and log outputpage for details of the format.
Get the server version
Get the client API version
The following example prints the API version that is used by the client:
The version shown is the API version that is negotiated between the client and the Docker Engine. Refer toAPI version and version negotiationabove for more information.