How to view files in docker image

angryTom
Release: 2020-03-16 18:20:47
Original
7972 people have browsed it

How to view files in docker image

How to view the files in the docker image

1. If it is already running

For the running image, we can view it through its ContrainerID

docker attach ContainerID
Copy after login

In this way, the corresponding container needs to be running and not in the stop state

2. If it is not running

If it is not running, you can copy the files in the Docker image to the host. The command is as follows:

docker cp <容器名称>:<路径> <主机路径>
Copy after login

For example:

sudo docker cp nginx-ubuntu-container:/etc/apt/sources.list ~/Documents/
Copy after login

In this way, the corresponding container does not need to be running.

For more related tutorials, please pay attention to the docker tutorial column on the PHP Chinese website.

The above is the detailed content of How to view files in docker image. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template