minikube: Can't pull images from an insecure registry in Minikube VM
This a BUG REPORT
Minikube version v0.9.0:
Environment:
- OS Mac OS X
- VM Driver xhyve
- Docker version
1.12.1 - Install tools:
- Others:
What happened:
We currently host Docker images on a private, insecure registry hosted behind our firewall. (I use a VPN client (openconnect) in order to access the private registry.)
After adding the URL of the private registry in the “Advanced” tab of the Docker.app UI, I was able to use the Docker CLI pull and run images from the private registry without any problem.
I figured that I should be able to do the same thing after starting Minikube and specifying the same registry hostname:port combination that I did in the Docker UI, but using the --insecure-registry flag instead. However, when I tried to run the same image as above, the pod didn’t start up, and I saw errors like the following:
Failed to pull image "<image-name>": Error response from daemon: Get https://<registry-hostname>:5000/v1/_ping: EOF
I tried minikube ssh-ing into the VM and noticed that there was no evidence of the --insecure-registry flag being passed to the docker daemon command. I expected to see it included in EXTRA_ARGS in /var/lib/boot2docker/profile. I tried adding the flag to that file and restarting the Docker daemon – and was then able to pull and run images from the private registry as expected. Of course, when I stopped and restarted the Minikube VM, my changes were lost and I was no longer able to pull from the private registry.
What you expected to happen:
How to reproduce it (as minimally and precisely as possible):
Anything else do we need to know:
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 1
- Comments: 19 (4 by maintainers)
I just tried this with minikube v0.10.0 and
--insecure-registry='docker-registry.example.com:443'was correctly copied into/var/lib/boot2docker/profilein the new xhyve VM. However, as @dlorenc hinted, the--insecure-registryflag is ignored if the machine already existed (even if it is stopped). You must firstminikube deleteif you want new flags to be respected (see #523 ).@gabencui @aecolley You don’t need to delete and re-create the VM just to pass
--insecure-registry.There is a JSON file created after the minikube VM is created (I used virtualbox on linux) -
$HOME/.minikube/machines/minikube/config.json- that seems to contain a lot of config for the VM.Here is mine: https://gist.github.com/kunalg/015aacb58d18bd110844922da7329c22
In this, you can see some interesting config under ‘HostOptions’ -> ‘EngineOptions’ - including the ‘InsecureRegistry’.
You can edit this JSON array while your minikube VM is stopped. And, once restarted, it seems to take effect - without deleting the VM 😌 😁
This is the output from my current minikube vm (minikube ssh):
If you look at process id 3061, it carries the
--insecure-registryflag.Now, following output is after stopping the VM, editing the config.json file to remove the insecure registry entry and restarting the vm:
Now, if you see process id 3049 in the above output, there is no
--insecure-registrypassed.This is after adding the entry again:
And voilà,
--insecure-registryflag back again in process id 2922. 😉Sure, I passed it as a flag to
minikube start:minikube start --vm-driver="xhyve" --insecure-registry="<registry-hostname>:5000"@aecolley thank you very match! “the --insecure-registry flag is ignored if the machine already existed (even if it is stopped). You must first minikube delete if you want new flags to be respected” is correct.
Just wanted to add a note that as of minikube
0.19.0(and maybe earlier, but I only got this now) minikube uses systemd, hence:Finally I found the solution without deleting the VM here: http://stackoverflow.com/a/39698096/5408030
Also, I show you the content of my profile archive EXTRA_ARGS=’ –label provider=xhyve –insecure-registry=192.168.64.2:30873 ’ CACERT=/var/lib/boot2docker/ca.pem DOCKER_HOST=‘-H tcp://0.0.0.0:2376’ DOCKER_STORAGE=aufs DOCKER_TLS=auto SERVERKEY=/var/lib/boot2docker/server-key.pem SERVERCERT=/var/lib/boot2docker/server.pem
I copy the post below
For an http registry this steps works for me:
minikube ssh
edit /var/lib/boot2docker/profile and add to $EXTRA_ARGS --insecure-registry yourdomain.com:5000
restart the docker daemon sudo /etc/init.d/docker restart