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
1. Use .gifs rather than .jpgs. GIFs are smaller ...
Typical layout examples As shown in the above pic...
The concept of relative path Use the current file...
Table of contents 1. Event delegation Event Bubbl...
Preface: Lynis is a security audit and hardening ...
The bash history command in Linux system helps to...
Table of contents Preface: 1. Reasons for the eve...
This article example shares the specific code for...
The HTML specification document introduces the cr...
background Temporary tablespaces are used to mana...
Table of contents Overview Code Implementation Su...
Table of contents Written in front router.json Ro...
Effect display: Environment preparation controlle...
The use of computed in vue3. Since vue3 is compat...
First method : CSS code: Copy code The code is as ...