'Can Docker CLI, Podman and other similar tools have shared local storage for images?

I recently started using podman and realized that images pulled via docker doesn't become available for use to podman and vice-versa. For example:-

If I pull the image using docker CLI, as shown below

docker pull registry.access.redhat.com/ubi7-minimal

and If I want to use the same image with podman or buildah, turns out I cannot

[riprasad@localhost ~]$ podman inspect registry.access.redhat.com/ubi7-minimal
Error: error getting image "registry.access.redhat.com/ubi7-minimal": unable to find 'registry.access.redhat.com/ubi7-minimal' in local storage: no such image

I understand that this is because both podman and docker uses a different storage location and hence the image pulled down via docker doesn't becomes available for use with podman and vice-versa.

[riprasad@localhost ~]$ docker images
REPOSITORY                                                                                 TAG                 IMAGE ID            CREATED             SIZE
registry.access.redhat.com/ubi7-minimal                                                    latest              fc8736ea8c5b        5 weeks ago         81.5MB

[riprasad@localhost ~]$ podman images
REPOSITORY   TAG   IMAGE ID   CREATED   SIZE

Is there a way to mitigate this issue, and somehow make docker and podman work inter-changeably on the very same image, irrespective of whether it has been pulled down via docker or podman ??



Solution 1:[1]

Docker and Podman do not sure the same storage. They can not, because Docker controls locking to its storage within the daemon. While Podman, Buildah, CRI-O, Skopeo all can share content, because they use the file system.

Podman and the other tools can work with the docker-daemon storage indirectly, via the "docker-daemon" transport.

Something like:

podman run docker-daemon:alpine echo hello

Should work.

Note, that podman is pulling the image out of the docker daemon and is storing the image in containers/storage, and then running the container, it is not using the Docker storage directly.

You can also do

podman push myimage docker-daemon:myimage

To copy an image from containers/storage into the docker daemon.

Solution 2:[2]

Adding to @rhatdan's post

podman run docker://alpine echo hello

This worked for me.

For more details: Here->

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 rhatdan
Solution 2