Enter the running container# Enter the container and open a new terminal# docker exec -it container id /bin/bash docker exec -it eaac94ef6926 /bin/bash # Enter the original terminal of the container# docker attach container id docker attach eaac94ef6926 Container file copy# Copy files from the container to the Linux host# docker cp container id: path in container target host path docker cp eaac94ef6926:/home/test.txt /root/test.txt # Copy files from the host to the container# docker cp file path container id: path in container docker cp test.txt eaac94ef6926:/home/test.txt Official documentation: https://docs.docker.com/engine/reference/commandline/exec/ Supplement: docker cp: copy files from the container to the local Example: Copy a test.db file from the container to the local data directory. # Assume there is an image named kitty with a tag of 0.1, and create a container named koko# 1. create a container first docker run -itd --name koko kitty:0.1 /bin/bash # 2. copy test.db from koko tmp directory to local data directory. docker cp koko:/tmp/test.db ./data/test.db # 3. rm container koko docker rm -f koko Docker cp can also copy files from local to container: # Taking the above code as an example, just reverse the container path and the local path. docker cp ./data/test.db koko:/tmp/test.db Supplement: Docker on Mac is mounted to local files for interoperability Docker mounts to local files docker run -itv /Users/XXXX/Sites/docker:/www images:12121 /bin/bash The above is my personal experience. I hope it can give you a reference. I also hope that you will support 123WORDPRESS.COM. If there are any mistakes or incomplete considerations, please feel free to correct me. You may also be interested in:
|
<<: MySQL commonly used SQL and commands from entry to deleting database and running away
>>: Detailed example of using js fetch asynchronous request
Preface: Due to my work, I am involved in the fie...
How to debug a page on iPad? When using iOS 5, you...
1. Function Introduction sed (Stream EDitor) is a...
The arrangement layout of aligning the two ends o...
<br />In the past, creating a printer-friend...
Table of contents 1. Limit props to type lists 2....
Table of contents Achieve results Rolling load kn...
When shutting down the MySQL server, various prob...
After the National Day holiday, did any of you fi...
/**************************** * System call******...
Table of contents Why do we need Docker? Docker d...
In many cases, large and medium-sized websites wi...
Unlike other types of design, web design has been ...
Will UPDATE lock? Will the SQL statement be locke...
This article shares the 6 most effective methods,...