I managed to find the containers under directory /var/lib/docker/containers, but I can\'t find the images.
What are the directories and files under
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.
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.
The contents of the /var/lib/docker directory vary depending on the driver Docker is using for storage.
By default this will be aufs but can fall back to overlay, overlay2, btrfs, devicemapper or zfs depending on your kernel support. In most places this will be aufs but the RedHats went with devicemapper.
You can manually set the storage driver with the -s or --storage-driver= option to the Docker daemon.
/var/lib/docker/{driver-name} will contain the driver specific storage for contents of the images. /var/lib/docker/graph/<id> now only contains metadata about the image, in the json and layersize files.In the case of aufs:
/var/lib/docker/aufs/diff/<id> has the file contents of the images./var/lib/docker/repositories-aufs is a JSON file containing local image information. This can be viewed with the command docker images.In the case of devicemapper:
/var/lib/docker/devicemapper/devicemapper/data stores the images/var/lib/docker/devicemapper/devicemapper/metadata the metadataIf you are using Docker for MAC (not boot2docker) then the location is /Users/<</>UserName></>/Library/Containers/com.docker.docker/Data/
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