diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 901b3d8d4713e4bf3d022309a6b1a127bb8e6613..2c3cdc765f43c2abaab0c5c0d247eccaae97ebf8 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -268,13 +268,16 @@ pages:
 
 .build-container: &build-container
   stage: deploy
-  image: docker:20.10.12
+  image: docker:20.10.23
   needs: ["containers"]
-  except:
-    refs:
-      - schedules
-    changes:
-      - containers/*
+  rules:
+    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
+      changes:
+        compare_to: 'refs/heads/main'
+        paths:
+          - containers/*
+      when: manual
+    - if: $CI_PIPELINE_SOURCE == "schedule"
   script:
     - cd containers
     - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
diff --git a/containers/v3-dockerfile-test-suite-python310 b/containers/v3-dockerfile-test-suite-python310
index 71fd9f37757a8a6b34b68fd4b58e32e48fd9c4b2..a67ea409ce5c84fa60b8174b861b0b33ae044442 100644
--- a/containers/v3-dockerfile-test-suite-python310
+++ b/containers/v3-dockerfile-test-suite-python310
@@ -32,7 +32,7 @@ RUN conda install -n ${conda_env} -c conda-forge scikit-image celerite george
 
 # Install dependencies and samplers
 RUN pip install corner healpy cython tables
-RUN conda install -n ${conda_env} dynesty emcee nestle ptemcee pymultinest ultranest cpnest kombine dnest4 zeus-mcmc pytorch pymc nessai ptmcmcsampler -c conda-forge -c pytorch
+RUN conda install -n ${conda_env} dynesty emcee nestle ptemcee pymultinest ultranest cpnest kombine dnest4 zeus-mcmc pytorch 'pymc>=4' nessai ptmcmcsampler -c conda-forge -c pytorch
 
 # Install Polychord
 RUN apt-get update --allow-releaseinfo-change
diff --git a/containers/v3-dockerfile-test-suite-python38 b/containers/v3-dockerfile-test-suite-python38
index bde0d526d9bd99eab112b5aadab1c3e4cd02b699..3369172c0973fe5090ee0a8aafb88b0cdfd39815 100644
--- a/containers/v3-dockerfile-test-suite-python38
+++ b/containers/v3-dockerfile-test-suite-python38
@@ -32,7 +32,7 @@ RUN conda install -n ${conda_env} -c conda-forge scikit-image celerite george
 
 # Install dependencies and samplers
 RUN pip install corner healpy cython tables
-RUN conda install -n ${conda_env} dynesty emcee nestle ptemcee pymultinest ultranest cpnest kombine dnest4 zeus-mcmc pytorch pymc nessai ptmcmcsampler -c conda-forge -c pytorch
+RUN conda install -n ${conda_env} dynesty emcee nestle ptemcee pymultinest ultranest cpnest kombine dnest4 zeus-mcmc pytorch 'pymc>=4' nessai ptmcmcsampler -c conda-forge -c pytorch
 
 # Install Polychord
 RUN apt-get update --allow-releaseinfo-change
diff --git a/containers/v3-dockerfile-test-suite-python39 b/containers/v3-dockerfile-test-suite-python39
index 5dbafefa38e8d96d0f821d2c74b81e1c6e88478d..6035f103e99a00e9d8255ad330f5fc7e1a786fe6 100644
--- a/containers/v3-dockerfile-test-suite-python39
+++ b/containers/v3-dockerfile-test-suite-python39
@@ -32,7 +32,7 @@ RUN conda install -n ${conda_env} -c conda-forge scikit-image celerite george
 
 # Install dependencies and samplers
 RUN pip install corner healpy cython tables
-RUN conda install -n ${conda_env} dynesty emcee nestle ptemcee pymultinest ultranest cpnest kombine dnest4 zeus-mcmc pytorch pymc nessai ptmcmcsampler -c conda-forge -c pytorch
+RUN conda install -n ${conda_env} dynesty emcee nestle ptemcee pymultinest ultranest cpnest kombine dnest4 zeus-mcmc pytorch 'pymc>=4' nessai ptmcmcsampler -c conda-forge -c pytorch
 
 # Install Polychord
 RUN apt-get update --allow-releaseinfo-change
diff --git a/containers/write_dockerfiles.py b/containers/write_dockerfiles.py
index 14bb63ebee9cd1b03d5850aa668e1dbd632850c7..a90d117766a094dea9efe37307c0f93a4c8ea063 100644
--- a/containers/write_dockerfiles.py
+++ b/containers/write_dockerfiles.py
@@ -6,23 +6,11 @@ with open("dockerfile-template", "r") as ff:
 python_versions = [(3, 8), (3, 9), (3, 10)]
 today = date.today().strftime("%Y%m%d")
 
-conda_sampler_dict = dict(
-    python38=[
-        "dynesty", "emcee", "nestle", "ptemcee", "pymultinest", "ultranest",
-        "cpnest", "kombine", "dnest4", "zeus-mcmc",
-        "pytorch", "pymc", "nessai", "ptmcmcsampler",
-    ],
-    python39=[
-        "dynesty", "emcee", "nestle", "ptemcee", "pymultinest", "ultranest",
-        "cpnest", "kombine", "dnest4", "zeus-mcmc",
-        "pytorch", "pymc", "nessai", "ptmcmcsampler",
-    ],
-    python310=[
-        "dynesty", "emcee", "nestle", "ptemcee", "pymultinest", "ultranest",
-        "cpnest", "kombine", "dnest4", "zeus-mcmc",
-        "pytorch", "pymc", "nessai", "ptmcmcsampler",
-    ]
-)
+samplers = [
+    "dynesty", "emcee", "nestle", "ptemcee", "pymultinest", "ultranest",
+    "cpnest", "kombine", "dnest4", "zeus-mcmc",
+    "pytorch", "'pymc>=4'", "nessai", "ptmcmcsampler",
+]
 
 for python_major_version, python_minor_version in python_versions:
     key = f"python{python_major_version}{python_minor_version}"
@@ -38,5 +26,5 @@ for python_major_version, python_minor_version in python_versions:
             date=today,
             python_major_version=python_major_version,
             python_minor_version=python_minor_version,
-            conda_samplers=" ".join(conda_sampler_dict[key])
+            conda_samplers=" ".join(samplers)
         ))