Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Add --image-repository flag so that users can select an alternative repository mirror #3714
Some users (especially for those in mainland China) may have issue accessing the default image repository. This patchset allows users to override the default image repository gcr.io to a different repository by specifying --image-repository option in the command line as a simple workaround. Images will be pulled from the specified image repository instead of the default ones. Example (using mirror by Aliyun): minikube start ... --image-repository registry.cn-hangzhou.aliyuncs.com/google_containers
When the user overrides image repository the images will be pulled from the overrided one instead of the official repositories.
Thank you so much for writing this. This PR could potentially make minikube work much better in China, as well as environments with limited internet connectivity. I'll give this a closer look tomorrow, but at least initially this seems to be doing the right things.
Do you have a mirror or two to recommend that I could test this PR against?
One potential concern to eventually address is cache-poisoning, which will require minikube addressing images with hashes instead of versions -- but I won't let "perfect be the enemy of good".
A potential eventual enhancement would be to have an automated fall-back mechanism between a set of known-good image repositories (similar to "apt" or other systems), so that minikube in users in China would not have to manually specify a --image-repository URL unless they wish to.
You may start with registry.cn-hangzhou.aliyuncs.com/google_containers.
We may use --image-repository as an ultimate workaround
Let me know if you have any other concerns.
How does this new
I'll admit, I didn't know about this flag up until today. I haven't looked into it's implementation yet to see if it's compatible with non-docker container runtimes, which your flag seems to allow for.
I believe --registry-mirror only impacts those images with no repository prefix - images that come from the Docker official registry.
If you set up minikube with --registry-mirror, it could work for pods/deployments that use ubuntu/18.04, but not for gcr.io/ - you will need to wipe the "gcr.io/" out from the references to make it look like an image from the official registry. For the latter case, it could be achieved using --registry-mirror https://private_server --image-registry [private_server/]google_containers
The same goes for the global
[registries.search] registries = ['docker.io'] [registries.insecure] registries = 
# insecure_registries is used to skip TLS verification when pulling images. insecure_registries = [ ] # registries is used to specify a comma separated list of registries to be used # when pulling an unqualified image (e.g. fedora:rawhide). registries = [ "docker.io" ]
As stated above, this would not help for the
Thank you for the clarification and excellent work here. I've added a few nitpicks, but it's good enough as is. This is really going to help minikube users around the world.
We're going to want to add an integration test for this, but until #3767 lands it's rather painful to add start arguments. We can do that in a follow-up PR.
1 similar comment
[APPROVALNOTIFIER] This PR is APPROVED
The full list of commands accepted by this bot can be found here.
The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing
This flag only take affect when you execute minikube start. You may check the output of minikube start --help. If you don’t see the flag appearing in the help text it might suggest you’re using an old release. The flag can be used as shown in the following examples: minikube start --image-repository=registry.cn-hangzhou.aliyuncs.com/google_containers or minikube start --image-repository=auto Regards, Zhongcheng From: Adnan Hodzic <email@example.com> Sent: Tuesday, July 23, 2019 7:10 PM To: kubernetes/minikube <firstname.lastname@example.org> Cc: Zhongcheng Lao <Zhongcheng.Lao@microsoft.com>; Author <email@example.com> Subject: Re: [kubernetes/minikube] Add --image-repository flag so that users can select an alternative repository mirror (#3714) It says this PR has been merged with master, however if I run minikube --image-repository I'll get an error with unknown flag: --image-repository message. Could somebody please clarify how can this flag be used exactly, as I'm in need of one such functionality. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fkubernetes%2Fminikube%2Fpull%2F3714%3Femail_source%3Dnotifications%26email_token%3DAAFCTMJOZNIRPRKFXVAOZWDQA3RJ5A5CNFSM4GX73PFKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2SYRUY%23issuecomment-514164947&data=02%7C01%7Czhongcheng.lao%40microsoft.com%7Cb3d05083b1e2412b7dc808d70f5e5b48%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636994770246142938&sdata=6aOGVgMx1IlGdlUPTzTe2euIuDgP0U3hV91XOhjb1WE%3D&reserved=0>, or mute the thread<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAAFCTMMAKADWVBAJXE43NBLQA3RJ5ANCNFSM4GX73PFA&data=02%7C01%7Czhongcheng.lao%40microsoft.com%7Cb3d05083b1e2412b7dc808d70f5e5b48%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636994770246152934&sdata=QgrEZkdp%2B7DYp%2BG6yvect0aV81wd2agAW%2BlYVhhHfc4%3D&reserved=0>.