Question

unauthorized: authentication required for docker compose with doctl

i use this sentence with my github action:

- name: Install doctl
  uses: digitalocean/action-doctl@v2.1.0
  with:
  token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}

- name: Log in to DigitalOcean Container Registry
  run: doctl registry login --expiry-seconds 240

- name: Build and push stack
  run: TAG=stag FRONTEND_ENV=staging sh ./scripts/build-push.sh

This script login to DO, then builds and push images with docker-compose.yml. All is ok - i success login with doctl and build images… But when i push to registry, i see this error inside workflow:

...
Successfully built 476bb87c7501
Successfully tagged registry.digitalocean.com/***/frontend:stag
The following deploy sub-keys are not supported and have been ignored: labels
The following deploy sub-keys are not supported and have been ignored: labels
The following deploy sub-keys are not supported and have been ignored: labels
The following deploy sub-keys are not supported and have been ignored: labels
The following deploy sub-keys are not supported and have been ignored: labels
Pushing backend (registry.digitalocean.com/***/backend:stag)...
**The push refers to repository [registry.digitalocean.com/***/backend]
unauthorized: authentication required
Error: Process completed with exit code 1.**

and i receive new access token in digital-ocean admin panel, that looks like: container-registry-{name}-{ts}

Billing level of my registry is i basic and repository is empty. I think this is a problem with doctl.


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hi there @KonstantinKlepikov,

I encountered the same problem being logged in to sudoer account and messed things up running doctl and docker with different privileges (user/root). I ran doctl as a regular user, and docker as a root. It was like that:

doctl registry login
Output
Logging Docker in to registry.digitalocean.com
sudo docker run registry.digitalocean.com/***/testimage:1.0
Output
Unable to find image 'registry.digitalocean.com/***/testimage:1.0' locally docker: Error response from daemon: Get https://registry.digitalocean.com/v2/***/testimage/manifests/1.0: unauthorized: authentication required. See 'docker run --help'.

Everything started running fine when I set up doctl authentication with sudo command, and used it consequently since then.

I hope it gives you some clues on how to continue with troubleshooting it.