Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Using a Local Registry with Minikube

Using a Local Registry with Minikube

Install a local Registry

These instructions include running a local registry accessible from Kubernetes as well as from the host development machine at

  1. Use the docker CLI to run the registry:2 container from Docker, listening on port 5000, and persisting images in the ~/.registry/storage directory.

    docker run -d -p 5000:5000 --restart=always --volume ~/.registry/storage:/var/lib/registry registry:2
  2. Edit the /etc/hosts file on your development machine, adding the name on the same line as the entry for localhost.

  3. Validate that the registry is running.

    docker ps
    CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                    NAMES
    02ea46d51f58        registry:2          "/ /etc…"   About an hour ago   Up About a minute>5000/tcp   sharp_pike
  4. Validate that the registry at is reachable from your development machine.

  5. Configure the docker daemon with an insecure registy at

    On macOS in ~/.docker/daemon.json on Linux in /etc/docker/daemon.json (craete the file if it does not exist)

      "insecure-registries": [""]

Start Minikube

minikube start --cpus 4 --memory 4096 --insecure-registry

Configure a fixed IP address

This IP address will allow processes in Minikube to reach the registry running on your host. Configuring a fixed IP address avoids the problem of the IP address changing whenever you connect your machine to a different network. If your machine already uses the 172.16.x.x range for other purposes, choose an address in a different range e.g. 172.31.x.x..

export DEV_IP=

Create an alias on MacOS:

sudo ifconfig lo0 alias $DEV_IP

Create an alias on Linux:

sudo ifconfig lo:0 $DEV_IP

Note that the alias will need to be reestablished when you restart your machine. This can be avoided by using a launchdeamon on MacOS or by editing /etc/network/interfaces on Linux.

Minikube /etc/hosts

Add an entry to /etc/hosts inside the minikube VM, pointing the registry to the IP address of the host. This will result in resolving to the host machine allowing the docker daemon in minikube to pull images from the local registry. This uses the DEV_IP environment variable from the previous step.

export DEV_IP=
minikube ssh "echo \"$DEV_IP\" | sudo tee -a  /etc/hosts"

Kubernetes Service and Endpoint

Create a kubernetes service without selectors called registry in the dev namespace and a kubernetes endpoint with the same name pointing to the static IP address of your development machine. This will result in resolving to the host machine, allowing container builds running in the cluster, to work with the local registry.

kubectl create namespace dev
cat <<EOF | kubectl apply -n dev -f -
kind: Service
apiVersion: v1
  name: registry
  - protocol: TCP
    port: 5000
    targetPort: 5000
kind: Endpoints
apiVersion: v1
  name: registry
  - addresses:
      - ip: $DEV_IP
      - port: 5000

Relocate app images

Install irel CLI from

For this example we are using a registry prefix of; you would need to change this to match your registry (you also need to be authenticated with this registry).

To copy the time sink app to your own registry run:

irel copy springcloudstream/time-source-rabbit:2.1.2.RELEASE

To copy the log sink app to your own registry run:

irel copy springcloudstream/log-sink-rabbit:2.1.3.RELEASE

You can now register the relocated apps using SCDF Shell:

dataflow:>app register --name time --type source --uri
dataflow:>app register --name log --type sink --uri
Copy link

Chasun-fhd commented May 3, 2022

@Chasun-fhd verify that your image is in the registry by curl http://localhost:5001/v2/_catalog || curl

i tried too, returns the same like

Copy link

Chasun-fhd commented May 3, 2022

finally, i solved this problem. Configure static ip address on my mac. then replace ip in these instructions with new static ip. it worked.

Copy link

oscarCCOnis commented Oct 11, 2022

I have my image in my repo, but my minikube is trying to find https instead of http and its failing

$ curl

Events:                                                                                                                                  │
│   Type     Reason     Age              From               Message                                                                        │
│   ----     ------     ----             ----               -------                                                                        │
│   Normal   Scheduled  5s               default-scheduler  Successfully assigned monitoring/monitoring-deployment-696c48f8d4-flp5v to min │
│ ikube                                                                                                                                    │
│   Normal   Pulling    5s               kubelet            Pulling image ""       │
│   Warning  Failed     4s               kubelet            Failed to pull image " │
│ ": rpc error: code = Unknown desc = Error response from daemon: Get "": dial tcp: lookup  │
│ no such host                                                                                             │
│   Warning  Failed     4s               kubelet            Error: ErrImagePull                                                            │
│   Normal   BackOff    3s (x2 over 4s)  kubelet            Back-off pulling image " │
│ .0"                                                                                                                                      │
│   Warning  Failed     3s (x2 over 4s)  kubelet            Error: ImagePullBackOff`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment