{"action":"created","issue":{"url":"https://api.github.com/repos/docker/docker/issues/23320","repository_url":"https://api.github.com/repos/docker/docker","labels_url":"https://api.github.com/repos/docker/docker/issues/23320/labels{/name}","comments_url":"https://api.github.com/repos/docker/docker/issues/23320/comments","events_url":"https://api.github.com/repos/docker/docker/issues/23320/events","html_url":"https://github.com/docker/docker/issues/23320","id":158774420,"number":23320,"title":"Avoiding private registry hostname in FROM directive of Dockerfile","user":{"login":"salmanbaset","id":5834267,"avatar_url":"https://avatars.githubusercontent.com/u/5834267?v=3","gravatar_id":"","url":"https://api.github.com/users/salmanbaset","html_url":"https://github.com/salmanbaset","followers_url":"https://api.github.com/users/salmanbaset/followers","following_url":"https://api.github.com/users/salmanbaset/following{/other_user}","gists_url":"https://api.github.com/users/salmanbaset/gists{/gist_id}","starred_url":"https://api.github.com/users/salmanbaset/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/salmanbaset/subscriptions","organizations_url":"https://api.github.com/users/salmanbaset/orgs","repos_url":"https://api.github.com/users/salmanbaset/repos","events_url":"https://api.github.com/users/salmanbaset/events{/privacy}","received_events_url":"https://api.github.com/users/salmanbaset/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/docker/docker/labels/area/builder","name":"area/builder","color":"0052cc"},{"url":"https://api.github.com/repos/docker/docker/labels/group/distribution","name":"group/distribution","color":"F6FBFF"},{"url":"https://api.github.com/repos/docker/docker/labels/kind/feature","name":"kind/feature","color":"AAB3AB"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-06-06T21:03:21Z","updated_at":"2016-06-06T21:18:33Z","closed_at":null,"body":"Say I have an image FOOBASE in a private registry (hostname:port PRIVREGHOSTNAME:5000)\r\n\r\nI want to use this image in a Dockerfile for a new image FOONEW. Currently, it was to be done as follows:\r\n\r\n# Dockerfile\r\nFROM PRIVREGHOSTNAME:5000/FOOBASE\r\n...\r\n\r\nThat is, the hostname of the private registry is in the Dockerfile.\r\n\r\nNow say, I want to change the registries. I have to change the Dockerfile of FOOBASE, rebuild it, and rebuild the image FOONEW that depends on FOOBASE. Obviously, changing the Dockerfile is not desirable. The registry hostname should not be in the Dockerfile\r\n\r\nInstead, a better solution is to define a new parameter --registry-url for docker build. E.g.,\r\n\r\ndocker build -t . --registry-url PRIVREGHOSTNAME:5000\r\n\r\nSo by default, the image referenced in Dockerfile is searched first in the registry-url and then in Dockerhub.\r\n"},"comment":{"url":"https://api.github.com/repos/docker/docker/issues/comments/224091547","html_url":"https://github.com/docker/docker/issues/23320#issuecomment-224091547","issue_url":"https://api.github.com/repos/docker/docker/issues/23320","id":224091547,"user":{"login":"duglin","id":1944671,"avatar_url":"https://avatars.githubusercontent.com/u/1944671?v=3","gravatar_id":"","url":"https://api.github.com/users/duglin","html_url":"https://github.com/duglin","followers_url":"https://api.github.com/users/duglin/followers","following_url":"https://api.github.com/users/duglin/following{/other_user}","gists_url":"https://api.github.com/users/duglin/gists{/gist_id}","starred_url":"https://api.github.com/users/duglin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/duglin/subscriptions","organizations_url":"https://api.github.com/users/duglin/orgs","repos_url":"https://api.github.com/users/duglin/repos","events_url":"https://api.github.com/users/duglin/events{/privacy}","received_events_url":"https://api.github.com/users/duglin/received_events","type":"User","site_admin":false},"created_at":"2016-06-06T21:18:33Z","updated_at":"2016-06-06T21:18:33Z","body":"oh, if only you could have written something like:\r\n```\r\nFROM ${registry:-myregistry.com}/foobase\r\n...\r\n\r\n\r\ndocker build --build-arg registry=yourregistry.com\r\n```\r\n:-)"}}
{"actor":{"display_login":"duglin"}}