Home  >  Article  >  Operation and Maintenance  >  How to check where container information is stored in docker

How to check where container information is stored in docker

WBOY
WBOYOriginal
2022-02-07 10:31:096730browse

In docker, you can use the inspect command to see where the container information is stored. The function of this command is to obtain the metadata of the container or image. You can view the container information by setting the parameters to the specified container name. Syntax is "docker inspect container name".

How to check where container information is stored in docker

The operating environment of this tutorial: linux7.3 system, docker-1.13.1 version, Dell G3 computer.

How to check where container information is stored in docker

We know that under the docker architecture, there are concepts of containers and images. Images are more static, while containers are instantiations of images and more dynamic. If we want the container and the host to share a folder, we can use the -v parameter to make a volume mapping. However, a common understanding is that if the container is broken (cannot be started), the contents in the container will be completely lost. But if you think about it carefully, the consistency of the file system is maintained in every stop and start of the container. In other words, in addition to mounting volumes, a file must be retained on the host machine in the docker container. So when the container cannot be opened, how to find the files in the container from the host and take them out?

Let’s take the specific problem I encountered. Because a configuration file in the container was modified, the container could not be started. You can follow the steps below to find the files in the container.

 1. docker inspect

To view the container information through docker inspect container name/ID, the field we need to find is: GraphDriver

How to check where container information is stored in docker

We need to pay attention to the UpperDir here. Use the ls command to see what is in this folder.

2. Find the files you need~

How to check where container information is stored in docker

Isn’t this the root directory of the container? Just find the files you need.

Recommended learning: "docker video tutorial"

The above is the detailed content of How to check where container information is stored in 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