{"action":"created","issue":{"url":"https://api.github.com/repos/saltstack/salt/issues/36872","repository_url":"https://api.github.com/repos/saltstack/salt","labels_url":"https://api.github.com/repos/saltstack/salt/issues/36872/labels{/name}","comments_url":"https://api.github.com/repos/saltstack/salt/issues/36872/comments","events_url":"https://api.github.com/repos/saltstack/salt/issues/36872/events","html_url":"https://github.com/saltstack/salt/issues/36872","id":181887497,"number":36872,"title":"dockerng.image_present fails to pull image from docker.io/ when it can't login into locally defined registry","user":{"login":"zerthimon","id":746367,"avatar_url":"https://avatars.githubusercontent.com/u/746367?v=3","gravatar_id":"","url":"https://api.github.com/users/zerthimon","html_url":"https://github.com/zerthimon","followers_url":"https://api.github.com/users/zerthimon/followers","following_url":"https://api.github.com/users/zerthimon/following{/other_user}","gists_url":"https://api.github.com/users/zerthimon/gists{/gist_id}","starred_url":"https://api.github.com/users/zerthimon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zerthimon/subscriptions","organizations_url":"https://api.github.com/users/zerthimon/orgs","repos_url":"https://api.github.com/users/zerthimon/repos","events_url":"https://api.github.com/users/zerthimon/events{/privacy}","received_events_url":"https://api.github.com/users/zerthimon/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-10-09T13:42:08Z","updated_at":"2016-10-11T14:53:30Z","closed_at":null,"body":"When a registry is defined in pillar:\r\n```\r\ndocker-registries:\r\n  https://xxx.xxx.com/v2/:\r\n  ...\r\n  ...\r\n```\r\nand for some reason it's unaccessible, and you try to pull image from docker.io:\r\n```\r\nsome_image:\r\n  dockerng.image_present:\r\n    - name: docker.io/image:tag\r\n```\r\nyou get error, 'cause salt tries to login to the 'bad' registry:\r\n```\r\n----------\r\n          ID: some_image\r\n    Function: dockerng.image_present\r\n        Name: docker.io/image:tag\r\n      Result: False\r\n     Comment: Encountered error pulling docker.io/image:tag: 500 Server Error: Internal Server Error (\"{\"message\":\"login attempt to https://xxx.xxx.com/v2/ failed with status: 502 Bad Gateway\"}\")\r\n     Started: 13:27:25.961308\r\n    Duration: 1416.496 ms\r\n     Changes:   \r\n----------\r\n```"},"comment":{"url":"https://api.github.com/repos/saltstack/salt/issues/comments/252941185","html_url":"https://github.com/saltstack/salt/issues/36872#issuecomment-252941185","issue_url":"https://api.github.com/repos/saltstack/salt/issues/36872","id":252941185,"user":{"login":"gtmanfred","id":732321,"avatar_url":"https://avatars.githubusercontent.com/u/732321?v=3","gravatar_id":"","url":"https://api.github.com/users/gtmanfred","html_url":"https://github.com/gtmanfred","followers_url":"https://api.github.com/users/gtmanfred/followers","following_url":"https://api.github.com/users/gtmanfred/following{/other_user}","gists_url":"https://api.github.com/users/gtmanfred/gists{/gist_id}","starred_url":"https://api.github.com/users/gtmanfred/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gtmanfred/subscriptions","organizations_url":"https://api.github.com/users/gtmanfred/orgs","repos_url":"https://api.github.com/users/gtmanfred/repos","events_url":"https://api.github.com/users/gtmanfred/events{/privacy}","received_events_url":"https://api.github.com/users/gtmanfred/received_events","type":"User","site_admin":false},"created_at":"2016-10-11T14:53:29Z","updated_at":"2016-10-11T14:53:29Z","body":"Unfortunately I am unable to replicate this.\r\n\r\nI have set it up like the following\r\n\r\n```\r\ndocker-registries:\r\n  https://xxx.xxx/v1/:\r\n    email: foo@foo.com\r\n    password: s3cr3t\r\n    username: foo\r\n  https://hub.docker.com:\r\n    email: <email>\r\n    password: <password>\r\n    username: <username>\r\n```\r\n\r\nwith the following state\r\n\r\n```\r\n[root@docker ~]# cat /srv/salt/test.sls\r\nsome_image:\r\n  dockerng.image_present:\r\n    - name: postgres:latest\r\n```\r\n\r\nAnd I successfully am able to get the image from docker hub.\r\n\r\n```\r\n[root@docker ~]# salt-call state.apply test\r\n[WARNING ] /usr/lib/python2.7/site-packages/salt/grains/core.py:1493: DeprecationWarning: The \"osmajorrelease\" will be a type of an integer.\r\n\r\nlocal:\r\n----------\r\n          ID: some_image\r\n    Function: dockerng.image_present\r\n        Name: postgres:latest\r\n      Result: True\r\n     Comment: Image 'postgres:latest' was pulled\r\n     Started: 14:51:23.118606\r\n    Duration: 17947.574 ms\r\n     Changes:\r\n              ----------\r\n              Layers:\r\n                  ----------\r\n                  Pulled:\r\n                      - 193f770cec44\r\n                      - 33647077f2ee\r\n                      - 6a5a5368e0c2\r\n                      - 53bc65f84840\r\n                      - a4d3b0f1c16a\r\n                      - bdbe3c2ddbbd\r\n                      - 8f08971388d1\r\n                      - 7e724cee4193\r\n                      - f80ab5df227d\r\n                      - fb0a1ee64973\r\n                      - 484ac0d6f901\r\n              Status:\r\n                  Downloaded newer image for postgres:latest\r\n              Time_Elapsed:\r\n                  17.9367620945\r\n\r\nSummary for local\r\n------------\r\nSucceeded: 1 (changed=1)\r\nFailed:    0\r\n------------\r\nTotal states run:     1\r\nTotal run time:  17.948 s\r\n```\r\n\r\nCan you provide me more steps to replicate what you are getting?"}}
{"actor":{"display_login":"gtmanfred"}}