Search code examples
dockerdockerfilepodmanbuildahdocker-cli

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

  • Docker and Podman do not share the same storage. They cannot, because Docker controls lock it to its storage within the daemon. On the other hand, Podman, Buildah, CRI-O, Skopeo can all share content between one another.

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

    Something like this should work:

    podman run docker-daemon:alpine echo hello
    

    Note, that podman is pulling the image out of the docker daemon and is storing the image in its containers storage, and then running the container rather than 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 (but not in the opposite direction as you probably would prefer).