Home>Article>Operation and Maintenance> How to copy files from docker

How to copy files from docker

尚
Original
2020-03-19 14:50:25 30337browse

How to copy files from docker

Copy files from the container to the host:

Execute the following command in the host:

docker cp 容器名:要拷贝的文件在容器里面的路径 要拷贝到宿主机的相应路径

Example:

Assume that the container is named testtomcat, and the path of the file to be copied from the container is: /usr/local/tomcat/webapps/test/js/test.js. Now we need to copy test.js from the container to the /opt path of the host machine. Next, how should the command be written?

Execute the command on the host:

docker cp testtomcat:/usr/local/tomcat/webapps/test/js/test.js /opt

For more related tutorials, please pay attention to thedocker tutorialcolumn on the PHP Chinese website.

The above is the detailed content of How to copy files from 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