Skip to content

fix(server): use registry credentials for Docker source pulls - #5784

Open
devcustrom wants to merge 1 commit into
Dokploy:canaryfrom
devcustrom:fix/docker-source-registry-auth
Open

devcustrom wants to merge 1 commit into
Dokploy:canaryfrom
devcustrom:fix/docker-source-registry-auth

Conversation

@devcustrom

@devcustrom devcustrom commented Oct 26, 2026 •

Copy link
Copy Markdown

Problem

For Docker-source applications (sourceType: "docker"), getAuthConfig() only returns credentials from the application itself. When the image comes from a globally configured registry (application.registry) but the app-level Docker credentials are empty, Dokploy passes no authconfig to service.update() / createService().

Swarm workers then try to pull anonymously:

pulling image failed: ... no basic auth credentials

If a local image with the same tag already exists, Docker starts the stale image and the deployment still reports success.

Fix

When a Docker-source app has no credentials of its own, reuse the configured registry's credentials if the image reference explicitly targets that registry. Bare image names (which resolve to Docker Hub) and images from other registries are excluded, so private registry credentials are never sent to the wrong registry.

Tests

  • apps/dokploy/__test__/registry/registry-host.test.ts — registry/image host parsing and matching.
  • apps/dokploy/__test__/registry/docker-source-auth-config.test.ts — fallback behavior and existing paths.

Related

RetriggerView in GreptileConfidence Score: 3/5

Fix the initial private pull and default Docker Hub matching before merging.

Summary

Adds saved registry credentials as a fallback for Docker-source apps with no app-level credentials.

  • Docker-source image pulls use credentials from the matching registry.

Reviews (1) · Last reviewed commit: "fix(server): use registry credentials fo..." · Reviewed by Greptile

Docker-source applications that reference an image from a configured
registry but have no app-level credentials currently pass no authconfig
to the Swarm service. Workers then pull without credentials and can
silently start an older local image with the same tag.

Fall back to the configured registry credentials when the image
explicitly targets that registry. Images from other registries and bare
Docker Hub image names are left untouched, so private credentials are
never sent to the wrong registry.

Refs Dokploy#5469
Comment on lines +256 to +265
const fallbackRegistry = registry ?? buildRegistry;
if (
!username &&
!password &&
fallbackRegistry &&
isImageFromRegistry(dockerImage, fallbackRegistry.registryUrl)
) {
const r = await findRegistryByIdWithCredentials(
fallbackRegistry.registryId,
);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 First private pull still fails

If the deployment server has no saved Docker login, this fallback runs too late. deployApplication calls buildRemoteDocker before getAuthConfig, and that earlier pull only logs in with app-level credentials. An app relying on the configured registry therefore fails before reaching this fallback.

Reuse the same matched registry credentials before the initial docker pull.

Comment on lines +61 to +62
const registryHost = getRegistryHost(registryUrl);
if (!image || !registryHost) return false;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Default Docker Hub credentials skipped

registryUrl defaults to "", which the registry schema explicitly supports as Docker Hub. The new matcher turns that value into null and returns false, even for docker.io/team/private:latest. The fallback then supplies no credentials to Swarm workers, so private image pulls still fail.

Treat an empty configured registry URL as Docker Hub while keeping a missing registry separate, and add a fallback test for this case.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant