feat(docker): pull images with stored registry credentials#103
Merged
Conversation
Adds the ability to attach a stored registry to a Docker-source application so its credentials are used for `docker login` before pulling the image, in both the Swarm authconfig path (getAuthConfig) and the remote docker pull path (buildRemoteDocker). The provider form gains a registry selector. Manual port of Dokploy#3678 adapted to the fork's registry model: credentials are loaded on demand via findRegistryByIdWithCredentials (the fork excludes registry passwords from relational queries) and login keeps the fork's safeDockerLoginCommand. Upstream's image-name auto-concatenation churn was skipped because the fork already resolves docker image names as-is. Co-authored-by: AceRRR10 <darioacerr@gmail.com>
# Conflicts: # apps/dokploy/components/dashboard/application/general/generic/save-docker-provider.tsx # apps/dokploy/server/api/routers/application.ts # packages/server/src/utils/providers/docker.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Lets a Docker-source application reference a stored registry so its credentials are used to
docker loginbefore the image is pulled — instead of forcing inline username/password on the app. Applies to both deploy paths.packages/server/src/db/schema/application.ts: addregistryIdto theapiSaveDockerProviderinput.apps/dokploy/server/api/routers/application.ts(saveDockerProvider): when aregistryIdis chosen, persist it and clear inlineusername/password/registryUrl; otherwise persist the inline credentials and clearregistryId.packages/server/src/utils/builders/index.ts(getAuthConfig): forsourceType === "docker", resolve the selected registry's credentials for the Swarm authconfig.packages/server/src/utils/providers/docker.ts(buildRemoteDocker): resolve the selected registry's credentials for the remotedocker login/pull.apps/dokploy/components/dashboard/application/general/generic/save-docker-provider.tsx: registry selector in the Docker provider form.Ports Dokploy#3678 by @AceRRR10 (manual apply; upstream co-authored).
Adaptations
The fork's registry model differs from upstream, so this is a manual adaptation rather than a cherry-pick:
registry: { columns: { password: false } }), so instead of readingregistry.passwordoff the loaded relation (upstream's approach),getAuthConfigandbuildRemoteDockerfetch credentials via the fork's existingfindRegistryByIdWithCredentials(registryId).safeDockerLoginCommandfor the remote login (upstream reverted to a rawdocker loginstring).getImageName/uploadImageRemoteCommandalready use the docker image reference as-is andgetRegistryTagalready lowercases, soupload.tsneeded no change.Notes
registryIdcolumn and already-loadedregistryrelation — no database migration (this item's reserved slot 0186 stays unused) and no new relational query onapplications.Verification
pnpm --filter=dokploy run typecheckpasses on this branch.