docker build -t webapp .
–
–
–
–
–
–
–
The images are stored in /var/lib/docker/graph/<id>/layer
.
Note that images are just diffs from the parent image. The parent ID is stored with the image's metadata /var/lib/docker/graph/<id>/json
.
When you docker run
an image. AUFS will 'merge' all layers into one usable file system.
On the newly released 'Docker for Windows', which uses Hyper-V, data is located in the Docker virtual hard disk:
C:\Users\Public\Documents\Hyper-V\Virtual hard disks\MobyLinuxVM.vhdx
You can also open the 'Hyper-V Manager' for access to the Docker / MobyLinuxVM.
–
–
–
–
–
–
–
Expanding on Tristan's answer, in Windows with Hyper-V you can move the image with these steps from matthuisman:
In Windows 10,
Stop docker etc
Type "Hyper-V Manager" in task-bar search box and run it.
Select your PC in the left hand pane (Mine is called
DESKTOP-CBP**)
Right click on the correct virtual machine (Mine is
called MobyLinuxVM)
Select "Turn off" (If it is running)
Right click on it again and select "Move"
Follow the prompts
–
–
I can answer this question only for Ubuntu users:
The root directory of docker can be found when you run the command docker info
Docker directory will be given in this line: "Docker Root Dir: /var/lib/docker
"
About the docker images, they are stored inside the docker directory:
/var/lib/docker/aufs/diff/
Remember these things are not same in all version of docker. Currently, I am using 1.12.3.
If you keep in mind that Docker is still running in a VM, the system paths are relative to the VM and not from the Mac Osx system.
As it says all is contained in a VM file :
/Users/MyUserName/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/Docker.qcow2
Try to run Alpine image with this volume option and the ls command you are able to list the VM host:
docker run --rm -it -v /:/vm-root alpine:edge ls -l /vm-root
After this just try :
docker run --rm -it -v /:/vm-root alpine:edge ls -l
/vm-root/var/lib/docker
Now, you are able to list the docker folder from the VM host
Depending on the storage driver in use, additional information can be shown, such as pool name, data file, metadata file, data space used, total data space, metadata space used, and total metadata space.
The data file is where the images are stored and the metadata file is where the meta data regarding those images are stored. When run for the first time Docker allocates a certain amount of data space and meta data space from the space available on the volume where /var/lib/docker
is mounted.
Here is the example on Ubuntu (check Root Dir):
$ docker info
Server Version: 18.06.1-ce
Storage Driver: aufs
Root Dir: /var/snap/docker/common/var-lib-docker/aufs
Docker Root Dir: /var/snap/docker/common/var-lib-docker
And here is the example on Travis CI (see Docker Root Dir):
$ docker info
Server Version: 17.09.0-ce
Storage Driver: overlay2
Backing Filesystem: extfs
Docker Root Dir: /var/lib/docker
You can use --format
parameter to extract that information into a single file, e.g.
$ docker info --format '{{.DriverStatus}}'
[[Root Dir /var/snap/docker/common/var-lib-docker/aufs] [Backing Filesystem extfs] [Dirs 265] [Dirperm1 Supported true]]
$ docker info --format '{{json .DriverStatus}}'
[["Root Dir","/var/snap/docker/common/var-lib-docker/aufs"],["Backing Filesystem","extfs"],["Dirs","265"],["Dirperm1 Supported","true"]]
Environment: Windows 10 Pro, docker desktop 2.0.3.0 edge
right-click docker icon in system tray, select settings - advanced :
Disk image location (editable via the browser) :
C:\Users\Public\Documents\Hyper-V\Virtual Hard Disks\DockerDesktop.vhdx
(it's there - Documents directory is hidden)
–
On Fedora, Docker uses LVM for storage if available. On my system docker info
shows:
Storage Driver: devicemapper
Pool Name: vg01-docker--pool
Pool Blocksize: 524.3 kB
Base Device Size: 10.74 GB
Backing Filesystem: xfs
Data file:
Metadata file:
Data Space Used: 9.622 GB
In that case, to increase storage, you will have to use LVM command line tools or compatible partition managers like blivet.
In Windows 2016, docker (DockerMsftProvider) uses the folder "windowsfilter" under docker root
>docker info
Storage Driver: windowsfilter
Docker Root Dir: C:\ProgramData\docker
It uses the "tmp" folder under docker root to download the files and it deletes the files after extracting the downloaded files to "windowsfilter" folder.
docker info
to find system-wide information.
images are stored at /var/lib/docker/image/overlay2/imagedb/content
and
containers are stored at /var/lib/docker/containers
docker version 18.06.0-ce
, API version 1.38
I couldn't resolve the question with Docker version 18.09 on macos using the above answers and tried again.
The only actual solution for me was using this docker-compose.yml
configuration:
version: '3.7'
services:
demo-service:
volumes:
- data-volume:/var/tmp/container-volume
volumes:
data-volume:
driver: local
driver_opts:
type: none
o: bind
device: /tmp/host-volume
After launching with docker-compose up
I finally had /tmp/host-volume
from macos shared as writeable volume from within the container:
> docker exec -it 1234 /bin/bash
bash-4.4$ df
Filesystem 1K-blocks Used Available Use% Mounted on
osxfs 488347692 464780044 21836472 96% /var/tmp/container-volume
Hope this helps others too.
Images are stored inside /var/lib/docker
and then under applicable storage driver
directory.
Storage driver, being used, can be determined by executing docker info
command.
This is still strange to me, because now it leads to the question. Where is my machine's local Docker image registry?
Nevertheless, I definitely think this info is worth sharing as an answer.
–
If anyone need it for scripting purposes, here is a one-line solution.
In POSIX shell, with PCRE enabled grep
, try:
DOCKER_ROOT_DIR="$(docker info 2>&1 | grep -oP '(?<=^Docker Root Dir: ).*')"
In PowerShell:
$DOCKER_ROOT_DIR="$(docker info 2>&1 | foreach {if($_ -match "Docker Root Dir"){$_.TrimStart("Docker Root Dir: ")}})"
Note, when on Windows 10 (as of 10.0.18999.1
), in default configurations, it returns:
C:\ProgramData\Docker
in "Windows containers" mode
/var/lib/docker
, in "Linux containers" mode
–
–
site design / logo © 2019 Stack Exchange Inc; user contributions licensed under cc by-sa 4.0
with attribution required.
rev 2019.12.4.35542