Kandasamy Murugan
Kandasamy Murugan

Reputation: 125

Not able to push image over Docker hub using ansible playbook


TASK [Pushing docker image to DockerHub] ************************************************************************************* fatal: [localhost]: FAILED! => {"changed": true, "cmd": ["docker", "push", "kmurugandocker/simple-devops-image"], "delta": "0:00:00.080293", "end": "2020-04-13 06:30:58.425962", "msg": "non-zero return code", "rc": 1, "start": "2020-04-13 06:30:58.345669", "stderr": "denied: requested access to the resource is denied", "stderr_lines": ["denied: requested access to the resource is denied"], "stdout": "The push refers to a repository [docker.io/kmurugandocker/simple-devops-image]\n75137f74451a: Preparing\nfb8f657b05a7: Preparing\n87af55901360: Preparing\n81349fc07565: Preparing\n892007193bb6: Preparing\ne811ee12aa10: Preparing\n23f8d486123a: Preparing\nafae6f50abb9: Preparing\n136a15f81f25: Preparing\n185574602537: Preparing\n24efcd549ab5: Preparing\ne811ee12aa10: Waiting\n23f8d486123a: Waiting\nafae6f50abb9: Waiting\n136a15f81f25: Waiting\n185574602537: Waiting\n24efcd549ab5: Waiting", "stdout_lines": ["The push refers to a repository [docker.io/kmurugandocker/simple-devops-image]", "75137f74451a: Preparing", "fb8f657b05a7: Preparing", "87af55901360: Preparing", "81349fc07565: Preparing", "892007193bb6: Preparing", "e811ee12aa10: Preparing", "23f8d486123a: Preparing", "afae6f50abb9: Preparing", "136a15f81f25: Preparing", "185574602537: Preparing", "24efcd549ab5: Preparing", "e811ee12aa10: Waiting", "23f8d486123a: Waiting", "afae6f50abb9: Waiting", "136a15f81f25: Waiting", "185574602537: Waiting", "24efcd549ab5: Waiting"]}

Upvotes: 0

Views: 2176

Answers (3)

Khyar Ali
Khyar Ali

Reputation: 337

you are having this issue because you are running the playbook as a root user, but on the target system you haven't logged in to docker hub with the root user. to solve this issue you can either: remove

become:true

in the playbook which means that it's not a must to be root.

or run:

docker login

as a root in managed hosts.

(plus) you may also want to delete existed images manually in the first time.

Upvotes: 1

Rajdeep Tiwari
Rajdeep Tiwari

Reputation: 21

remove one tag from yml file become true

Upvotes: 2

akhlaq
akhlaq

Reputation: 19

If you check logs closely, error message says access denied which simply means either you don't have access or you are not logged in to your docker registry

["denied: requested access to the resource is denied"]

Solution: you need to login to your remote docker registry.

docker login

Refer docker documentation for detailed information.

https://docs.docker.com/engine/reference/commandline/login/

Upvotes: 0

Related Questions