Skip to content

The junction created by powershell when building a docker image points to nothing #12240

@xiangfan-ms

Description

@xiangfan-ms
  • [ x ] I have tried with the latest version of Docker Desktop
  • [ x ] I have tried disabling enabled experimental features
  • [ x ] I have uploaded Diagnostics
  • Diagnostics ID: E9449031-6CD9-4DCC-BDF4-7BB4E9D2866E/20211004173625

Actual behavior

The junction created by 'powershell New-Item -ItemType Junction' when building a docker image points to nothing
In contrast:
The junction created by 'mklink /J' when building a docker image works
The junction created by 'powershell New-Item -ItemType Junction' in the running container works

Expected behavior

The junction should point to the target location

Information

  • Windows Version: 10.0.19043.1237
  • Docker Desktop Version: 4.0.0 (67817)
  • WSL2 or Hyper-V backend? WSL2
  • Are you running inside a virtualized Windows e.g. on a cloud server or a VM: No

Steps to reproduce the behavior

  1. On the hosting machine: docker build -t test .

Dockerfile

FROM mcr.microsoft.com/windows/servercore:ltsc2019
RUN mkdir test
RUN mklink /J sym1 C:\test
RUN mklink /J sym2 \\?\C:\test
RUN powershell New-Item -ItemType Junction -Path C:\sym3 -Value C:\test
RUN dir

Output

<JUNCTION>     sym1 [C:\test]
<JUNCTION>     sym2 [\\?\C:\test]
<JUNCTION>     sym3 []
  1. On the hosting machine: docker run -it test cmd.exe
  2. In the running container: dir
<JUNCTION>     sym1 [C:\test]
<JUNCTION>     sym2 [\\?\C:\test]
<JUNCTION>     sym3 []
  1. In the running container: powershell New-Item -ItemType Junction -Path C:\sym4 -Value C:\test
  2. In the running container: dir
<JUNCTION>     sym4 [\??\C:\test]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions