docker COPY and Windows Directory Junction (symlinks)
Asked Answered
A

0

7

How is the docker COPY command supposed to work when there is a windows directory junction in the directory you are copying?


More Details...

Older docker versions (<18.0) seem to copy the contents of the directory junction to the target directory. Newer versions (18.0) seem to copy the symlink itself, and if the link target does not exist in the container, the link will be invalid.

For more background, my directory structure looks something like this:

C:\Project>dir .
02/06/2018  08:38 AM    <DIR>          .
02/06/2018  08:38 AM    <DIR>          ..
02/05/2018  07:09 PM             4,002 program.py
02/05/2018  07:09 PM             123   Dockerfile
01/29/2018  10:50 PM    <JUNCTION>     mylib [C:\Lib\mylib]

The Dockerfile command looks like this:

COPY . /home/foo

I would expect the COPY command to copy program.py and the contents of mylib into the container (and this is what happened on older docker versions), but newer docker images copy the junction itself.

Amends answered 7/2, 2018 at 14:29 Comment(2)
Did you find a solution?Cockpit
I'm also looking for a solution here. A workaround is to use "xcopy" to copy the content of that folder into another one, but it's not very portable.Sadyesaechao

© 2022 - 2024 — McMap. All rights reserved.