Ciasto piekarz
Ciasto piekarz

Reputation: 8277

Where does docker images pulled from registry gets stored locally?

Where does docker images pulled from registry gets stored locally?

Can the local storage of docker images pulled from hub be changed?

And when we run an instance of image, where is that container located/copied/ or running from?

Upvotes: 1

Views: 3105

Answers (2)

Guady Bird
Guady Bird

Reputation: 16

Related to the question “Can the local storage of docker images pulled from hub be changed?” To relocate default docker's directory (/var/lib/docker) to another place without modification, consider using rsync command in linux terminal to avoid inconsistences,i.e.

$ sudo rsync -aqxP /var/lib/docker/ /new/path/docker

ref: https://linuxconfig.org/how-to-move-docker-s-default-var-lib-docker-to-another-directory-on-ubuntu-debian-linux

Upvotes: 0

BMitch
BMitch

Reputation: 264761

By default, docker uses /var/lib/docker for storing images, containers, volumes, and other components. The only times I'd recommend accessing this location directly is to completely wipe it should it become corrupt, or to relocate the directory to another filesystem without modification.

Docker references images and layers with a checksum which may fail if you modify the contents of these directories, particularly if you have content trust enabled.

When you run a container, docker uses a union fs with the various filesystem layers of the image plus a read/write layer for the container. The image files and directories are not duplicated for each running container, rather they are read-only layers that get modified by changing the container's read/write layer.

To modify an image, you will want to build your own using a Dockerfile that uses a FROM line with the appropriate parent image that you want to update for your own purposes.

Upvotes: 1

Related Questions