diff --git a/tests/sanity/sanity.sh b/tests/sanity/sanity.sh
index 32784414e43ff5b88a4e9729d33f2f9b48f4c4cf..0bf1eb789c716862aca9692f9700cdda4cf1e672 100644
--- a/tests/sanity/sanity.sh
+++ b/tests/sanity/sanity.sh
@@ -1,8 +1,13 @@
 #!/bin/bash
 
+TOPDIR=$(readlink -f "$(dirname "$0")/../..")
+pushd "${TOPDIR}" >/dev/null || exit 1
+
 VENV=/tmp/ansible-test-venv
 ANSIBLE_COLLECTION=freeipa-ansible_freeipa
 
+use_docker=$(which docker >/dev/null 2>&1 && echo "True" || echo "False")
+
 virtualenv "$VENV"
 # shellcheck disable=SC1091
 source "$VENV"/bin/activate
@@ -15,7 +20,8 @@ rm -f importer_result.json
 
 utils/build-galaxy-release.sh
 
-export GALAXY_IMPORTER_CONFIG=tests/sanity/galaxy-importer.cfg
+sed "s/LOCAL_IMAGE_DOCKER = True/LOCAL_IMAGE_DOCKER = ${use_docker}/" < tests/sanity/galaxy-importer.cfg > ${VENV}/galaxy-importer.cfg
+export GALAXY_IMPORTER_CONFIG=${VENV}/galaxy-importer.cfg
 
 collection=$(ls -1 "$ANSIBLE_COLLECTION"-*.tar.gz)
 echo "Running: python -m galaxy_importer.main $collection"
@@ -33,4 +39,6 @@ done < <(python -m galaxy_importer.main "$collection")
 
 rm -rf "$VENV"
 
+popd >/dev/null || exit 1
+
 exit "$error"