Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix: propagate registry auth error in swarm image pull - #52698

Merged
vvoland merged 1 commit into
moby:masterfrom
MD-Mushfiqur123:fix/issue-52570-swarm-auth-error
Jun 12, 2026
Merged

fix: propagate registry auth error in swarm image pull#52698
vvoland merged 1 commit into
moby:masterfrom
MD-Mushfiqur123:fix/issue-52570-swarm-auth-error

Conversation

@MD-Mushfiqur123

@MD-Mushfiqur123 MD-Mushfiqur123 commented May 25, 2026

Copy link
Copy Markdown

Fixes #52570

When a worker pull fails with 'unauthorized: authentication required',
the error was being swallowed and replaced with a misleading
'No such image' message. This fix ensures the actual registry error
is propagated so operators see the real cause.

Fix a bug where registry authentication failures during worker image pulls were reported as a misleading “No such image” error.

@vvoland

vvoland commented May 25, 2026

Copy link
Copy Markdown
Contributor

Hi, please sign-off the commit with your real name: https://github.com/moby/moby/blob/master/CONTRIBUTING.md#sign-your-work

@vvoland
vvoland requested a review from corhere May 25, 2026 11:42
@MD-Mushfiqur123

Copy link
Copy Markdown
Author

Friendly ping — this PR is ready for review. All CI checks are passing.

@MD-Mushfiqur123
MD-Mushfiqur123 force-pushed the fix/issue-52570-swarm-auth-error branch from 3921dc9 to 5f42ea8 Compare May 27, 2026 07:12
@vvoland

vvoland commented May 27, 2026

Copy link
Copy Markdown
Contributor

Oh, could you please also remove the Fixes #... from the commit message? Unfortunately Github makes this too noisy

@vvoland vvoland added this to the 29.5.3 milestone May 27, 2026
@vvoland vvoland modified the milestones: 29.5.3, 29.6.0 Jun 3, 2026
@vvoland

vvoland commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

@md-mushfiqur-rahim123-official can you please update?

When a worker pull fails with unauthorized, the error was being
swallowed and replaced with misleading 'No such image' message.
Fix error propagation so the actual cause is reported.

Signed-off-by: Md_Mushfiqur Rahim <[email protected]>
Signed-off-by: Sebastiaan van Stijn <[email protected]>
@thaJeztah
thaJeztah force-pushed the fix/issue-52570-swarm-auth-error branch from 5f42ea8 to a7cf7ea Compare June 12, 2026 13:38

@thaJeztah thaJeztah left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

(rebased and adjusted the commit message)

@thaJeztah

Copy link
Copy Markdown
Member

Flaky tests on Windows;

=== Failed
=== FAIL: integration/container TestWaitNonBlocked/wait-nonblocking-exit-0 (33.42s)
    wait_test.go:46: timeout hit after 30s: waiting for container State.Status to be 'exited', currently 'running'

=== FAIL: integration/container TestWaitNonBlocked (0.26s)
=== Failed
=== FAIL: integration-cli TestDockerAPISuite/TestContainersAPICreateMountsCreate/4_config:_{volume_test3_c:\foo_false__<nil>_0x2a70b07b5dd0_<nil>_<nil>_<nil>} (12.81s)
    docker_api_containers_test.go:1667: timeout hit after 10s: container b8d2bb18674dca58cea1ef7c39b985d729437779e7de43f7945b87c1c1ff22c1 is running, waiting for exit

=== FAIL: integration-cli TestDockerAPISuite/TestContainersAPICreateMountsCreate (50.09s)

@vvoland
vvoland merged commit a8029f6 into moby:master Jun 12, 2026
411 of 418 checks passed
smerkviladze added a commit to smerkviladze/moby that referenced this pull request Jul 27, 2026
A task whose image cannot be pulled is rejected outright when the registry
answers with an "unauthorized" error, even when the image is already present
on the node. A service created without registry credentials carries no auth in
its spec and cannot have its digest resolved, so its tasks always attempt an
unauthenticated pull; on nodes that already hold the image those tasks are
rejected instead of started.

Tolerating a failed pull when the image is available locally is long-standing
behaviour, described in the comment above the check, and what the executor did
for every pull error before a7cf7ea ("fix: propagate registry auth error in
swarm image pull", moby#52698).

Keep reporting the pull failure, as it is far more useful than the "No such
image" the container create would otherwise produce, but only when the image
really is unavailable. Whether a task can run should not depend on how the
registry error happened to be classified, and that classification is not
consistent: the same registry 401 surfaces as ErrUnauthenticated from the
graphdriver pull path, as ErrNotFound from the containerd image store (via
docker.ErrInvalidAuthorization), and as ErrUnknown when the failure happens
while fetching a token, since the error is then a *url.Error that
translatePullError does not classify. The check therefore only fires for some
combinations of image store and registry.

The test needs DOCKER_SERVICE_PREFER_OFFLINE_IMAGE=0 on the daemon under test:
internal/testutil/daemon sets it to 1, which makes the executor skip the pull
altogether.

Signed-off-by: Sopho Merkviladze <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

swarm task error reports misleading "No such image" when the actual cause is unauthorized: authentication required

5 participants