DEV Community

Daniel Filimon
Daniel Filimon

Posted on

2 1

How to run podman rootless in WSL

TL;DR sudo mount --make-rshared /


If you're anything like me and you're trying to use podman inside WSL, you may get the following issue when running any podman command:

$ podman ps
WARN[0000] "/" is not a shared mount, this could cause issues or missing mounts with rootless containers
Enter fullscreen mode Exit fullscreen mode

So what can you do? Run every podman command with sudo?
That's not an option.

Thankfully, there's an easy fix on WSL. First, to diagnose the problem, run findmnt -o PROPAGATION. You'll probably get an output like this:

$ findmnt -o PROPAGATION
PROPAGATION
private
shared
private
private
private
private
private
private
private
private
private
private
private
private
private
private
private
private
private
private
private
private
private
private
private
Enter fullscreen mode Exit fullscreen mode

So podman is complaining about the / mount not being shared, for which there is an easy fix: sudo mount --make-rshared /.
Then, if you run findmnt -o PROPAGATION again you'll notice the change:

$ findmnt -o PROPAGATION
PROPAGATION
shared
shared
shared
shared
shared
shared
shared
shared
shared
shared
shared
shared
shared
shared
shared
shared
shared
shared
shared
shared
shared
shared
shared
shared
shared
shared
shared
shared
shared
shared
Enter fullscreen mode Exit fullscreen mode

Finally, podman ps now works properly:

$ podman ps
CONTAINER ID  IMAGE       COMMAND     CREATED     STATUS      PORTS       NAMES
Enter fullscreen mode Exit fullscreen mode

Yay!

Top comments (1)

Collapse
 
bowmanjd profile image
Jonathan Bowman

Nice clear article to solve a common problem. Thank you!

Image of Arm event

Learn How Ruth Amos Supercharges Developer Creativity

🧒🏽 Tap into your child-inspired creativity.
🤝 Embrace fearless problem-solving.
💡 Create ground-breaking solutions.
🔑 Level up your design and development skills.
🏆 Learn from an award-winning engineer and innovator.

Register Now

👋 Kindness is contagious

Dive into this article within the nurturing environment of the DEV Community—where developers from various walks of life are invited to enhance our shared well of knowledge.

A gesture of "thanks" means a lot—show your appreciation in the comment section!

Insights elevate the DEV journey and strengthen our community bond. Has this piece added to your knowledge? Take a moment to acknowledge the author's effort with a comment of gratitude.

Okay