- Var lib docker windows
- Ответы (23)
- Where are docker images and containers stored when we use it with Windows?
- 5 Answers 5
- Update 2020 for WSL2
- Where are Docker Images Stored? Docker Container Paths Explained
- Sebastian Barthel
- The storage location of Docker images and containers
- Docker for Mac
- Docker for Windows
- The internal structure of the Docker root folder
- Docker images
- Docker Volumes
- Clean up space used by Docker
- Summary
- References
- Sebastian Barthel
Var lib docker windows
590053 просмотра
23 ответа
Мне удалось найти контейнеры в каталоге /var/lib/docker/containers , но я не могу найти изображения.
Под какими каталогами и файлами /var/lib/docker ?
Ответы (23)
506 плюса
Содержимое /var/lib/docker каталога различается в зависимости от драйвера, который Docker использует для хранения .
По умолчанию это будет , aufs но может упасть обратно overlay , overlay2 , btrfs , devicemapper или в zfs зависимости от вашей поддержки ядра. В большинстве мест это будет, aufs но RedHats пошел с devicemapper .
Вы можете вручную установить драйвер хранилища с помощью опции -s или —storage-driver= для демона Docker .
- /var/lib/docker/
будет содержать специфичное для драйвера хранилище для содержимого изображений. - /var/lib/docker/graph/ теперь только содержит метаданные об изображении, в json и layersize файлах.
- /var/lib/docker/aufs/diff/ содержит содержимое файла изображений.
- /var/lib/docker/repositories-aufs файл JSON, содержащий локальную информацию об изображении Это можно посмотреть с помощью команды docker images .
В случае devicemapper :
- /var/lib/docker/devicemapper/devicemapper/data хранит изображения
- /var/lib/docker/devicemapper/devicemapper/metadata метаданные
- Обратите внимание, что эти файлы являются «разреженными» файлами с тонкой подготовкой, поэтому они не такие большие, как кажутся.
Автор: Air Размещён: 22.09.2014 04:31
253 плюса
При использовании Docker для Mac Application создается впечатление, что контейнеры хранятся в виртуальной машине, расположенной по адресу:
ОБНОВЛЕНИЕ (Предоставлено mmorin ):
По состоянию на 15 января 2019 года, кажется, есть только этот файл:
который содержит Docker Disk и все образы и контейнеры внутри него.
119 плюса
В особом случае Mac OS X или Windows, используя boot2docker, ваши образы Docker хранятся в виртуальной машине VirtualBox, управляемой boot2docker.
Эта виртуальная машина будет храниться в обычном месте образов VirtualBox:
Окна: %USERPROFILE%/VirtualBox VMs/boot2docker-vm
Вы можете сбросить его, запустив (ВНИМАНИЕ: это уничтожит все изображения, которые вы создали и загрузили до сих пор):
Это особенно полезно, если вы сохранили тонны промежуточных изображений при сборке / отладке сборки без полезных опций —rm, я приведу их здесь для справки: Использование:
Автор: Phil L. Размещён: 06.08.2014 08:54
87 плюса
На самом деле, изображения Docker хранятся в двух файлах, как показано следующей командой
Файл данных: /var/lib/docker/devicemapper/devicemapper/data
Файл метаданных: /var/lib/docker/devicemapper/devicemapper/metadata
68 плюса
Изображения хранятся в /var/lib/docker/graph/ /layer .
Обратите внимание, что изображения просто отличаются от родительского изображения. Родительский идентификатор хранится вместе с метаданными изображения /var/lib/docker/graph/ /json .
Когда вы docker run изображение. AUFS объединит все слои в одну используемую файловую систему.
Автор: creack Размещён: 07.10.2013 09:29
58 плюса
На недавно выпущенном Docker для Windows, который использует Hyper-V, данные находятся на виртуальном жестком диске Docker:
Вы также можете открыть «Диспетчер Hyper-V» для доступа к Docker / MobyLinuxVM.
Автор: Tristan Размещён: 17.07.2016 08:40
46 плюса
Для тех, кто использует панель инструментов Docker (которая использует docker-machine), ответы относительно boot2docker в Mac OS X недопустимы. Виртуальная машина Docker называется «по умолчанию» и существует в /Users/ /.docker/machine/machines/default/ каталоге.
Автор: mbbce Размещён: 17.09.2015 10:24
37 плюса
В Ubuntu вы можете «играть» с изображениями, запущенными
На самом деле, изображения хранятся в /var/lib/docker/aufs/diff
Автор: test30 Размещён: 13.05.2014 01:13
20 плюса
В Docker для Windows (собственная Windows) контейнерное хранилище по умолчанию находится по адресу:
20 плюса
Если вы используете Docker для MAC (не boot2docker ), то местоположение /Users/ UserName> /Library/Containers/com.docker.docker/Data/
6 плюса
Как ответили здесь , если вы находитесь на Mac, он находится по адресу
5 плюса
Более подробно об ответе Тристана, в Windows с Hyper-V вы можете переместить изображение с помощью следующих шагов из matthuisman:
- Стоп докер и т. Д.
- Введите «Диспетчер Hyper-V» в поле поиска панели задач и запустите его.
- Выберите свой ПК в левой панели (мой называется DESKTOP-CBP **)
- Щелкните правой кнопкой мыши на правильной виртуальной машине (моя называется MobyLinuxVM)
- Выберите «Выключить» (если он запущен)
- Щелкните правой кнопкой мыши еще раз и выберите «Переместить»
- Следуйте инструкциям
3 плюса
Я использую boot2docker для Docker на Mac OSX, поэтому изображения сохраняются в /Users/ /VirtualBox VMs/boot2docker-vm/boot2docker-vm.vmdk .
3 плюса
Я могу ответить на этот вопрос только для пользователей Ubuntu:
Корневой каталог докера можно найти при запуске команды docker info
Каталог Docker будет указан в этой строке: » Docker Root Dir: /var/lib/docker «
Об образах докеров они хранятся в каталоге докеров: /var/lib/docker/aufs/diff/
Помните, что эти вещи не одинаковы во всех версиях докера. В настоящее время я использую 1.12.3.
Автор: Arif A. Размещён: 08.12.2016 03:42
3 плюса
Если вы помните, что Docker все еще работает в ВМ, системные пути относятся к ВМ, а не из системы Mac Osx. Как говорится, все содержится в файле VM:
Попробуйте запустить Alpine образ с этим параметром тома и командой ls, вы можете перечислить хост VM:
docker run —rm -it -v /: / vm-root alpine: край ls -l / vm-root
После этого просто попробуйте:
запустить docker —rm -it -v /: / vm-root alpine: край ls -l / vm-root / var / lib / docker
Теперь вы можете перечислить папку докера с хоста WM
2 плюса
В Docker для Windows журналы находятся здесь: %USERPROFILE%\AppData\Local\Docker
Автор: omasoud Размещён: 30.07.2016 08:42
2 плюса
проверьте папку докера в /var/lib
изображения хранятся в расположении ниже:
0 плюса
В Fedora Docker использует LVM для хранения, если доступно. На моей системе docker info показывает:
В этом случае, чтобы увеличить объем хранилища, вам придется использовать инструменты командной строки LVM или совместимые менеджеры разделов, такие как blivet .
0 плюса
На Debian Unstable / Sid,
docker info найти общесистемную информацию.
изображения хранятся в /var/lib/docker/image/overlay2/imagedb/content и
контейнеры хранятся в /var/lib/docker/containers
версия докера, версия 18.06.0-ce API 1.38
Автор: Dhanuka Размещён: 14.09.2018 04:55
0 плюса
Используйте docker info команду для отображения общесистемной информации, и ее местоположение может отличаться.
В зависимости от используемого драйвера хранилища может отображаться дополнительная информация, такая как имя пула, файл данных, файл метаданных, используемое пространство данных, общее пространство данных, используемое пространство метаданных и общее пространство метаданных.
В файле данных хранятся изображения, а в файле метаданных хранятся метаданные, относящиеся к этим изображениям. При первом запуске Docker выделяет определенное количество пространства данных и пространства метаданных из пространства, доступного на томе, где /var/lib/docker смонтирован.
Вот пример на Ubuntu (проверьте Root Dir ):
И вот пример на Travis CI (см. Docker Root Dir ):
Вы можете использовать —format параметр, чтобы извлечь эту информацию в один файл, например
Автор: kenorb Размещён: 13.01.2019 06:53
0 плюса
В Windows 2016 докер (DockerMsftProvider) использует папку «windowsfilter» в корневом каталоге докера.
Он использует папку «tmp» в корневом каталоге докера для загрузки файлов и удаляет файлы после извлечения загруженных файлов в папку «windowsfilter».
0 плюса
Я не смог решить вопрос с Docker версии 18.09 на macos, используя приведенные выше ответы, и попытался снова.
Единственным реальным решением для меня было использование этой docker-compose.yml конфигурации:
После запуска docker-compose up я наконец-то получил /tmp/host-volume от macos общий доступный для записи том из контейнера:
Надеюсь, что это помогает другим.
0 плюса
Окружающая среда: Windows 10 Pro, Docker Desktop 2.0.3.0 край
щелкните правой кнопкой мыши значок докера в системном трее, выберите настройки — дополнительно:
Where are docker images and containers stored when we use it with Windows?
NOTE: Am super new to both Windows and Docker
The tutorial I’ve been using says that they are under /var/lib/docker/containers if we’re using Linux, but I can’t seem to find that on my Windows machine.
5 Answers 5
Enter docker-machine with
there you should find your containers.
Things might have changed with Windows 10 Anniversary Update. I installed Docker from source here (https://master.dockerproject.org/windows/amd64/docker-1.13.0-dev.zip) as described here:
Docker puts all of the images in this folder:
and all containers in this folder:
An easy way to check is to execute this:
It should tell you where your files are stored:
After review some post on Stackoverflow and Google. I found this directory :
Here you can fin the configuration with the Virtual Machines
Another important thing is the images are virtualized by the Hyper-V, so the info should be stored here.
Update 2020 for WSL2
If you’re using this with WSL2, docker images will be maintained inside of your wsl drive available at \\wsl$\ per this github issue:
- Windows: \\wsl$\docker-desktop-data\mnt\wsl\docker-desktop-data\data\docker\volumes
- Linux: sudo ls /mnt/wsl/docker-desktop-data/data/docker/volumes
Docker installed on windows with docker toolbox(using virtual box in place of hyper-v) one VM is created on at C:\Users\YOURUSERNAME\.docker\machine\machines with name default so you can find all VM files in default folder.
you can connect this vm using
and you can find pulled images and container under this path (you may need to use sudo sometimes)
Where are Docker Images Stored? Docker Container Paths Explained
Sebastian Barthel
Docker has been widely adopted and is used to run and scale applications in production. Additionally, it can be used to start applications quickly by executing a single Docker command.
Companies also are investing more and more effort into improving development in local and remote Docker containers, which comes with a lot of advantages as well.
You can get the basic information about your Docker configuration by executing:
The output contains information about your storage driver and your docker root directory.
The storage location of Docker images and containers
A Docker container consists of network settings, volumes, and images. The location of Docker files depends on your operating system. Here is an overview for the most used operating systems:
- Ubuntu: /var/lib/docker/
- Fedora: /var/lib/docker/
- Debian: /var/lib/docker/
- Windows: C:\ProgramData\DockerDesktop
- MacOS:
In macOS and Windows, Docker runs Linux containers in a virtual environment. Therefore, there are some additional things to know.
Docker for Mac
Docker is not natively compatible with macOS, so Hyperkit is used to run a virtual image. Its virtual image data is located in:
Within the virtual image, the path is the default Docker path /var/lib/docker .
You can investigate your Docker root directory by creating a shell in the virtual environment:
You can kill this session by pressing Ctrl+a, followed by pressing k and y.
Docker for Windows
On Windows, Docker is a bit fractioned. There are native Windows containers that work similarly to Linux containers. Linux containers are run in a minimal Hyper-V based virtual environment.
The configuration and the virtual image to execute linux images are saved in the default Docker root folder.
If you inspect regular images then you will get linux paths like:
You can connect to the virtual image by:
There, you can go to the referenced location:
The internal structure of the Docker root folder
Inside /var/lib/docker , different information is stored. For example, data for containers, volumes, builds, networks, and clusters.
Docker images
The heaviest contents are usually images. If you use the default storage driver overlay2, then your Docker images are stored in /var/lib/docker/overlay2 . There, you can find different files that represent read-only layers of a Docker image and a layer on top of it that contains your changes.
Let’s explore the content by using an example:
The LowerDir contains the read-only layers of an image. The read-write layer that represents changes are part of the UpperDir. In my case, the NGINX UpperDir folder contains the log files:
The MergedDir represents the result of the UpperDir and LowerDir that is used by Docker to run the container. The WorkDir is an internal directory for overlay2 and should be empty.
Docker Volumes
It is possible to add a persistent store to containers to keep data longer than the container exists or to share the volume with the host or with other containers. A container can be started with a volume by using the -v option:
We can get information about the connected volume location by:
The referenced directory contains files from the location /var/log of the NGINX container.
Clean up space used by Docker
It is recommended to use the Docker command to clean up unused containers. Container, networks, images, and the build cache can be cleaned up by executing:
Additionally, you can also remove unused volumes by executing:
Summary
Docker is an important part of many people’s environments and tooling. Sometimes, Docker feels a bit like magic by solving issues in a very smart way without telling the user how things are done behind the scenes. Still, Docker is a regular tool that stores its heavy parts in locations that can be opened and changed.
Sometimes, storage can fill up quickly. Therefore, it’s useful to inspect its root folder, but it is not recommended to delete or change any files manually. Instead, the prune commands can be used to free up disk space.
I hope you enjoyed the article. If you like it and feel the need for a round of applause, follow me on Twitter. I work at eBay Kleinanzeigen, one of the biggest classified companies globally. By the way, we are hiring!
Happy Docker exploring 🙂
References
- Docker storagediver documentation
https://docs.docker.com/storage/storagedriver/ - Documentation Overlay filesystem
https://www.kernel.org/doc/Documentation/filesystems/overlayfs.txt
Sebastian Barthel
Software engineer who loves writing software and teaching people in software engineering and machine learning. Since 2019, I work for one of eBay‘s classified business called eBay Kleinanzeigen.
If you read this far, tweet to the author to show them you care. Tweet a thanks
Learn to code for free. freeCodeCamp’s open source curriculum has helped more than 40,000 people get jobs as developers. Get started
freeCodeCamp is a donor-supported tax-exempt 501(c)(3) nonprofit organization (United States Federal Tax Identification Number: 82-0779546)
Our mission: to help people learn to code for free. We accomplish this by creating thousands of videos, articles, and interactive coding lessons — all freely available to the public. We also have thousands of freeCodeCamp study groups around the world.
Donations to freeCodeCamp go toward our education initiatives, and help pay for servers, services, and staff.