№ 11114 В разделе
Sysadmin
от October 6th, 2020,
В подшивках: Docker, Linux
Typically its not useful because you can directly mount directory to containers, but… who knows? May be you just want it.
For example, you have directory on your hard drive and want to move files inside docker volume:
root@boroda:/tmp/future-volume# find . . ./somedir ./somedir/config.yaml ./file1 ./test.txt ./myfile2
Just run move (or copy) command in busybox container:
docker run --rm -it \ -v my-docker-volume:/destination \ -v /tmp/future-volume:/source \ busybox \ /bin/sh -c "mv /source/* /destination/ && find /destination"
This command mounts (or create if not exists already) volume, mount directory on disk and move files from disk to volume.
After move completion you’ll see tree on moved files:
/destination /destination/somedir /destination/somedir/config.yaml /destination/file1 /destination/test.txt /destination/myfile2
That’s all, easy.
Fortune cookie: "...the only "right" a sodomite has in a Chrisian Theocracy is the right to die." [Dan Gentry, of Christian Research]
Leave a Reply