{"action":"created","issue":{"url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/3419","repository_url":"https://api.github.com/repos/ansible/ansible-modules-core","labels_url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/3419/labels{/name}","comments_url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/3419/comments","events_url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/3419/events","html_url":"https://github.com/ansible/ansible-modules-core/issues/3419","id":148056523,"number":3419,"title":"cloud/docker: field 'registry' ignored when pulling image","user":{"login":"WinstonSureChill","id":9483289,"avatar_url":"https://avatars.githubusercontent.com/u/9483289?v=3","gravatar_id":"","url":"https://api.github.com/users/WinstonSureChill","html_url":"https://github.com/WinstonSureChill","followers_url":"https://api.github.com/users/WinstonSureChill/followers","following_url":"https://api.github.com/users/WinstonSureChill/following{/other_user}","gists_url":"https://api.github.com/users/WinstonSureChill/gists{/gist_id}","starred_url":"https://api.github.com/users/WinstonSureChill/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WinstonSureChill/subscriptions","organizations_url":"https://api.github.com/users/WinstonSureChill/orgs","repos_url":"https://api.github.com/users/WinstonSureChill/repos","events_url":"https://api.github.com/users/WinstonSureChill/events{/privacy}","received_events_url":"https://api.github.com/users/WinstonSureChill/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-04-13T13:10:14Z","updated_at":"2016-04-13T14:37:03Z","closed_at":null,"body":"<!--- Verify first that your issue/request is not already reported in GitHub -->\r\n\r\n##### ISSUE TYPE\r\n<!--- Pick one below and delete the rest: -->\r\n Bug Report\r\n\r\n##### COMPONENT NAME\r\n<!--- Name of the plugin/module/task -->\r\ndocker\r\n\r\n##### ANSIBLE VERSION\r\n```\r\nansible 2.1.0 (devel 22467a0de8) last updated 2016/04/13 11:42:21 (GMT +200)\r\n  lib/ansible/modules/core: (detached HEAD 99cd31140d) last updated 2016/04/13 11:42:31 (GMT +200)\r\n  lib/ansible/modules/extras: (detached HEAD ab2f4c4002) last updated 2016/04/13 11:42:40 (GMT +200)\r\n  config file =\r\n  configured module search path = Default w/o overrides\r\n```\r\n\r\n##### CONFIGURATION\r\n<!---\r\nMention any settings you have changed/added/removed in ansible.cfg\r\n(or using the ANSIBLE_* environment variables).\r\n-->\r\n\r\nPatched ansible to work around issue #3078 (= #3039). Patched following this comment: https://github.com/ansible/ansible-modules-core/issues/3078#issuecomment-201139661 :\r\n\r\n```\r\ncurl https://github.com/kaczynskid/ansible-modules-core/commit/46970d6d7add50780e8cedb5067ae5d29a763141.patch | patch /root/installs/ansible/lib/ansible/modules/core/cloud/docker/docker.py\r\n```\r\n\r\n##### OS / ENVIRONMENT\r\n<!---\r\nMention the OS you are running Ansible from, and the OS you are\r\nmanaging, or say “N/A” for anything that is not platform-specific.\r\n-->\r\n\r\nCentOS 7\r\n\r\ndocker version: 1.10.3\r\ndocker api version: 1.22\r\n\r\ndocker-py version: 1.8.0\r\n\r\n##### SUMMARY\r\n<!--- Explain the problem briefly -->\r\nfield `registry` doesn't seem to be taken into account in module docker. Even when specifying a registry, it tries to pull from the default one (docker.io).\r\n\r\n##### STEPS TO REPRODUCE\r\n<!---\r\nFor bugs, show exactly how to reproduce the problem.\r\nFor new features, show how the feature would be used.\r\n-->\r\n\r\nplaybook.yml\r\n\r\n```\r\n---\r\n-\r\n  hosts: all\r\n  tasks:\r\n    -\r\n      name: run etcd container\r\n      docker:\r\n        image: coreos/etcd\r\n        state: present\r\n        registry: quay.io\r\n```\r\n\r\ninventory\r\n\r\n```\r\nlocalhost ansible_connection=local\r\n```\r\n\r\ncommand\r\n\r\n```\r\n$ ansible-playbook -vvv -i inventory playbook.yml\r\n```\r\n\r\n<!--- You can also paste gist.github.com links for larger files -->\r\n\r\n##### EXPECTED RESULTS\r\n<!--- What did you expect to happen when running the steps above? -->\r\n\r\nPull image `quay.io/coreos/etcd`. In docker logs (with daemon on debug log level, option `-D` ), this would print:\r\n\r\n```\r\nlevel=debug msg=\"Trying to pull quay.io/coreos/etcd from https://quay.io v2\"\r\n```\r\n\r\n##### ACTUAL RESULTS\r\n<!--- What actually happened? If possible run with high verbosity (-vvvv) -->\r\n\r\nTries to pull image from default registry `docker.io`. In docker logs, it prints:\r\n\r\n```\r\nlevel=debug msg=\"Trying to pull coreos/etcd from https://index.docker.io v1\"\r\n```\r\n\r\nAnsible output\r\n\r\n```\r\nTASK [run etcd container] ******************************************************\r\nfatal: [localhost]: FAILED! => \r\n{\r\n   \"changed\":false,\r\n   \"changes\":[\r\n      \"{\\\"status\\\":\\\"Pulling repository docker.io/coreos/etcd\\\"}\\r\\n\",\r\n      \"{\\\"errorDetail\\\":{\\\"message\\\":\\\"Error: image coreos/etcd not found\\\"},\\\"error\\\":\\\"Error: image coreos/etcd not found\\\"}\\r\\n\"\r\n   ],\r\n   \"failed\":true,\r\n   \"invocation\":{\r\n      \"module_args\":{\r\n         \"cap_add\":null,\r\n         \"cap_drop\":null,\r\n         \"command\":null,\r\n         \"count\":1,\r\n         \"cpu_set\":null,\r\n         \"cpu_shares\":0,\r\n         \"debug\":false,\r\n         \"detach\":true,\r\n         \"devices\":null,\r\n         \"dns\":null,\r\n         \"docker_api_version\":\"1.22\",\r\n         \"docker_url\":null,\r\n         \"docker_user\":null,\r\n         \"domainname\":null,\r\n         \"email\":null,\r\n         \"entrypoint\":null,\r\n         \"env\":null,\r\n         \"env_file\":null,\r\n         \"expose\":null,\r\n         \"extra_hosts\":null,\r\n         \"hostname\":null,\r\n         \"image\":\"coreos/etcd\",\r\n         \"insecure_registry\":false,\r\n         \"labels\":{\r\n\r\n         },\r\n         \"links\":null,\r\n         \"log_driver\":null,\r\n         \"log_opt\":null,\r\n         \"lxc_conf\":null,\r\n         \"memory_limit\":\"0\",\r\n         \"memory_swap\":\"0\",\r\n         \"name\":null,\r\n         \"net\":null,\r\n         \"password\":null,\r\n         \"pid\":null,\r\n         \"ports\":null,\r\n         \"privileged\":false,\r\n         \"publish_all_ports\":false,\r\n         \"pull\":\"missing\",\r\n         \"read_only\":null,\r\n         \"registry\":\"quay.io\",\r\n         \"restart_policy\":null,\r\n         \"restart_policy_retry\":0,\r\n         \"signal\":null,\r\n         \"state\":\"present\",\r\n         \"stdin_open\":false,\r\n         \"stop_timeout\":10,\r\n         \"timeout\":60,\r\n         \"tls_ca_cert\":null,\r\n         \"tls_client_cert\":null,\r\n         \"tls_client_key\":null,\r\n         \"tls_hostname\":null,\r\n         \"tty\":false,\r\n         \"ulimits\":null,\r\n         \"use_tls\":null,\r\n         \"username\":null,\r\n         \"volumes\":null,\r\n         \"volumes_from\":null\r\n      },\r\n      \"module_name\":\"docker\"\r\n   },\r\n   \"msg\":\"Unrecognized status from pull.\",\r\n   \"status\":\"\"\r\n}\r\n```\r\n\r\n#### COMMENTS\r\n\r\nIt works fine with a straight `docker pull`:\r\n\r\n```\r\n$ docker pull quay.io/coreos/etcd\r\nUsing default tag: latest\r\nlatest: Pulling from coreos/etcd\r\n2dc473c309a3: Pull complete\r\ne5b396cd4514: Pull complete\r\nDigest: sha256:150ff52a0b1b4332e56e598881a9ca68454a3b727c82431bbe229f986845d7ab\r\nStatus: Downloaded newer image for quay.io/coreos/etcd:latest\r\n```\r\n\r\nIt works fine without using field `registry` in the playbook (specifying the registry url directly in field `image`):\r\n\r\n```\r\n---\r\n\r\n-\r\n  hosts: all\r\n  tasks:\r\n    -\r\n      name: run etcd container\r\n      docker:\r\n        image: quay.io/coreos/etcd\r\n        state: present\r\n```"},"comment":{"url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/comments/209477725","html_url":"https://github.com/ansible/ansible-modules-core/issues/3419#issuecomment-209477725","issue_url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/3419","id":209477725,"user":{"login":"WinstonSureChill","id":9483289,"avatar_url":"https://avatars.githubusercontent.com/u/9483289?v=3","gravatar_id":"","url":"https://api.github.com/users/WinstonSureChill","html_url":"https://github.com/WinstonSureChill","followers_url":"https://api.github.com/users/WinstonSureChill/followers","following_url":"https://api.github.com/users/WinstonSureChill/following{/other_user}","gists_url":"https://api.github.com/users/WinstonSureChill/gists{/gist_id}","starred_url":"https://api.github.com/users/WinstonSureChill/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WinstonSureChill/subscriptions","organizations_url":"https://api.github.com/users/WinstonSureChill/orgs","repos_url":"https://api.github.com/users/WinstonSureChill/repos","events_url":"https://api.github.com/users/WinstonSureChill/events{/privacy}","received_events_url":"https://api.github.com/users/WinstonSureChill/received_events","type":"User","site_admin":false},"created_at":"2016-04-13T14:37:03Z","updated_at":"2016-04-13T14:37:03Z","body":"According to the docs, it seems that docker-py `pull` doesn't take any registry argument. So I guess field `registry` in ansible's docker module isn't meant to be used for pull purposes but for login purposes. IMO the doc is confusing since it presents the `registry` field as the \"remote registry URL to pull images from\"."}}