Skip to content

docker-pull: support pulling private images via ~/.docker/config.json#2127

Open
aleshorvat wants to merge 2 commits intogetumbrel:masterfrom
aleshorvat:master
Open

docker-pull: support pulling private images via ~/.docker/config.json#2127
aleshorvat wants to merge 2 commits intogetumbrel:masterfrom
aleshorvat:master

Conversation

@aleshorvat
Copy link
Copy Markdown

Summary

Community app store apps that use private container registry images (e.g. ghcr.io) currently fail to install with a 401 Unauthorized error. The pull() function in docker-pull.ts uses Dockerode without authentication, so private images cannot be pulled even when the host has valid credentials stored in ~/.docker/config.json.

Root cause

docker.pull(image, callback) calls the Docker Engine API directly via Dockerode without passing auth credentials. The Docker CLI reads ~/.docker/config.json automatically, but Dockerode does not — it must be given an explicit authconfig object.

umbreld runs as root, so credentials stored via docker login land in /root/.docker/config.json. Dockerode never reads this file, so all pulls of private images fail regardless of whether the user has logged in on the host.

Fix

Before calling docker.pull(), read /root/.docker/config.json and extract the credentials for the target registry. Pass them as authconfig to docker.pull(). If the file is missing, the registry entry is absent, or any error occurs, the pull proceeds unauthenticated — no regression for public images.

Registry detection logic:

  • If the first path segment of the image contains . or : (e.g. ghcr.io, registry.example.com:5000) → use it as the registry key
  • Otherwise → fall back to Docker Hub (https://index.docker.io/v1/)

Current limitation

Private registry images cannot be pulled through the Umbrel UI even when the host has valid credentials. To observe this:

  1. Log in to a private registry on the Umbrel host:
echo <token> | sudo docker login ghcr.io -u <username> --password-stdin
  1. Add a community app store whose app uses a private image (e.g. ghcr.io/owner/app:latest)
  2. Attempt to install the app from the Umbrel UI
  3. Install fails with Error: (HTTP code 401) unexpected - unauthorized

Despite the host having valid credentials, umbreld's Dockerode-based pull sends no auth headers to the registry.

How to configure credentials on the Umbrel host

SSH into the Umbrel device and log in to the private registry once:

echo <your_token> | sudo docker login ghcr.io -u <your_username> --password-stdin

This writes credentials to /root/.docker/config.json (umbreld runs as root). After that, any community app using a private image from that registry will install without further configuration.

Notes

  • fs-extra is already a dependency of umbreld — no new packages required
  • Falls back silently to unauthenticated pull if config is missing or registry has no entry
  • Tested on UmbrelOS 1.x with private ghcr.io images
  • Only the pull() function is changed — pullAll() is unaffected as it delegates to pull()

Changed file

packages/umbreld/source/modules/utilities/docker-pull.ts

…g.json

Dockerode sends unauthenticated API calls to the Docker Engine, so
community app store apps that use private registry images (e.g. ghcr.io)
fail with 401 Unauthorized even when the host has valid credentials.

Add getAuthConfig() which reads /root/.docker/config.json (umbreld runs
as root) and extracts the authconfig for the target registry. The config
is passed to docker.pull() so private images are pulled with the same
credentials that `docker login` stored on the host.

Falls back to unauthenticated pull (existing behaviour) if:
- /root/.docker/config.json does not exist
- No entry found for the target registry
- Any error occurs during config read

Tested with private ghcr.io images on UmbrelOS 1.x.
fs-extra is already a dependency of umbreld — no new packages required.
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