Vagrant: Cannot build Windows Docker image locally
Building the Windows helper image dockerfile fails inside the Vagrant ssh session:
PS C:\GitLab-Runner> $Env:WINDOWS_VERSION='servercore1809'
PS C:\GitLab-Runner> .\ci\build_release_windows_images.ps1
Build image for x86_64_servercore1809
Directory: C:\GitLab-Runner\dockerfiles\runner-helper
Mode LastWriteTime Length Name
d----- 10/16/2020 5:51 AM binaries
unable to prepare context: unable to evaluate symlinks in context path: CreateFile \\vboxsvr\C:_GitLab-Runnerdockerfiles: The network name cannot be found.
Cleaning up the build image
Investigation
This problem seems to have introduced with the transition of StefanScherer/windows_2019_docker
from version 2020.04.15 (containing Docker 19.03.05
) to version 2020.07.17 (containing Docker 19.03.11
). Since we don't pin the version of the base Vagrant box, the problem appeared once the new version was published and we rebuilt our Vagrant boxes.
This issue is probably related: https://github.com/docker/cli/issues/2648
UPDATE: this still happens with version 2021.03.14
(Docker 20).
Workaround
rm C:\GitLab-Runner
New-Item -Force -ItemType SymbolicLink -Path "C:\GitLab-Runner" -Target "\\vboxsvr\C:_GitLab-Runner\"
Edited by Pedro Pombeiro