Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Copy file into Docker container

Featured Replies

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?

  • Author

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.

 

 

Volume map to a server location where the file is stored and simply copy it inside the docker?

 

  • Author

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??

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.

  • 1 month later...
  • Author

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"

 

A little hint.

 

docker exec -t -i 37fcc75e886d /bin/bash

 

You can just put the docker name where "37fcc75e886d" is.

 

  • 6 years later...

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

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.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.