tr0910 Posted July 17, 2016 Share Posted July 17, 2016 On ver 6.2 rc2 the following works to copy a file from the flash drive into a running container. But on 6.1.9 it doesn't. On 6.1.9 it complains about the path. Also the help for "docker cp" on 6.1.9 doesn't show an option to copy in, only to copy out of the docker container to the host. docker cp /boot/btsync be45c973020a:/opt/btsync/btsync Is there a way to copy a file into a docker container running on 6.1.9? Quote Link to comment
tr0910 Posted July 17, 2016 Author Share Posted July 17, 2016 Here is the difference in the help files. On 6.1.9 the docker copy command is only one way?? Copy out only?? root@Tower619:~# docker cp --help Usage: docker cp [OPTIONS] CONTAINER:PATH HOSTDIR|- Copy files/folders from a PATH on the container to a HOSTDIR on the host running the command. Use '-' to write the data as a tar file to STDOUT. root@Tower62rc2:/boot# docker cp --help Usage: docker cp [OPTIONS] CONTAINER:SRC_PATH DEST_PATH|- docker cp [OPTIONS] SRC_PATH|- CONTAINER:DEST_PATH Copy files/folders between a container and the local filesystem Use '-' as the source to read a tar archive from stdin and extract it to a directory destination in a container. Use '-' as the destination to stream a tar archive of a container source to stdout. Quote Link to comment
lionelhutz Posted July 18, 2016 Share Posted July 18, 2016 Volume map to a server location where the file is stored and simply copy it inside the docker? Quote Link to comment
tr0910 Posted July 18, 2016 Author Share Posted July 18, 2016 Volume map to a server location where the file is stored and simply copy it inside the docker? Yes that works fine. But is 6.1.9 missing the "docker cp" into container option?? Quote Link to comment
saarg Posted July 18, 2016 Share Posted July 18, 2016 Volume map to a server location where the file is stored and simply copy it inside the docker? Yes that works fine. But is 6.1.9 missing the "docker cp" into container option?? It was probably added in a later version of docker, which 6.2 has. Quote Link to comment
tr0910 Posted August 24, 2016 Author Share Posted August 24, 2016 The following worked Have an array disk or user share mapped into the container config area. I have container /data mapped to unRaid array /disk2. Then it is simply docker ps docker exec -t -i 37fcc75e886d /bin/bash cp /data/btsync ./btsyncnew rename 's/btsync/oldsync/' * rename 's/btsyncoldnew/btsync/' * chmod 777 btsync The rename was required as I couldn't copy over top of the same file. "cp: cannot create regular file ‘/opt/btsync/btsync’: Text file busy" Quote Link to comment
lionelhutz Posted August 25, 2016 Share Posted August 25, 2016 A little hint. docker exec -t -i 37fcc75e886d /bin/bash You can just put the docker name where "37fcc75e886d" is. Quote Link to comment
SZ68 Posted March 30, 2023 Share Posted March 30, 2023 I have little linux knowledge so this had been difficult for me. I have a docker (Valheim) with a file that I want to move to a new unraid server docker. I can't seem to find the file with a search when I use the terminal from the docker itself. When I use the Unraid terminal I cant figure out how to browse or search the docker drive. Can I use docker cp if I don't know the location of the file? Can I use docker cp to copy the file to a SMB share? Thanks Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.