0

if I use:

docker cp local_dir/*.py image_name:remote_dir



docker cp local_dir/. image_name:remote_dir

the former will give the error"docker cp requires exactly 2 arguments"

but the latter works.

Aren't both of the commands got 2 arguments?

Thanks!

Lan Si
  • 82
  • 7
  • 1
    The first one will have one argument for each Python file in `local_dir`. Try putting `echo` at the front of both lines to see something closer to the actual expanded command lines. – David Maze Jun 21 '22 at 23:58
  • 1
    Does this answer your question? [Copy multiple local files to docker container](https://stackoverflow.com/questions/37153857/copy-multiple-local-files-to-docker-container) – Gino Mempin Jul 12 '22 at 10:21

1 Answers1

0

the first one is the wildcard format, if you want to copy multi-files one time, try this:

ls local_dir/*.py |xargs -n 1 --verbose -I {} docker cp {} image_name:remote_dir 
leechor
  • 16
  • 1