title: How to use a custom windows docker container on gitlab-ci shared runner
body: <p>i have a repository which consists of following two files, which builds an windows docker container with visual studio buildtools installed and pushes it to the registry provided by gitlab for my repository</p>
  <p><code>./Dockerfile</code></p>
  <pre><code># escape=`
  
  FROM mcr.microsoft.com/windows/servercore:1809-amd64
  
  RUN powershell mkdir .\TEMP\;`
      Invoke-WebRequest -Uri https://aka.ms/vs/16/release/vs_buildtools.exe -OutFile .\TEMP\vs_buildtools.exe; `
      .\TEMP\vs_buildtools.exe --quiet --wait --norestart --nocache `
      --installPath C:\BuildTools `
      --add Microsoft.VisualStudio.Component.VC.CMake.Project `
      --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 `
      --add Microsoft.VisualStudio.Component.Windows10SDK `
      --add Microsoft.VisualStudio.Component.Windows10SDK.18362
  
  
  ENTRYPOINT [&quot;C:\\BuildTools\\Common7\\Tools\\VsDevCmd.bat&quot;, &quot;&amp;&amp;&quot;, &quot;powershell.exe&quot;, &quot;-NoLogo&quot;, &quot;-ExecutionPolicy&quot;, &quot;Bypass&quot;]
  </code></pre>
  <p><code>./.gitlab-ci.yml</code></p>
  <pre class="lang-yaml prettyprint-override"><code>docker-build:  # Official docker image.
    tags: 
      - windows
    stage: build
    services:
      - docker:dind
    before_script:
      - docker login -u &quot;$CI_REGISTRY_USER&quot; -p &quot;$CI_REGISTRY_PASSWORD&quot; $CI_REGISTRY
    script:
      - docker build --pull -t &quot;${CI_REGISTRY_IMAGE}:${CI_COMMIT_REF_SLUG}&quot; .
      - docker push &quot;${CI_REGISTRY_IMAGE}:${CI_COMMIT_REF_SLUG}&quot;
  </code></pre>
  <p>so far this works perfectly</p>
  <p>now in another repository i want to use this image to build my application on</p>
  <p><code>./.gitlab-ci.yml</code></p>
  <pre class="lang-yaml prettyprint-override"><code>build-app:
    image: registry.gitlab.com/valerij/windows-builder:master
    tags: 
      - windows
    stage: build
    script:
      - &quot;docker images&quot;
      - &quot;dir C:\\BuildTools&quot; 
      - &quot;cl --version&quot;
  </code></pre>
  <p>which fails with</p>
  <pre><code>Running with gitlab-runner 13.4.1 (e95f89a0)
    on windows-shared-runners-manager Hs8mheX5
  Preparing the &quot;custom&quot; executor
  Using Custom executor with driver autoscaler dev (6184f4a)...
  Creating virtual machine for the job...
  Virtual machine created!
  Preparing environment
  00:11
  Running on PACKER-5F1153D4 via 
  runner-hs8mhex5-wsrm-4464870f601125122949...
  Getting source from Git repository
  Fetching changes with git depth set to 50...
  Initialized empty Git repository in C:/GitLab-Runner/builds/valerij/ci-test/.git/
  Created fresh repository.
  Checking out f7535d50 as master...
  git-lfs/2.8.0 (GitHub; windows amd64; go 1.12.2; git 30af66bb)
  Skipping Git submodules setup
  Executing &quot;step_script&quot; stage of the job script
  WARNING: Starting with version 14.0 the 'build_script' stage will be replaced with 'step_script': https://gitlab.com/gitlab-org/gitlab-runner/-/issues/26426
  $ docker images
  REPOSITORY                             TAG                 IMAGE ID            CREATED             SIZE
  mcr.microsoft.com/windows/servercore   ltsc2019            561b89eac394        7 months ago        3.7GB
  $ dir C:\BuildTools
  dir : Cannot find path 'C:\BuildTools' because it does not exist.
  At line:1 char:1
  + dir C:\BuildTools
  + ~~~~~~~~~~~~~~~~~
      + CategoryInfo          : ObjectNotFound: (C:\BuildTools:String) [Get-ChildItem], ItemNotFoundException
      + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand
   
  Cleaning up file based variables
  ERROR: Job failed: exit status 1
  </code></pre>
  <p>Now I notice that the log is missing anything along the lines familiar from another project</p>
  <pre><code>Pulling docker image node:latest ...
  Using docker image sha256:2d840844f8e7594a542b30eaed0a3451f5d84b9f85d091d09abc8e0ae75c48e4 for node:latest with digest node@sha256:60a3bda0eb90be8fa78830f284671d4c231e91878bbe5bd1c953aedda141014a ...
  </code></pre>
  <p>It seems to me that the windows runner ignores the <code>image</code> keyword.</p>
  <p>How do I force the windows runner to use my custom docker image to perform the CI in?</p>