:" command to copy the file to the host for viewing."/> :" command to copy the file to the host for viewing.">

Home  >  Article  >  Operation and Maintenance  >  How to view files in docker

How to view files in docker

尚
Original
2020-04-03 11:02:147957browse

How to view files in docker

How docker views files:

1. If it is already running

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

docker attach ContainerID

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

2. If it is not running

For the one that is not running, you can put the Docker image Copy the files in to the host. The command is as follows:

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

For example:

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

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. 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