This works because it's copying some_file
:
docker run --rm -v target-data:/target -v ~/source:/source alpine cp source/some_file target/
This does not (Using wildcard):
docker run --rm -v target-data:/target -v ~/source:/source alpine cp source/* target/
cp: can't stat 'source/*': No such file or directory
How do copy all the files in the souce
volume to the target
volume?
The thing is who expand that *
:
docker run --rm -v target-data:/target -v ~/source:/source alpine sh -c 'cp -r source/* target/'
You need someone (sh
) to expand the *
before the program is launched (that is what the shell do before exec cp
)