DEV Community

Cover image for How to run Docker commands in CMD/PowerShell powered by Docker running in WSL2
Federico Navarrete
Federico Navarrete

Posted on • Edited on • Originally published at supernovaic.blogspot.com

9 1

How to run Docker commands in CMD/PowerShell powered by Docker running in WSL2

In the last tutorial, we learned how to create Docker images without Docker Desktop in Windows. However, this can break our daily duties, especially if we have automated anything. This can be fixed in three steps:

1) Start Docker in Ubuntu using:

sudo dockerd
Enter fullscreen mode Exit fullscreen mode

2) Open a new CMD/PowerShell window without closing the Ubuntu one.

3) Add the prefix wsl before every docker command and run them.

wsl docker --version
wsl docker --help
Enter fullscreen mode Exit fullscreen mode

[preview]

And that's all. You can find other tutorials on how to remove the prefix, but this is the easiest and fastest option.

Follow me on:

Personal LinkedIn YouTube Instagram Cyber Prophets Sharing Your Stories
Personal LinkedIn YouTube Instagram RedCircle Podcast RedCircle Podcast

sponsor me

Image of Timescale

Timescale – the developer's data platform for modern apps, built on PostgreSQL

Timescale Cloud is PostgreSQL optimized for speed, scale, and performance. Over 3 million IoT, AI, crypto, and dev tool apps are powered by Timescale. Try it free today! No credit card required.

Try free

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more