Skip to content

Fix createService not passing registry auth#116

Merged
firecow merged 2 commits intomainfrom
fix-createservice-auth
Mar 4, 2026
Merged

Fix createService not passing registry auth#116
firecow merged 2 commits intomainfrom
fix-createservice-auth

Conversation

@firecow
Copy link
Member

@firecow firecow commented Mar 4, 2026

Summary

  • Docker Swarm's task agent doesn't understand the raw base64 auth field from ~/.docker/config.json — it needs explicit username/password fields in the X-Registry-Auth header
  • Decode the auth field (base64-encoded username:password) into separate username and password fields before sending
  • Also fix createService to pass auth as a separate first argument, since dockerode's single-arg codepath for createService doesn't extract authconfig from the options (unlike service.update)

Test plan

  • Verified docker service create --with-registry-auth (Docker CLI) also fails with same error — confirming the raw auth field format is the issue
  • Verified explicit username/password auth via Docker API succeeds
  • Built and deployed with swarm-app locally — service pulls from registry.cego.dk successfully

Dockerode's createService single-arg codepath does NOT extract
authconfig from the options object (unlike createImage and
service.update which do). Passing {…serviceSpec, authconfig}
resulted in the entire service spec being serialized as the
X-Registry-Auth header, which the registry cannot parse.

Use the two-argument form createService(auth, opts) so the auth
config is correctly sent as the X-Registry-Auth header.
@firecow firecow self-assigned this Mar 4, 2026
Docker Swarm's task agent doesn't understand the raw base64 auth
field from docker config. It needs explicit username and password
fields in the X-Registry-Auth header.

Also fix createService to pass auth as a separate first argument,
since dockerode's single-arg codepath for createService doesn't
extract authconfig from the options (unlike service.update).

Tested locally: docker service create with the decoded auth
successfully pulls from registry.cego.dk.
@firecow firecow merged commit c4a7853 into main Mar 4, 2026
4 checks passed
@firecow firecow deleted the fix-createservice-auth branch March 4, 2026 18:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant