diff --git a/variables.sh b/variables.sh
index d3ea276b87581d19752dbe079fada231a0119566..3b77bf5b5505c0fc0e7a5ffe76ce4772451828f1 100644
--- a/variables.sh
+++ b/variables.sh
@@ -1,5 +1,7 @@
-# Set the docker image tag to the current branch:
-dockerTag=$(git rev-parse --abbrev-ref HEAD)
+# Set the docker image tag to the name of the current branch.
+# Shortened to 63 bytes because Gitlab does the same with the `CI_COMMIT_REF_SLUG`
+# variable, which we use in the CI script to build the docker image.
+dockerTag=$(git rev-parse --abbrev-ref HEAD | cut -b "-63")
 
 # Only get the number from the issue (or whatever is in front of a dash
 # otherwise) for the release name