diff --git a/docker/Dockerfile.template b/docker/Dockerfile.template
index 41a08fb22ed65c0566a6e73c3f6ce1cd46b8c6b0..858873c3d4de25a1fe825b86e1de50c753ace3e0 100644
--- a/docker/Dockerfile.template
+++ b/docker/Dockerfile.template
@@ -21,9 +21,9 @@
 ##########################################################################
 
 # Dockerfile for easy install and use of CAISAR.
-FROM ocaml/opam@sha256:9d471148a7acdaba15caa139710f89ca8668a191c0052eb1c80cb9729e337c40
+#FROM ocaml/opam@sha256:9d471148a7acdaba15caa139710f89ca8668a191c0052eb1c80cb9729e337c40
 
-#FROM @UBUNTU_OPAM_BASE@
+FROM @UBUNTU_OPAM_BASE@
 
 RUN opam-2.1 repository set-url default https://opam.ocaml.org && \
 opam-2.1 update -y
diff --git a/docker/Makefile b/docker/Makefile
index e08c13dc52135c87bb4ccd85372d50aa068fa106..d23909fed48417e4489a22e3f7e116a22ae9a953 100644
--- a/docker/Makefile
+++ b/docker/Makefile
@@ -34,11 +34,12 @@ push: all
 	docker push laiser/caisar:pub
 
 SHA_DOCKER=$(shell docker manifest inspect ocaml/opam:ubuntu-ocaml-$(OCAML_VERSION) | jq '.manifests| .[] | select(.platform.architecture == "amd64") | .digest' --raw-output)
+SHA_DOCKER:=$(or $(SHA_DOCKER),sha256:9d471148a7acdaba15caa139710f89ca8668a191c0052eb1c80cb9729e337c40)
 
 CAISAR_COMMIT?=$(shell git rev-parse HEAD)
 
 Dockerfile: Makefile Dockerfile.template env.template FORCE
-	cat Dockerfile.template | \
+	sed 's|@UBUNTU_OPAM_BASE@|ocaml/opam@$(SHA_DOCKER)|g' Dockerfile.template | \
 sed 's|@ENV@|$(shell cat env.template)|g' | \
 sed 's|@OPAM_DEPS@|conf-protoc conf-gmp conf-autoconf conf-pkg-config|' | \
 sed 's|@OCAMLV@|'$(OCAML_VERSION)'|g' | \