First I create a volume:
docker volume create --name some-volume
Then I create a file touch ~/somefile.txt
Now I want to move ~/somefile.txt
into the root of the volume some-volume
. How do I do this?
First I create a volume:
docker volume create --name some-volume
Then I create a file touch ~/somefile.txt
Now I want to move ~/somefile.txt
into the root of the volume some-volume
. How do I do this?
You can do this with a container:
docker run --rm -v `pwd`:/source -v some-volume:/target \
busybox cp -av /source/somefile.txt /target/somefile.txt
I will also use tar and stdin to pipe files into a remote volume over the docker client/server connection:
tar -cv -C source-dir . | \
docker run --rm -i -v some-volume:/target busybox tar -xC /target
An export is similar:
docker run --rm -v some-volume:/source busybox tar -cC /source . | \
tar -xC target-dir