Docker from the container inside the file to host or from host to copy files to Docker container __docker

Source: Internet
Author: User
Tags docker ps docker cp

1, from the container inside copy files to host.

Answer: Execute the following command in the host

Docker CP container name: The path of the file to be copied inside the container to be copied to the appropriate path of the host


Example: Assuming that the container is named Testtomcat, the file to be copied from the container is:/usr/local/tomcat/webapps/test/js/test.js, now to move test.js from the container Copy to the host's/opt path, so the command should be how to write it.

Answer: Execute command on host

Docker CP testtomcat:/usr/local/tomcat/webapps/test/js/test.js/opt

2. Copy files from host to container inside

Answer: Execute the following command in the host

docker cp to copy file path container name: the corresponding path to be copied to the container

Example: Assuming the container is named Testtomcat, now copy the host/opt/test.js file into the container /usr/local/tomcat/webapps/test/js path, then how to write the command.

Answer: Execute the following command on the host

Docker cp/opt/test.js Testtomcat:/usr/local/tomcat/webapps/test/js

3, here in the record of a problem, how to look at the container name.

Execute command: Docker PS, appear as shown in the picture, where names is the container name.

      



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.