Pushing docker image to private repository with Rancher pipeline

861 Views Asked by At

Having trouble with pushing a image to a private repository on DockerHub. I'm working on a pipeline that package the image successfully but stumble upon an 'access denied' when the docker push command is performed.

It's a Rancher instance that spins up a Jenkins pod and parses a rancher-pipeline.yml file.

The log:

Registry credentials or Docker config not provided. Guest mode enabled.
# repo info adjusted for posting

Successfully built 7dae5217eb36
Successfully tagged 00000000:latest
+ /usr/local/bin/docker tag 00000000 ACCOUNT/REPO:TAG
+ /usr/local/bin/docker push ACCOUNT/REPO:TAG
The push refers to repository [docker.io/ACCOUNT/REPO:TAG]

----

time="2020-10-08T07:57:29.336029874Z" level=error msg="Upload failed: denied: requested access to the resource is denied"
time="2020-10-08T07:57:29.336163885Z" level=info msg="Attempting next endpoint for push after error: denied: requested access to the resource is denied"
denied: requested access to the resource is denied
time="2020-10-08T07:57:29Z" level=fatal msg="exit status 1"```

Pipeline

Pipeline:

  • name: Publish steps:
    • publishImageConfig: dockerfilePath: ./Dockerfile buildContext: . tag: REPO:TAG pushRemote: true registry: ACCOUNT

I fiddled a lot around with the registry values but with no luck. When building an pushing the image locally i can succesfully push it to my registry. 
1

There are 1 best solutions below

0
On

Found the solution. For future reference.

Registry should be: registry: index.docker.io

Couldn't find this in the docs but after rebuilding this pipeline with the Rancher UI it shows this registry value. To make this work one will also need to have created a Registry Credentials. This can be done in secrets -> Registry Credentials -> add new