how to build a docker registry for windows an linux

using: docker registry on photon os

requires : docker registry 2.5 or later ( using 2.61 in this example )
requires : docker daemon on windows, minimum 17.06

Setup:

install a docker host for your registry. in my example, i deploy a docker registry on a Photon Containerhost
for labbuildr, you can use use the command:

.\install-photon.ps1 -docker_registry

this will
- install latest phopton os
- pull docker-registry latest
if you install manually, here is an example docker compose:

    - path: /root/docker-compose.yml
      content: | 
       registry:
         restart: always
         image: registry:latest
         ports:
          - 5000:5000
         volumes:
          - /data:/var/lib/registry

you can build your registry manually by

/usr/bin/docker-compose -f /root/docker-compose.yml up -d

image the registry in this example uses /data dockervolume, a mountpoint for sdb1 in my case

to make Docker Windows able to push images to the linux registry, the allow-nondistributable-artifacts must be set in
c:\programdata\docker\config\daemon.json
insecure registry is also defined in that by insecure-registries directive
example

{
"insecure-registries":["192.168.2.40:5000"],
"allow-nondistributable-artifacts": ["192.168.2.40:5000"]
}

When using labbuildr a windows dockerhost can be automatically brought online by running:

.\build-lab.ps1 -Master 2016core -docker -Size xl -defaults

modifications for the private registry and nondistributable artifacts are made automatically then.

verify

run docker info to verify setings and versions on your windows host

docker info

image

test

to download a windows based image from the docker hub, run docker pull in this example i used microsoft sql server, as the size was the original reason to build this :-)

docker pull microsoft/mssql-server-windows

image

once download is complete, we tag the image with the local registry name/ip:

docker tag microsoft/mssql-server-windows:latest 192.168.2.40:5000/microsoft/mssql-server-windows:latest

and push it to the local registry

docker push 192.168.2.40:5000/microsoft/mssql-server-windows:latest

image we can now ask the registry for the catalog by

Invoke-RestMethod http://192.168.2.40:5000/v2/_catalog | Select-Object -ExpandProperty repositories

image

on a second docker windows host, we verify the image by pulling it

docker pull 192.168.2.40:5000/microsoft/mssql-server-windows:latest

image

you will notice a faster download speed now as you refer to your local repo

config.yml ecample for ECS

version: 0.1
log:
fields:
service: registry
storage:
cache:
blobdescriptor: inmemory
s3:
accesskey: docker
secretkey: TQMDSwwf5KFN+rSJVI89TOI8Rc1cz4CxrREajdk6
region: Standard
regionendpoint: http://192.168.2.245:9020
bucket: registry
encrypt: false
chunksize: 5242880
multipartcopychunksize: 33554432
multipartcopymaxconcurrency: 100
multipartcopythresholdsize: 33554432
http:
addr: :5000
headers:
X-Content-Type-Options: [nosniff]
health:
storagedriver:
enabled: true
interval: 10s
threshold: 3