Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

copy file from docker container to host

docker cp <containerId>:/file/path/within/container /host/path/target
Comment

copy file from host to docker container

docker cp foo.txt mycontainer:/foo.txt
Comment

docker copy from container to host

# container to host
ocker cp <containerId>:/file/path/within/container /host/path/target

# host to container
docker cp /host/local/path/file <containerId>:/file/path/in/container/file
Comment

docker cp file from host to container

docker cp src/. mycontainer:/target
docker cp mycontainer:/src/. target
Comment

copy a file from local machine to docker container

docker cp <Path in the local machine> <Container ID>:<Path of file inside the container>
Comment

copy file from host to container

docker cp /yourpaht/yourfile <containerId>:/var/jenkins_home
Comment

Docker: Copying files from Docker container to host

for copy file from a container to the host use the command
docker cp <containerId>:/file/path/within/container /host/path/target

You can also use (part of) the Container ID. The following command is equivalent to the first
sudo docker cp 1b4a:/out_read.jpg .


Comment

docker copy file from container to host

$ docker run -d --name httpd httpd

$ docker exec httpd pwd
/usr/local/apache2

$ docker exec httpd ls
bin
build
cgi-bin
conf
error
htdocs
icons
include
logs
modules

$ docker cp httpd:/usr/local/apache2/conf .
Comment

PREVIOUS NEXT
Code Example
Shell :: regex last word in lin 
Shell :: install redux 
Shell :: ssh sever time out 
Shell :: create self signed certificate 
Shell :: append a string in all files name linux 
Shell :: ubuntu change primary group 
Shell :: ionic icon dimensions 
Shell :: query in github api 
Shell :: change git committed message 
Shell :: git remove large files with bfg 
Shell :: delete all feature branches 
Shell :: how to overwrite main branch git 
Shell :: ubuntu path of saving screenshots 
Shell :: ssh public key 
Shell :: How to use alias in Linux bash 
Shell :: cool welcome message linux 
Shell :: undo revert commit 
Shell :: npm installl chalk 
Shell :: vim brew 
Shell :: example bash script 
Shell :: letsencrypt error 
Shell :: move to folder in command line windows 
Shell :: install kubernetes ubuntu 20.04 
Shell :: hugo documentation 
Shell :: kubernetes copy files to persistent volume 
Shell :: bash delete a command line 
Shell :: github how to add ssh key 
Shell :: deleting a remote branch 
Shell :: c ++ ("Hello World") 
Shell :: private repo git history api 
ADD CONTENT
Topic
Content
Source link
Name
4+6 =