diff --git a/tools/utils/docker.ts b/tools/utils/docker.ts
index 5386f0b9229adc137934f2f671c12671aa240bc0..913de449792afd388b64cf1c6425a74e5c1f7423 100644
--- a/tools/utils/docker.ts
+++ b/tools/utils/docker.ts
@@ -32,8 +32,10 @@ export async function bake(
   if (opts.version) {
     console.log(`Using version: ${opts.version.version}`);
     process.env.RENOVATE_VERSION = opts.version.version;
-    process.env.RENOVATE_MAJOR_VERSION = `${opts.version.major}`;
-    process.env.RENOVATE_MAJOR_MINOR_VERSION = `${opts.version.major}.${opts.version.minor}`;
+    if (!opts.version.prerelease) {
+      process.env.RENOVATE_MAJOR_VERSION = `${opts.version.major}`;
+      process.env.RENOVATE_MAJOR_MINOR_VERSION = `${opts.version.major}.${opts.version.minor}`;
+    }
   }
 
   const metadataFile = path.join(await tmp, 'metadata.json');