Skip to content

Instantly share code, notes, and snippets.

@gbraad
Last active August 28, 2019 23:40
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gbraad/7cb36210bd5effdeb788c34d6b433ac8 to your computer and use it in GitHub Desktop.
Save gbraad/7cb36210bd5effdeb788c34d6b433ac8 to your computer and use it in GitHub Desktop.
Minishift registry mirror

Minishift registry mirror on Windows

Prerequisites

  • Windows 10
  • Hyper-V installed
  • Docker for Windows

Instructions

Setup the registry mirror

C:\>docker run -d --restart=always -p 5000:5000 --name registry-mirror registry:2 
C:\>docker exec -it registry-mirror vi /etc/docker/registry/config.yml

Add to the config

proxy:
   remoteurl: https://registry-1.docker.io
   username: [your username]
   password: [your password]
C:\>docker restart registry-mirror

Now test from your browser: http://10.0.75.1:5000/v2/_catalog

C:\>minishift config set check-network-ping-host 10.0.75.1
C:\>minishift config set check-network-http-host http://10.0.75.1:5000/v2/
C:\>minishift config set insecure-registry 10.0.75.1
C:\>minishift config set registry-mirror http://10.0.75.1:5000
C:\>set HYPERV_VIRTUAL_SWITCH=Wireless
C:\>minishift start

Now check if the mirror has images: http://10.0.75.1:5000/v2/_catalog

Note: Virtual switch does not have access to the DockerNAT network. Need to find a workaround.

Additional steps

You can also setup Docker for Windows to use the registry mirror. For this you need ot modify the settings using the Advanced configuration option:

{
  "registry-mirrors": [
    "http://10.0.75.1:5000"
  ],
  "insecure-registries": [
    "10.0.75.1"
  ],
  "debug": true,
  "experimental": true
}
@amitkrout
Copy link

amitkrout commented Mar 29, 2018

C:>docker run -d --restart=always -p 5000:5000 --name registry-mirror registry:2
C:\Program Files\Docker\Docker\Resources\bin\docker.exe: Error response from daemon: The requested address is not valid in its context.
See 'C:\Program Files\Docker\Docker\Resources\bin\docker.exe run --help'.

No such image registry:2
C:> docker pull registry:2
Warning: failed to get default registry endpoint from daemon (Error response from daemon: The requested address is not valid in its context.). Using system default: https://index.docker.io/v1/
Error response from daemon: The requested address is not valid in its context.

Am i doing anything wrong here ? I meas before these step something need to be configured ?

@gbraad
Copy link
Author

gbraad commented Mar 29, 2018

Works for me as specified. Also used on LCOW as:

PS C:\Users\gbraad> docker version
Client:
 Version:       18.03.0-ce-rc3
 API version:   1.37
 Go version:    go1.9.4
 Git commit:    e730959
 Built: Thu Mar  8 20:11:53 2018
 OS/Arch:       windows/amd64
 Experimental:  true
 Orchestrator:  swarm

Server:
 Engine:
  Version:      18.03.0-ce-rc3
  API version:  1.37 (minimum version 1.24)
  Go version:   go1.9.4
  Git commit:   e730959
  Built:        Thu Mar  8 20:26:40 2018
  OS/Arch:      windows/amd64
  Experimental: true
PS C:\Users\gbraad> docker run -d --platform linux --restart=always -p 5000:5000 --name registry-mirror registry:2

Unable to find image 'registry:2' locally
2: Pulling from library/registry
81033e7c1d6a: Pull complete
b235084c2315: Pull complete
c692f3a6894b: Pull complete
ba2177f3a70e: Pull complete
a8d793620947: Pull complete
Digest: sha256:672d519d7fd7bbc7a448d17956ebeefe225d5eb27509d8dc5ce67ecb4a0bce54
Status: Downloaded newer image for registry:2
1129d73b275b0506535da67199de5ba59168ef1663d858fb156d4859ec2008a8

@gbraad
Copy link
Author

gbraad commented Oct 10, 2018

This can be updated to utilize --no-provision to eliminate the need for D4W, and the actual install can be performed as an add-on

@praveenkumar @LalatenduMohanty WDYT?

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