diff --git a/lib/util/exec/index.ts b/lib/util/exec/index.ts
index e7f0cfc163ab3d201756f86d3f05ff7316e9e9f1..d47e37954ce956ef83a69386ae9c972215ec6ee0 100644
--- a/lib/util/exec/index.ts
+++ b/lib/util/exec/index.ts
@@ -93,7 +93,7 @@ export async function exec(
   };
 
   let commands = typeof cmd === 'string' ? [cmd] : cmd;
-  if (execConfig.binarySource === BinarySource.Docker) {
+  if (execConfig.binarySource === BinarySource.Docker && docker) {
     logger.debug('Using docker to execute');
     const dockerOptions = {
       ...docker,