diff --git a/lib/modules/manager/npm/post-update/yarn.spec.ts b/lib/modules/manager/npm/post-update/yarn.spec.ts
index fcc70d8ab23566738570d67ecd0c0f256ea62356..e41cb4b4ca1ff5e64c220a74b0976ddc16c6667f 100644
--- a/lib/modules/manager/npm/post-update/yarn.spec.ts
+++ b/lib/modules/manager/npm/post-update/yarn.spec.ts
@@ -451,6 +451,65 @@ describe('modules/manager/npm/post-update/yarn', () => {
     expect(res.lockFile).toBe('package-lock-contents');
   });
 
+  it('supports customizing corepack version via config constraints', async () => {
+    process.env.CONTAINERBASE = 'true';
+
+    GlobalConfig.set({
+      localDir: '.',
+      binarySource: 'install',
+      cacheDir: '/tmp/cache',
+    });
+
+    Fixtures.mock(
+      {
+        'package.json': '{ "packageManager": "yarn@3.0.0" }',
+        'yarn.lock': 'package-lock-contents',
+      },
+      'some-dir'
+    );
+
+    mockedFunction(getPkgReleases).mockResolvedValueOnce({
+      releases: [
+        { version: '0.17.0' },
+        { version: '0.17.1' },
+        { version: '0.18.0' },
+      ],
+    });
+
+    const execSnapshots = mockExecAll({
+      stdout: '2.1.0',
+      stderr: '',
+    });
+
+    const config = partial<PostUpdateConfig<NpmManagerData>>({
+      managerData: { hasPackageManager: true },
+      constraints: {
+        yarn: '^3.0.0',
+        corepack: '^0.17.0',
+      },
+    });
+
+    const res = await yarnHelper.generateLockFile('some-dir', {}, config);
+
+    expect(execSnapshots).toMatchObject([
+      { cmd: 'install-tool node 16.16.0', options: { cwd: 'some-dir' } },
+      { cmd: 'install-tool corepack 0.17.1', options: { cwd: 'some-dir' } },
+      {
+        cmd: 'yarn install --mode=update-lockfile',
+        options: {
+          cwd: 'some-dir',
+          env: {
+            YARN_ENABLE_GLOBAL_CACHE: '1',
+            YARN_ENABLE_IMMUTABLE_INSTALLS: 'false',
+            YARN_HTTP_TIMEOUT: '100000',
+          },
+        },
+      },
+    ]);
+
+    expect(res.lockFile).toBe('package-lock-contents');
+  });
+
   it('uses slim yarn instead of corepack', async () => {
     // sanity check for later refactorings
     expect(plocktest1YarnLockV1).toBeTruthy();
diff --git a/lib/modules/manager/npm/post-update/yarn.ts b/lib/modules/manager/npm/post-update/yarn.ts
index 39908951d1e5ffb53c73c43a8a60ca4c085c3012..3b894e4c06e6186de27f69f8b999fdacc3fdbdd6 100644
--- a/lib/modules/manager/npm/post-update/yarn.ts
+++ b/lib/modules/manager/npm/post-update/yarn.ts
@@ -125,7 +125,10 @@ export async function generateLockFile(
       !!upgrades[0]?.managerData?.hasPackageManager;
 
     if (!isYarn1 && hasPackageManager) {
-      toolConstraints.push({ toolName: 'corepack' });
+      toolConstraints.push({
+        toolName: 'corepack',
+        constraint: config.constraints?.corepack,
+      });
     } else {
       toolConstraints.push(yarnTool);
       if (isYarn1 && minYarnVersion) {