--with-registry-auth seems not working

I’ve created a swarm composed of 2 nodes running on Ubuntu 16.04 on Azure VMs.

$ docker node ls
ID                           HOSTNAME  STATUS  AVAILABILITY  MANAGER STATUS
e0mwvwag7cyl6zbeotx2afxdu *  Jenkins   Ready   Drain         Leader
nhh0yrh8trs92exnxvahm1pv5    DevEnv    Ready   Active

On the manager node (Jenkins) I’m also running Jenkins (outside Docker) and a registry (outside swarm) which is configured to use a self-signed certificate and basic auth. The worker node (DevEnv) is used as a testing environment in CI pipeline. I can seamlessly login to the registry and pull images on both machines when working directly on the console on that machine. However, when trying to provision a task to the worker by the manager, the worker cannot obtain the image:

$ docker service create --name test --with-registry-auth test/test
unable to pin image test/test to digest: errors:
denied: requested access to the resource is denied
unauthorized: authentication required

a8sy8b0h14fu6kq2mg0vb2ycm

What’s wrong?