Using a local registry with Minikube
Installing Docker
The official documentation is a good source for this process.
Installing Minikube
For this too, we follow the official documentation.
Getting Started
Make sure the Docker daemon is running.
Creating a Local Registry
Create and run the local registry at port 5000 using the following command.
$ docker run -d -p 5000:5000 --name registry registry:2
Add the local insecure registry to Docker. To make it easier to access your host, Minikube v1.10 adds a hostname entry host.minikube.internal
to /etc/hosts
{
"insecure-registries": [ "host.minikube.internal:5000" ]
}
Starting Minikube Cluster
$ minikube start --insecure-registry="host.minikube.internal:5000"
This flag will let Minikube know that the registry at that location is an insecure one and does not need to enforce https
.
Tagging and Pushing Images
To push images to our local registry, we need to tag our images.
$ docker pull alpine$ docker tag alpine localhost:5000/my-alpine$ docker push localhost:5000/my-alpine
Pulling the image in Minikube
$ minikube ssh$ docker pull host.minikube.internal:5000/my-alpine
You should be able to see docker being able to pull the image inside Minikube without any errors.
Resources
- Docker — https://docs.docker.com/engine/install/
- Minikube — https://minikube.sigs.k8s.io/docs/start/
- Host Access — https://minikube.sigs.k8s.io/docs/handbook/host-access/