2

How can I really easy find one running container with the name for example "mongo" or "webhost" in Powershell win 10 pro? I'm trying to learn Docker by Udemy. He's teaching in Linux. He made a container mongo, started it , and used this command in the terminal to find running process:

ps aux | grep mongo

I tried to do it in powershell in window 10 pro. I googled and found a command like this:

tasklist | findstr "mongo"

but it didn't find mongo. then tried new command:

tasklist | findstr "docker"

and output was like this:

λ  tasklist | findstr docker
com.docker.service            5560 Services                   0     12,268 K
com.docker.backend.exe       18280 Console                    6     21,656 K
com.docker.proxy.exe         16988 Console                    6     22,636 K

How can I easily find a running container with a specific name like "mongo" or "webhost" in Powershell win 10 pro?

Nico Nekoru
  • 2,840
  • 2
  • 17
  • 38

1 Answers1

0

I know the answer is too late but I hope it still helps someone else.

For PowerShell, we can find the container by using

docker ps -a | findstr <your container id>

or

docker ps -a | findstr <your image>

(The container id, and image can be found using the command docker ps -a)

In your case, I would suggest docker ps -a | findstr mongo (or you can find your container id and find it)

Explanation:

As you type docker ps --help, they explain

docker ps: default shows just running containers (in your case, I am not sure if your containers started already or not, so I would suggest to check using the -a option)

docker ps -a: this helps to show all containers including the not running containers

findstr <what you want to find>: is a PowerShell command, which is similar to grep

Alternatives:

If you install Git Bash, you can try with Linux commands and it still works

docker ps -a | grep <what you want to find>

Tuan Hoang
  • 586
  • 1
  • 7
  • 14