diff --git a/lib/datasource/docker/common.spec.ts b/lib/datasource/docker/common.spec.ts
index ba2f579280a7523219c310c098b6ff2a2ccf1337..84f07292090f1a5ccb548050a06d013c931be062 100644
--- a/lib/datasource/docker/common.spec.ts
+++ b/lib/datasource/docker/common.spec.ts
@@ -43,8 +43,8 @@ describe(getName(), () => {
       );
       expect(res).toMatchInlineSnapshot(`
         Object {
-          "dockerRepository": "image",
-          "registryHost": "https://my.local.registry/prefix",
+          "dockerRepository": "prefix/image",
+          "registryHost": "https://my.local.registry",
         }
       `);
     });
@@ -55,8 +55,8 @@ describe(getName(), () => {
       );
       expect(res).toMatchInlineSnapshot(`
         Object {
-          "dockerRepository": "image",
-          "registryHost": "http://my.local.registry/prefix",
+          "dockerRepository": "prefix/image",
+          "registryHost": "http://my.local.registry",
         }
       `);
     });
@@ -67,8 +67,8 @@ describe(getName(), () => {
       );
       expect(res).toMatchInlineSnapshot(`
         Object {
-          "dockerRepository": "image",
-          "registryHost": "https://my.local.registry/prefix",
+          "dockerRepository": "prefix/image",
+          "registryHost": "https://my.local.registry",
         }
       `);
     });
diff --git a/lib/datasource/docker/common.ts b/lib/datasource/docker/common.ts
index 11189b1d1ae23147916f5b37cf5d8fcf9192b04c..14d9d1468e95e727ea4ca86363286c7a0c7468ab 100644
--- a/lib/datasource/docker/common.ts
+++ b/lib/datasource/docker/common.ts
@@ -9,7 +9,11 @@ import * as packageCache from '../../util/cache/package';
 import * as hostRules from '../../util/host-rules';
 import { Http, HttpResponse } from '../../util/http';
 import type { OutgoingHttpHeaders } from '../../util/http/types';
-import { ensureTrailingSlash, trimTrailingSlash } from '../../util/url';
+import {
+  ensureTrailingSlash,
+  parseUrl,
+  trimTrailingSlash,
+} from '../../util/url';
 import { MediaType, RegistryRepository } from './types';
 
 export const id = 'docker';
@@ -165,9 +169,14 @@ export function getRegistryRepository(
       if (!/^https?:\/\//.test(registryHost)) {
         registryHost = `https://${registryHost}`;
       }
+      let dockerRepository = lookupName.replace(registryEndingWithSlash, '');
+      const fullUrl = `${registryHost}/${dockerRepository}`;
+      const { origin, pathname } = parseUrl(fullUrl);
+      registryHost = origin;
+      dockerRepository = pathname.substring(1);
       return {
         registryHost,
-        dockerRepository: lookupName.replace(registryEndingWithSlash, ''),
+        dockerRepository,
       };
     }
   }