Bitbucket "no basic auth credentials" (docker push)
A docker push failed because the daemon had no credentials for the registry - there was no docker login (or it used empty/wrong variables) before the push. The registry rejects the unauthenticated push.
What this error means
The push fails with "no basic auth credentials" (or denied/unauthorized). The build and tag succeeded; only the authenticated push to the registry failed.
denied: requested access to the resource is denied
errors: no basic auth credentialsCommon causes
No docker login before push
The push needs a prior docker login to the target registry. Without it, the daemon has no credentials and the registry denies the push.
Login variables empty or unsecured
The username/password/token variables are unset, mis-scoped, or not marked secured, so the login silently uses empty credentials.
How to fix it
Log in before pushing
Authenticate to the registry with secured variables, then push.
- step:
services: [ docker ]
script:
- echo "\$DOCKER_PASSWORD" | docker login -u "\$DOCKER_USERNAME" --password-stdin registry.example.com
- docker build -t registry.example.com/app:\$BITBUCKET_COMMIT .
- docker push registry.example.com/app:\$BITBUCKET_COMMITProvide valid secured credentials
- Define
DOCKER_USERNAME/DOCKER_PASSWORD(or a token) as secured variables. - Confirm they are in scope for the step performing the push.
- Use
--password-stdinso the secret is not exposed on the command line.
How to prevent it
- Always
docker loginbeforedocker push. - Store registry credentials as secured variables in the right scope.
- Use
--password-stdinto avoid leaking the password in logs.