— This guide applies ONLY to Docker for Windows 10/11 (AND ONLY in ‘Windows containers’ mode) —

1. Use an already existing Docker image and run a Docker container to compile

start a container in interactive mode: docker run -it your_Docker_ID/your_docker_image

if needed later, to restart a container in interactive mode: docker start CONTAINER_ID -i (to find CONTAINER_ID: docker ps -a)

2. Create a Docker image

build the image: docker build -t your_docker_image .

push your Docker image to your personal account on Docker Hub (https://hub.docker.com):

3. Enable continuous integration with GitLab and Docker

[ USELESS if you already have a dedicated ‘Windows Server’ with Docker !

choose ‘docker-windows’ as ‘runner executor’ when asked

USELESS if you already have a dedicated ‘Windows Server’ with Docker ! ]

.windows_build_template_0x - Release: &windows_build_definition_0x-release
  script:
    - md build; cd build
    - cmake .. -DCMAKE_CONFIGURATION_TYPES=Release -DCMAKE_TOOLCHAIN_FILE=C:\vcpkg\scripts\buildsystems\vcpkg.cmake
    - MSBuild /m myproject.sln
    - $env:PATH += ";$env:MSVC_KIT_ROOT\debug\bin;$env:MSVC_KIT_ROOT\bin"
    - ctest
    - (...my commands which are good for "myproject"...)

##################
# CONF1 - vs2017 #
##################
#
conf1 - vs2017:
  tags:
    - my_tag1,my_tag2
  image: my_dockerhub_name/my_vs2017-ltsc2019-for-myproject
  <<: *windows_build_definition_0x-release

##################
# CONF2 - vs2019 #
##################
#
conf2 - vs2019:
  tags:
    - my_tag1,my_tag2
  image: my_dockerhub_name/my_vs2019-ltsc2019-for-myproject
  <<: *windows_build_definition_0x-release
Docker Linux