1

I am trying to create a Jenkins pipeline that will pull a public image from docker hub and build a Vue.js application inside that container. In my Jenkins server I already have other pipelines that use AWS ECR to push images too. It appears that my build that is trying to access a public image is trying to log into AWS ECR as well. I'd be okay with putting that public image on ECR if that would solve my issue.

Here is the output of the failed Jenkins build

[Pipeline] withDockerRegistry
$ docker login -u AWS -p ******** https://index.docker.io/v1/
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
Error response from daemon: Get https://registry-1.docker.io/v2/: unauthorized: incorrect username or password
[Pipeline] // withDockerRegistry

2 Answers 2

1

The error shows that you are using AWS ECR credentials to login to dockerhub which will not work. Dockerhub is a different registry(both public and private), however ECR is private registry only.

For pulling public images from dockerhub there is no need to login to dockerhub. You can simply use docker pull command and it will pull an image from dockerhub registry.

Example: docker pull mongo

However, when you want to pull an image from ECR, you need to first login to the AWS ECR and then only you can pull an image from ECR.

0

I think your jenkins need to create an rapo with aws first for that what we normally do is, let's first do a manual pull from jenkins machine from ecr. Use ecr login command $ecr login (with ur region codes etc) is there, try that first ( to get full command open ECR in aws and click on ecr push command, there u will get the full command). Then after successful login try again to pull the image this should pass. After getting this done try using jenkins pipeline. All the best.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.