DEV Community

Daniel Filimon
Daniel Filimon

Posted on

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!