How to check if Docker is running on Windows? How to check if Docker is running on Windows? powershell powershell

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 versionClient: Docker Engine - CommunityVersion:           18.09.2API version:       1.39Go version:        go1.10.8Git commit:        6247962Built:             Sun Feb 10 04:12:31 2019OS/Arch:           windows/amd64Experimental:      falseServer: 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:     falsePS C:\> echo $?True

    If docker daemon not running, it will be next:

    PS C:\> docker versionClient: Docker Engine - CommunityVersion:           18.09.2API version:       1.39Go version:        go1.10.8Git commit:        6247962Built:             Sun Feb 10 04:12:31 2019OS/Arch:           windows/amd64Experimental:      falseError 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.proxyPS 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 cmdletagain.At line:1 char:1+ Get-Process 'com.docker.proxy'+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~    + CategoryInfo          : ObjectNotFound: (com.docker.proxy:String) [Get-Process], ProcessCommandException    + FullyQualifiedErrorId : NoProcessFoundForGivenName,Microsoft.PowerShell.Commands.GetProcessCommandPS C:\> echo $?False


docker info

  • The operating-system independent way to check whether Docker is running is to ask Docker, using the docker info command. This option will work for both Windows and Linux distributions.
  • If Docker is running when you will get result as shown below, otherwise you will get an error message:
C:\Users\himanshu.agrawal>docker infoClient: Debug Mode: false Plugins:  scan: Docker Scan (Docker Inc., v0.3.4)Server: Containers: 1  Running: 0  Paused: 0  Stopped: 1 Images: 2 Server Version: 19.03.13 Storage Driver: overlay2  Backing Filesystem: extfs  Supports d_type: true  Native Overlay Diff: true Logging Driver: json-file Cgroup Driver: cgroupfs Plugins:  Volume: local  Network: bridge host ipvlan macvlan null overlay  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog Swarm: inactive Runtimes: runc Default Runtime: runc Init Binary: docker-init containerd version: 8fba4e9a7d01810a393d5d25a3621dc101981175 runc version: dc9208a3303feef5b3839f4323d9beb36df0a9dd init version: fec3683 Security Options:  seccomp   Profile: default Kernel Version: 5.4.39-linuxkit Operating System: Docker Desktop OSType: linux Architecture: x86_64 CPUs: 2 Total Memory: 1.915GiB Name: docker-desktop ID: HHIB:HQRB:7VBA:LBUY:HKVJ:LFZ3:FSWZ:4ARP:74ZB:TIWO:WTMG:LHZH Docker Root Dir: /var/lib/docker Debug Mode: false Registry: https://index.docker.io/v1/ Labels: Experimental: false Insecure Registries:  127.0.0.0/8 Live Restore Enabled: false Product License: Community Engine

Get-Process 'com.docker.proxy'

  • This option can only be used with Windows Power Shell (just Power Shell, not even with CMD). If Docker is running you will get output as below, otherwise you will get an error message:
PS C:\Users\himanshu.agrawal> Get-Process 'com.docker.proxy'Handles  NPM(K)    PM(K)      WS(K)     CPU(s)     Id  SI ProcessName-------  ------    -----      -----     ------     --  -- -----------    178      15    22984      25172       0.77  14224   1 com.docker.proxy

Other options - Linux specific

  • You can also use operating system utilities, such as sudo systemctl is-active docker or sudo status docker or sudo service docker status, or checking the service status using Windows utilities.
  • Finally, you can check in the process list for the "dockerd" process,using commands like ps or top.

Source 1