diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 8d367ba3ef4c863b553c39d5ad07fe83cafdeb10..fefc400e875b804056587cc521a879c7d37c46f1 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -78,11 +78,16 @@ stages:
 # containers.  These volumes are intended to be used for testing server-side scripting and
 # file-system features.
 #
-services:
-  - docker:20.10.3-dind
 
 test:
   tags: [docker]
+  services:
+    - docker:20.10.3-dind
+  variables:
+    # This is a workaround for the gitlab-runner health check mechanism when
+    # using docker-dind service.  The runner will otherwise guess the port
+    # wrong and the health check will timeout.
+    SERVICE_PORT_2376_TCP_PORT: 2375
   stage: test
   image: $CI_REGISTRY_IMAGE_BASE
   needs: ["cert"]