Docker image local storage location?

I am new to docker and I can’t seem to figure out the answer to this question:
When you pull a docker image from a docker repo (I.E. docker hub), where is the image stored locally? or is it even stored locally? This is important because i need to be able to modify another and upload an image file to a git repo.

Thanks in advance :slight_smile:

Docker images gets stored locally. It depends on the OS and the filesystem being used. Docker uses layered filesystem. Typically, it gets stored under /var/lib/docker.
To change the image, you have 2 options:
run container, make changes to the image, export it as new container image. I would not suggest this approach as its difficult to maintain this.
create dockerfile with old base image and make changes. this is suggested approach.

If your aim is to use it on another remote system their are two ways.

  1. docker push (which will take the particular image from your machine and save to the docker hub from where you can pull anytime)
  2. docker save (This will bundle the image to a single .tgz file which you can copy between the required machines)

The mostly used method is the 1st one but 2nd method becomes handy in cases of were your remote machine doesn’t have internet access.
Thanks in advance
Regards from Vidya Vox (Jio4GVoice)

1 Like