Home  >  Article  >  Operation and Maintenance  >  Where is the file downloaded by docker?

Where is the file downloaded by docker?

下次还敢
下次还敢Original
2024-04-07 19:03:21679browse

The downloaded files in the Docker container are stored in the container's independent file system by default. The specific location is /var/lib/docker/containers/[container_id]/[layer_id]/, where container_id is the container ID and layer_id Is the ID of the source image layer. The exact location of a specific file can be obtained through the docker inspect command.

Where is the file downloaded by docker?

Docker download file default storage location

Docker download file within the container is stored in the container's file system by default . The container's file system is an independent, isolated virtual file system, which is different from the host file system.

Specific location:

Downloaded files are usually stored in /var/lib/docker/containers/[container_id]/[layer_id]/ directory, where:

  • container_id is the ID of the container.
  • layer_id is the ID of the source image layer of the file.

Command to get the exact location:

You can get the exact location of a specific file in the container file system using the following command:

<code class="shell">docker inspect [container_id] | jq -r '.[0].GraphDriver.Data["/var/lib/docker/overlay2/[layer_id]/.diff"]'</code>

Replace [container_id] and [layer_id] to get the required information.

Note:

  • The default volume for a Docker container is not stored in the container's file system unless explicitly mounted or using -v flag.
  • The container's file system will be destroyed after the container is deleted, so the downloaded files will not remain on the host.
  • You can use Docker volumes or native mounts to persist data in containers.

The above is the detailed content of Where is the file downloaded by docker?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn