diff --git a/Dockerfile b/Dockerfile
index b02c62700043b929270dfe6bac7f3a25b8c16daf..1e4e1a160d6f274613414cd98a79a43bb0fe8eee 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -5,11 +5,6 @@ FROM ${RENKU_BASE_IMAGE}
 # see https://github.com/SwissDataScienceCenter/renkulab-docker
 # to swap this image for the latest version available
 
-# RENKU_VERSION determines the version of the renku CLI
-# that will be used in this image. To find the latest version,
-# visit https://pypi.org/project/renku/#history.
-ARG RENKU_VERSION=0.15.1
-
 # Uncomment and adapt if code is to be included in the image
 # COPY src /code/src
 
@@ -36,7 +31,17 @@ RUN conda env update -q -f /tmp/environment.yml && \
 RUN jupyter labextension install jupyterlab_tensorboard && \
     pip install jupyter-tensorboard==0.1.10
 
+# RENKU_VERSION determines the version of the renku CLI
+# that will be used in this image. To find the latest version,
+# visit https://pypi.org/project/renku/#history.
+ARG RENKU_VERSION=0.15.1
+
 ########################################################
 # Do not edit this section and do not add anything below
-RUN pipx install --force renku==${RENKU_VERSION}
+
+RUN if [ -n "$RENKU_VERSION" ] ; then \
+    pipx uninstall renku && \
+    pipx install --force renku==${RENKU_VERSION} \
+    ; fi
+
 ########################################################