Where does docker pull stores the image?

Not exactly related to the training, but I just encountered it here, and don’t really know where to find it.

How can I find out wehre docker has pulled my image. Is there a way I can influence it?

thanks

Assa

Hi @yeroslaviz! Welcome to the community forum :slight_smile:

The location of pulled container images depends on your operating system. As Docker is native only in Linux, if you’re using Microsoft Windows or macOS as operating systems, docker runs inside a Virtual Machine with Linux and therefore the container images will be stored within a virtual disk file managed by Docker.

On Linux, you’ll probably find the container images that you pulled in /var/lib/docker, but be careful with what you do over there, as you could corrupt data and prevent Docker from using this container images.

As for influencing it, it depends on what you mean. If you’re on Linux, you could edit the Docker root directory in /etc/docker/daemon.json by changing the data-root value.

Thank you Marcel,

I do work on Linux (the codespace you provided for the training :slight_smile: )

One follow-up question.

I did docker pull to pull the cowpy image. but I don’t have anything under /var/lib/docker/ .

any ideas where I can find it?

thanks

Assa

Things work differently in GitHub Codespaces when compared to a regular machine. The Codespace itself is a container being run, so when we run a container there, we’re doing what is known as DIND: Docker-in-Docker. That’s why you can’t find the container images in the usual location. It’s abstracted by Docker. The thing is: You usually don’t need the physical images. Docker does all the heavy lifting for you.

And if you still want to have a file, I thought of something else that may be interesting to you: docker save and docker load. You can read more about docker save here. With them, you can save a container image to a file that you can share with others and they will be able to run the container image from this file with docker load.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.