podman unshare - docker rootless - nsenter

Ever since I switched to podman, I really appreciated the rootless setup. Something about increased security.

Recently I had to help someone out with docker rootless and I was really missing podman unshare. Which basically is the unshare subcommand. Luckily something similar exists, which can be used for docker rootless, namely nsenter.

To execute a command in the namespace of the docker rootless daemon, you can use this:

nsenter -U --preserve-credentials -n -t $(pgrep dockerd) somecommand