diff --git a/docker-compose/Makefile b/docker-compose/Makefile
index a5cf4ec0072b54da23a1379c2d7f8c1eb97a0f6f..307e7c0e609fd20a4d78a5353490f95ed6dc0a7f 100644
--- a/docker-compose/Makefile
+++ b/docker-compose/Makefile
@@ -1,3 +1,11 @@
+# Before doing anything, make 100% certain that all necessary environment
+# variables are set.
+ifndef LOFAR20_DIR
+    # Generate the full path to the lofar20rc.sh file
+    # for exactly this repository.
+    LOFAR20RC = $(subst docker-compose,bootstrap/etc/lofar20rc.sh,$(abspath .))
+    $(error There are essential LOFAR2.0 environment variables missing. You must source the lofar20rc.sh file of this repo first. You can do it like this (paste without quotes): ". $(LOFAR20RC)")
+endif
 # Set dir of Makefile to a variable to use later
 MAKEPATH := $(abspath $(lastword $(MAKEFILE_LIST)))
 BASEDIR := $(notdir $(patsubst %/,%,$(dir $(MAKEPATH))))