Home > Article > Operation and Maintenance > How to copy files to docker container under linux
1. View all docker containers
docker ps // 775c7c9ee1e1为docker中的id docker exec -it 775c7c9ee1e1 /bin/bash
(Recommended learning video: linux video tutorial)
2. From Linux system copies files to the container
Get the long ID of the container
// python为docker容器内运行的项目名 docker inspect -f '{{.ID}}' python
Then copy. Note: Be sure to exit the container when executing the docker command, otherwise an error will be reported
From the container It's the same when copied out. Just change the position behind docker cp. You don't need a long path when copying. You can use the container name displayed by docker ps.
// docker cp 本地路径 容器长ID:容器路径 docker cp /usr/local/test.txt 38ef22f922704b32cf2650407e16b146bf61c221e6b8ef679989486d6ad9e856:/usr/local/tomcat/webapps test.txt
Recommended related tutorials: linux tutorial
The above is the detailed content of How to copy files to docker container under linux. For more information, please follow other related articles on the PHP Chinese website!