Minikube’s built-in Docker registry is actually just a special configuration of your Minikube VM’s Docker daemon, not a separate service.
Let’s get an image into that registry.
First, make sure Minikube is running with the Docker environment loaded. You’d have done this with eval $(minikube docker-env). If you haven’t, your docker build commands will build images on your host machine, not inside Minikube.
Now, let’s build a tiny Nginx image. We’ll tag it specifically for Minikube’s registry. The default address for Minikube’s registry is localhost:5000. So, we’ll tag our image as localhost:5000/my-nginx:latest.
docker build -t localhost:5000/my-nginx:latest .
After this command, if you run docker images, you’ll see localhost:5000/my-nginx in the list. This tells you Docker thinks it knows how to push to localhost:5000.
Now, let’s push it.
docker push localhost:5000/my-nginx:latest
You should see output indicating layers are being pushed. If you get an error here, it’s usually because the Docker daemon inside Minikube isn’t configured to accept pushes to that address, or your host Docker daemon isn’t correctly pointing to the Minikube daemon.
Here’s how to check and fix common issues:
-
Minikube Daemon Not Running or Incorrectly Configured:
- Diagnosis: Run
docker pson your host machine. If it shows no containers or errors, your host Docker isn’t talking to Minikube. Then, runminikube sshand inside the VM, rundocker ps. If that works, the issue is host-side. - Fix: Always ensure you’ve run
eval $(minikube docker-env)in your current shell session before anydocker buildordocker pushcommands. If you’re unsure, re-run it. This command setsDOCKER_HOST,DOCKER_TLS_VERIFY, andDOCKER_CERT_PATHenvironment variables to point your host Docker client to the Minikube VM’s daemon. - Why it works: The
eval $(minikube docker-env)command configures your host’s Docker client to communicate with the Docker daemon running inside the Minikube virtual machine. Without it, your host’s Docker client tries to talk to your host’s native Docker daemon.
- Diagnosis: Run
-
Registry Not Accessible or Not Running (Rare for Minikube’s Built-in):
- Diagnosis: Run
minikube sshand inside the VM, runcurl -v localhost:5000. You should get an HTTP/1.1 200 OK or similar, not a connection refused. - Fix: Minikube’s built-in registry is enabled by default when you use
eval $(minikube docker-env). If it’s truly not there, you might have an older Minikube version or a corrupted setup. Tryminikube deleteandminikube start. For newer versions, you might need to explicitly enable it withminikube start --driver=docker --insecure-registry="localhost:5000". - Why it works: The
--insecure-registryflag tells the Docker daemon to allow connections to the specified registry address without TLS verification, which is how Minikube’s internal registry is exposed.
- Diagnosis: Run
-
Firewall Issues:
- Diagnosis: On your host, try
telnet localhost 5000. If it hangs or says "Connection refused," a firewall might be blocking it. - Fix: Temporarily disable your host’s firewall (e.g.,
sudo ufw disableon Ubuntu, or check your macOS/Windows firewall settings) and try again. Re-enable it afterward. - Why it works: Firewalls can prevent the Docker client on your host from establishing a network connection to the registry port (5000) exposed by the Minikube VM.
- Diagnosis: On your host, try
-
Incorrect Image Tagging:
- Diagnosis: Double-check your
docker buildcommand. Ensure the tag exactly matcheslocalhost:5000/<your-image-name>:<tag>. - Fix: Rebuild the image with the correct tag:
docker build -t localhost:5000/my-nginx:latest . - Why it works: The Docker client uses the registry address in the tag to know where to send the
pushcommand. If the address is wrong, it tries to push to the wrong place or fails because it doesn’t know where to go.
- Diagnosis: Double-check your
-
Docker Daemon Inside Minikube Not Restarted After Config Change:
- Diagnosis: If you manually edited
daemon.jsoninside the Minikube VM (e.g., viaminikube ssh), the daemon might need a restart. - Fix: Inside the Minikube VM (via
minikube ssh), runsudo systemctl restart docker. - Why it works: Applying configuration changes to a running service usually requires restarting that service to pick up the new settings.
- Diagnosis: If you manually edited
Once the image is pushed, you can use it in your Kubernetes manifests by referencing localhost:5000/my-nginx:latest.
After successfully pushing your image, the next hurdle is often convincing Kubernetes itself to pull that image from your local registry.