diff --git a/tasks/main.yml b/tasks/main.yml
index e86b5d65d3b421995bb89a7eae01a14184384d0c..85c1ac6cf66f555e31b216762a490d29a8133ca6 100644
--- a/tasks/main.yml
+++ b/tasks/main.yml
@@ -56,7 +56,6 @@
     - runner_is_registered.rc == 1
   command:
     "gitlab-runner register --non-interactive --url {{ gitlab_runner.url }} --registration-token {{ gitlab_runner.token }} --executor docker --docker-image '{{ gitlab_runner.image }}' --description '{{ gitlab_runner.description }}'"
-
 # We really don’t want to use this, but there is no other way: https://gitlab.com/gitlab-org/gitlab-runner/-/issues/1539
 - name: set concurrency for gitlab-runner
   lineinfile:
@@ -65,4 +64,3 @@
     line: "concurrent = {{ gitlab_runner.concurrent }}"
   notify:
     - restart gitlab-runner
-
diff --git a/templates/config.toml.j2 b/templates/config.toml.j2
index 1a9ffe97dd43c426cd0625815f1bc3c20404a985..8c34dad12b57b6d91fe5080b6dd0392b283d12b5 100644
--- a/templates/config.toml.j2
+++ b/templates/config.toml.j2
@@ -4,3 +4,6 @@ listen_address = "[::1]:9252"
 
 [session_server]
   session_timeout = 1800
+[[runners]]
+  # Workaround to fix container detection in docker, see https://github.com/GoogleContainerTools/kaniko/issues/1542#issuecomment-999545027
+  environment = ["container=docker"]