What are the reasons Docker cp works differently to Unix cp? [closed] What are the reasons Docker cp works differently to Unix cp? [closed] docker docker

What are the reasons Docker cp works differently to Unix cp? [closed]


The docker docs on cp explain this:

  • SRC_PATH specifies a directory
    • DEST_PATH does not exist
      • DEST_PATH is created as a directory and the contents of the source directory are copied into this directory
    • DEST_PATH exists and is a file
      • Error condition: cannot copy a directory to a file
    • DEST_PATH exists and is a directory
      • SRC_PATH does not end with /.
        • the source directory is copied into this directory
      • SRC_PATH does end with /.
        • the content of the source directory is copied into this directory

So either DEST_PATH does not exist or it does and your docker cp command is actually docker cp child-dir/ uncle-dir (with the trailing slash).