[SOLVED] Docker Container - How to Copy Files from SSH Bash to Unraid Array or Remote System??


bombz
Go to solution Solved by bombz,

Recommended Posts

Hello, 

I have successfully connected to my Unraid SSH as I usually do, then figured out how to bash into a docker container to list the files of the root of that container
 

docker exec -it dockercontainername /bin/bash


I can then 'ls' to see the files I want to copy or move to either 
01. a location on the UnRAID array - eg. /mnt/cache
02. the windows system I am on

I can't figure out how to copy the file so I can gain access to it. Does anyone know the method to do this
I tried some cp commands and scp commands and have not been successful

I don't really want to have to do a hexdump and piece this together, there has to be a way to get content out of the docker container and back into another container

Im not talking about the containers on appdata/cache/dockerimagename
talking about the files within the docker container itself

Thank you,

Edited by bombz
Link to comment
  • Solution

EDIT
After hunting and searching I was able to successfully figure out how to

 

  • connect to docker container
  • sudo and nano within docker
  • copy files from docker container to unraid
  • copy files from unraid to docker container(s)

 

 


How to connect to docker container:

docker exec -it contaidername /bin/bash
ls -l

To find the files or paths that need to be accessed for the copy command

 

exit

 

Add sudo & nano within docker container:


Sudo:

root@dockercontainerID# apk add sudo
(1/1) Installing sudo (1.9.10-r0)
Executing busybox-1.35.0-r17.trigger
OK: 279 MiB in 80 packages

 

Nano:

root@dockercontainerID:/# apk add nano
fetch http://dl-cdn.alpinelinux.org/alpine/v3.16/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.16/community/x86_64/APKINDEX.tar.gz
(1/1) Installing nano (6.3-r0)
Executing busybox-1.35.0-r17.trigger
OK: 277 MiB in 79 packages



 

How to copy files from docker container to UnRaid server:
 

root@servername:~# sudo docker cp containername:/filename.xxx ~/file path on unraid

-OR-

root@servername:~# sudo docker cp containername:/filename.xxx /file path on unraid

EXAMPLE:

root@servername:~# sudo docker cp mariadb:/filename.txt ~/mnt/cache/


 

How to copy files from Unraid server to docker container:
 

root@servername:~# sudo docker cp /unraid/location/123.txt containername:/

 

EXAMPLE::

root@servername:~# sudo docker cp /mnt/cache/123.txt mariadb:/



Hope that helps someone going down the same path as me tonight

 

Cheers!

Edited by bombz
  • Thanks 1
Link to comment
  • bombz changed the title to [SOLVED] Docker Container - How to Copy Files from SSH Bash to Unraid Array or Remote System??

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

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.