How To Manually Remove A Container In Podman

Jean-Nicolas Boulay
1 min readJan 15, 2020

--

Recently I kept getting this error:

podman run — rm — net=host — name=container container
error creating container storage: the container name “container” is already in use by “31d7724324lks3019908d896we22ece4f7db78162db4c8faab60725dbd4e1”. You have to remove that container to be able to reuse that name.: that name is already in use

I tried podman rm, then podman rmi, etc.

It used to work.

But some reason it didn’t anymore.

So what I did is remove it manually.

Here is how you do it:

cd /home/`whoami`/.local/share/containers/storage/vfs-containers/

Inside you will see the file: containers.json

Then make a backup in case you damage it.

cp containers.json containers.json.bck

Then find the JSON object ({…}) that contains the container UUID that you saw before.
e.g.: 31d7724324lks3019908d896we22ece4f7db78162db4c8faab60725

Then remove it.

In the same directory find the folder with the UUID of the container.
e.g.: 31d7724324lks3019908d896we22ece4f7db78162db4c8faab60725

Rename the directory.
mv 31d7724324lks3019908d896we22ece4f7db78162db4c8faab60725 31d7724324lks3019908d896we22ece4f7db78162db4c8faab60725_bck

Now, everything should work as usual.

If everything is functioning normally, you can delete the backups.

Good luck!

--

--