diff --git a/templates/gitlab-ci-docker.yml b/templates/gitlab-ci-docker.yml
index 85daa427c953266b271f47fa6decf8c6f81592e7..140cbd718b0e7861c10e9f984d2c716c1ef9e272 100644
--- a/templates/gitlab-ci-docker.yml
+++ b/templates/gitlab-ci-docker.yml
@@ -549,7 +549,7 @@ docker-hadolint:
   script:
     - autoconfig_hadolint
     - mkdir -p -m 777 reports
-    - dockerfile_hash=$(md5sum "$DOCKER_FILE" | cut -d" " -f1)
+    - dockerfile_hash=$(echo "$DOCKER_FILE" | md5sum | cut -d" " -f1)
     # Output in Code Climate format (GitLab integration)
     - hadolint --no-fail -f gitlab_codeclimate $DOCKER_HADOLINT_ARGS $hadolint_config_opts "$DOCKER_FILE" > "reports/docker-hadolint-${dockerfile_hash}.codeclimate.json"
     # Output in JSON format