Question

unauthorized: authentication required for docker compose with doctl

Posted September 21, 2021 213 views
DockerDigitalOcean API and CLI (doctl)GitHub Actions

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.

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.

×
Submit an Answer
1 answer

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.

  • Can you show example of this:

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

    because doctl with sudo provoke error not find