diff --git a/lib/util/exec/docker/index.ts b/lib/util/exec/docker/index.ts
index 3ea7cbfc63dc938fad24d344381046fb8ab6936a..c6eefe15916b0bd5dd5b2dd6d9aa6c03d8703403 100644
--- a/lib/util/exec/docker/index.ts
+++ b/lib/util/exec/docker/index.ts
@@ -232,8 +232,15 @@ export async function generateDockerCommand(
   }
 
   const volumeDirs: VolumeOption[] = [localDir, cacheDir];
-  if (containerbaseDir && cacheDir && !containerbaseDir.startsWith(cacheDir)) {
-    volumeDirs.push(containerbaseDir);
+  if (containerbaseDir) {
+    if (cacheDir && containerbaseDir.startsWith(cacheDir)) {
+      logger.debug('containerbaseDir is inside cacheDir');
+    } else {
+      logger.debug('containerbaseDir is separate from cacheDir');
+      volumeDirs.push(containerbaseDir);
+    }
+  } else {
+    logger.debug('containerbaseDir is missing');
   }
   volumeDirs.push(...volumes);
   result.push(...prepareVolumes(volumeDirs));
diff --git a/lib/util/exec/index.ts b/lib/util/exec/index.ts
index 9887a3d4f27b729fedb9d1c06e81ea6c1d8e95ac..8e9adfc058503c268ca16fdd1e642d8e2cd477f5 100644
--- a/lib/util/exec/index.ts
+++ b/lib/util/exec/index.ts
@@ -105,6 +105,7 @@ async function prepareRawExec(
     GlobalConfig.get();
 
   if (binarySource === 'docker' || binarySource === 'install') {
+    logger.debug(`Setting BUILDPACK_CACHE_DIR to ${containerbaseDir!}`);
     opts.env ??= {};
     opts.env.BUILDPACK_CACHE_DIR = containerbaseDir;
   }