Docker Tutorial

Docker Installation

How to use Docker

Docker Instance

Docker Container Lifecycle Command

Docker Container Operation Command

Docker Container rootfs Command

Docker Mirror Repository Command

Docker Local Image Management Command

Docker info|version Command

Docker version command

In this tutorial, you'll learn how to use the docker version command, which shows information about the Docker client and server installed on your system, such as version numbers and API versions.

  1. Prerequisites:

    • Install Docker on your system
  2. Run the docker version command:

    To view the Docker client and server version information, run the following command:

    docker version
    
  3. Interpret the output:

    The output of the docker version command shows information about both the Docker client and server (Docker daemon). The information displayed includes:

    • Client and Server version numbers: This shows the version numbers of your Docker client and server (Docker daemon). These versions are usually the same, but they might differ if you're using a remote Docker server or an older client.

    • API version: This is the API version supported by the Docker server. The Docker client communicates with the Docker server using the Docker API, so it's essential that the API versions are compatible.

    • Go version: This shows the Go programming language version used to build the Docker client and server.

    • Git commit: This displays the Git commit hash of the Docker client and server source code.

    • Operating system and architecture: This shows the operating system and architecture for both the client and server.

    • Experimental features: This indicates if experimental features are enabled on the client and server.

  4. Retrieve specific version information (optional):

    If you want to retrieve only specific version information, you can use the --format flag with the docker version command. For example, to get just the client version, you can run:

    docker version --format '{{.Client.Version}}'
    

    This command will display only the Docker client version number.

In this tutorial, we covered how to use the docker version command to display information about the Docker client and server installed on your system. This command is useful for verifying your Docker installation, checking compatibility between the Docker client and server, and ensuring that you're using the correct version for your needs.

  1. Check Docker Version Using Terminal:

    • Description: To check the Docker version installed on your system.

    • Code Example:

      docker --version
      
  2. Docker Show Version Details:

    • Description: Displays detailed information about the Docker version.

    • Code Example:

      docker version
      
  3. How to Find Docker Version Information:

    • Description: Use docker version or docker --version to find information about the Docker client and server versions.

    • Code Example:

      docker version
      
  4. Docker Client Version vs Docker Server Version:

    • Description: Docker consists of a client and a server. The client sends requests to the server to perform Docker-related tasks.

    • Code Example (Client Version):

      docker version --format '{{.Client.Version}}'
      
    • Code Example (Server Version):

      docker version --format '{{.Server.Version}}'
      
  5. List Docker Version Options:

    • Description: docker version provides various formatting options to display specific information.

    • Code Example (List All Options):

      docker version --help
      
  6. Docker Version Command Options Explained:

    • Description: Explore various options of the docker version command for detailed information.

    • Code Example (Client Version):

      docker version --format '{{.Client.Version}}'
      
    • Code Example (Server Version):

      docker version --format '{{.Server.Version}}'
      
  7. Upgrade Docker Version Command:

    • Description: To upgrade Docker to the latest version.

    • Code Example (On Linux):

      sudo apt-get update
      sudo apt-get install docker-ce docker-ce-cli containerd.io
      
    • Code Example (On Windows/Mac): Download and install the latest Docker Desktop version from the official website.

  8. Check Docker Engine Version:

    • Description: Display the Docker Engine (server) version.

    • Code Example:

      docker version --format '{{.Server.Version}}'