![]() |
VOOZH | about |
Podman is a new tool for managing containers. It's daemonless unlike Docker and built from the bottom up to play well with the Linux ecosystem. Podman is designed in the same way that traditional Linux tools are, it is lightweight, does not request more rights than necessary, and readily cooperates with SELinux.
Podman unshare is useful for troubleshooting unprivileged activities and manually removing storage and other data associated with images and containers. It is also helpful to use the podman mount command. If unprivileged users want to mount and interact with a container, they must run podman unshare. Executing the podman mount fails for unprivileged users unless the user executes within a podman unshare session.
Here is the step-by-step implementation of the Podman unshare command for debugging:
To get started, first identify the container you wish to debug. All currently running containers can be listed using.
podman psOutput:
You must mount the container's filesystem to access it in the unshared environment before running podman unshare.
container_mount=$(podman mount <container-id>)Output:
Enter the unshared environment now, where the root user in the user namespace is mapped to your user ID.
podman unshareOutput:
Next, Go to the mounted container filesystem using the unshared shell.
cd $container_mountOutput:
To verify ownership and permissions, you can now examine the files and directories. For example.
ls -l /path/to/file/or/directoryOutput:
Lastly, unmount the container filesystem to clean up.
podman umount <container-id>Output:
In this article, we have learned about the Podman unshare command for debugging. The podman unshare command is an effective tool for troubleshooting container-related issues, notably those affecting user namespaces, file permissions, and user ID mapping.