How to reset podman and buildah after experimenting as a non-root user?

Viewed 5409

A non-root user has been experimenting with running podman and buildah commands but would now just want to reset everything to as it was before starting the experiment (i.e. all container images and containers should be deleted together with the buildah and podman configuration).

My best guess is running

testuser@linux:~$ rm -rf  ~/.local/share/containers/

might work.

What commands do you recommend for this?

Software versions used

Ubuntu 18.04.2 with https://launchpad.net/~projectatomic/+archive/ubuntu/ppa

testuser@linux:~$ dpkg -l|grep podm
ii  podman                                     1.3.2-1~dev~ubuntu18.04~ppa15                amd64        Manage pods, containers and container images.
testuser@linux:~$ dpkg -l|grep buildah
ii  buildah                                    1.9.0-1~dev~ubuntu18.04~ppa17                amd64        A command line tool used for creating OCI images.
testuser@linux:~$
3 Answers

I have been thinking about adding a command to do this.

podman system reset

Or something like that.

But if nothing has been modified

$ rm -rf  ~/.local/share/containers/ ~/.config/containers

Should get you want you want.

I would not do it by deleting the storage they way you are because you are assuming there is nothing stored elsewhere under the mount point of the image or container. If you want to clean up EVERYTHING I would do this:

podman rmi -f $(podman images -a -q)

and then

buildah rm -a

The Red Hat OpenShift training labs recommend these commands to stop and clear cached images:

podman stop --all   # stop all running containers
podman rmi --all    # remove all defined containers, state data and locally cached images
Related