How to check if Docker is running on Windows?

Try running either of these commands on Powershell or cmd, if docker is installed, you should get a error free response:

docker --version
OR
docker-compose --version
OR
docker ps


Afford two methods:

  1. docker version

    This method works both for cmd & powershell, but if for cmd, you need to use echo %errorlevel% to check the result.

    If docker daemon is running, it will be like next:

    PS C:\> docker version
    Client: Docker Engine - Community
    Version:           18.09.2
    API version:       1.39
    Go version:        go1.10.8
    Git commit:        6247962
    Built:             Sun Feb 10 04:12:31 2019
    OS/Arch:           windows/amd64
    Experimental:      false
    
    Server: Docker Engine - Community
     Engine:
      Version:          18.09.2
      API version:      1.39 (minimum version 1.12)
      Go version:       go1.10.6
      Git commit:       6247962
      Built:            Sun Feb 10 04:13:06 2019
      OS/Arch:          linux/amd64
      Experimental:     false
    PS C:\> echo $?
    True
    

    If docker daemon not running, it will be next:

    PS C:\> docker version
    Client: Docker Engine - Community
    Version:           18.09.2
    API version:       1.39
    Go version:        go1.10.8
    Git commit:        6247962
    Built:             Sun Feb 10 04:12:31 2019
    OS/Arch:           windows/amd64
    Experimental:      false
    Error response from daemon: An invalid argument was supplied.
    PS C:\> echo $?
    False
    
  2. Get-Process:

    This method just works for powershell.

    If docker daemon is running, it will be next:

    PS C:\> Get-Process 'com.docker.proxy'
    Handles  NPM(K)    PM(K)      WS(K)     CPU(s)     Id  SI ProcessName
    -------  ------    -----      -----     ------     --  -- -----------
        205      10    11416      18860       0.13  12620   2 com.docker.proxy
    PS C:\> echo $?
    True
    

    If docker daemon is not running, it will be next:

    PS C:\> Get-Process 'com.docker.proxy'
    Get-Process : Cannot find a process with the name "com.docker.proxy". Verify the process name and call the cmdlet
    again.
    At line:1 char:1
    + Get-Process 'com.docker.proxy'
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : ObjectNotFound: (com.docker.proxy:String) [Get-Process], ProcessCommandException
        + FullyQualifiedErrorId : NoProcessFoundForGivenName,Microsoft.PowerShell.Commands.GetProcessCommand
    
    PS C:\> echo $?
    False