diff --git a/bob/devtools/data/gitlab-ci/single-package.yaml b/bob/devtools/data/gitlab-ci/single-package.yaml
index fc521f38885e00b6e6d8cb0c71e07d397915eb66..dc324c583fd1f6cb1b1d9f4bb53586ba6b071961 100644
--- a/bob/devtools/data/gitlab-ci/single-package.yaml
+++ b/bob/devtools/data/gitlab-ci/single-package.yaml
@@ -84,7 +84,6 @@ build_linux_38:
     PYTHON_VERSION: "3.8"
     BUILD_EGG: "true"
   script:
-    - if [ -f "${CI_PROJECT_DIR}/conda/yum_requirements.txt" ]; then /usr/bin/sudo -n yum -y install $(cat ${CI_PROJECT_DIR}/conda/yum_requirements.txt); fi # [linux]
     - bdt ci build -vv
     - bdt ci readme -vv dist/*.zip
     - bdt ci clean -vv
diff --git a/bob/devtools/scripts/build.py b/bob/devtools/scripts/build.py
index 252bff15219f1ba69ccb4c2c19410de0c1b93548..47226be8555031d67e99d78e1d58fbadaef9c6a2 100644
--- a/bob/devtools/scripts/build.py
+++ b/bob/devtools/scripts/build.py
@@ -8,7 +8,7 @@ import click
 import conda_build.api
 import yaml
 
-from ..bootstrap import get_channels, set_environment
+from ..bootstrap import get_channels, run_cmdline, set_environment
 from ..build import (
     conda_arch,
     get_docserver_setup,
@@ -248,6 +248,18 @@ def build(
         if not os.path.exists(d):
             raise RuntimeError("The directory %s does not exist" % d)
 
+        # If in docker, install the packages inside the yum_requirements.txt file if it exists
+        yum_requirements_file = os.path.join(d, "yum_requirements.txt")
+        if "docker" in os.environ.get("CI_RUNNER_TAGS", "") and os.path.exists(
+            yum_requirements_file
+        ):
+            logger.info(
+                "Installing packages from yum_requirements.txt file using yum"
+            )
+            cmd = ["/usr/bin/sudo", "-n", "yum", "-y", "install"]
+            cmd.extend(open(yum_requirements_file).read().splitlines())
+            run_cmdline(cmd)
+
         version_candidate = os.path.join(d, "..", "version.txt")
         if os.path.exists(version_candidate):
             version = open(version_candidate).read().rstrip()