Karamzov
Karamzov

Reputation: 403

Jenkins : cannot exectute docker commands from jenkins

I cannot execute any docker commands from jenkins and receieving below error,

+ sudo docker pull ubuntu
Using default tag: latest
Error response from daemon: Get https://registry-1.docker.io/v2/library/ubuntu/manifests/latest: unauthorized: incorrect username or password
Build step 'Execute shell' marked build as failure
Finished: FAILURE

Things i tried

1 ) jenkins user is part of the docker group on the Jenkins master

ubuntu@ip-10-20-10-106:/tmp$ groups jenkins
   jenkins : jenkins sudo docker

2 ) docker version

ubuntu@ip-10-20-10-106:/tmp$ docker --version
Docker version 19.03.6, build 369ce74a3c

how to solve this issue ?

Upvotes: 0

Views: 303

Answers (1)

Technext
Technext

Reputation: 8107

From the error, it seems the docker registry requires authentication. If it's working for you from the command line and not working when you switched to Jenkins user on the host box, then it means that Jenkins need to authenticate itself when connecting to the docker registry. Just sudo to Jenkins user and then run docker login command. After you successfully authenticate, you should be good to go.

Upvotes: 2

Related Questions