Skip to content

Instantly share code, notes, and snippets.

@cdoan1
Last active June 27, 2020 02:21
Show Gist options
  • Save cdoan1/705b5a3a3867813ea8149a592ad3143e to your computer and use it in GitHub Desktop.
Save cdoan1/705b5a3a3867813ea8149a592ad3143e to your computer and use it in GitHub Desktop.

Extend the registry docker, to include preloaded registry data. https://github.com/cdoan1/distribution-library-image

# Build a minimal distribution container

FROM alpine:3.11

RUN set -ex \
    && apk add --no-cache ca-certificates

COPY ./registry /bin/registry
COPY ./config-example.yml /etc/docker/registry/config.yml

VOLUME ["/var/lib/registry"]
COPY ./data /var/lib/registry/data
EXPOSE 5000

COPY docker-entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]

CMD ["/etc/docker/registry/config.yml"]

pre-built docker image can be downloaded from here

podman run -d --net host --name registry -p 5000:5000 \
-v /opt/registry/data:/var/lib/registry:z \
-v /opt/registry/auth:/auth:z \
-v /opt/registry/config:/etc/docker/registry:z \
-v /opt/registry/certs:/certs:z \
-e "REGISTRY_AUTH=htpasswd" \
-e "REGISTRY_AUTH_HTPASSWD_REALM=Registry Realm\" \
-e REGISTRY_AUTH_HTPASSWD_PATH=/auth/htpasswd \
-e REGISTRY_HTTP_TLS_CERTIFICATE=/certs/registry.crt \
-e REGISTRY_HTTP_TLS_KEY=/certs/registry.key \
-e REGISTRY_STORAGE_DELETE_ENABLED=true \
quay.io/cdoan0/registry-preloaded:latest

test

# podman pull dell-r640-015:5000/coreos/etcd-operator@sha256:66a37fd61a06a43969854ee6d3e21087a98b93838e284a6086b13917f96b0d9b
Trying to pull dell-r640-015:5000/coreos/etcd-operator@sha256:66a37fd61a06a43969854ee6d3e21087a98b93838e284a6086b13917f96b0d9b...
Getting image source signatures
Copying blob 80b1b554e5b4 done
Copying blob 8ea0315241b4 done
Copying blob 59265c40e257 done
Copying blob e05d0d7eb99a done
Copying blob a3ed95caeb02 done
Copying blob 678f2cfebea6 done
Copying blob 6d4b4c91b3ff done
Copying blob a3ed95caeb02 skipped: already exists
Writing manifest to image destination
Storing signatures
9d5c51d92fbddcda022478def5889a9ceb074305d83f2336cfc228827a03d5d5
# podman pull dell-r640-015:5000/coreos/etcd-operator@sha256:66a37fd61a06a43969854ee6d3e21087a98b93838e284a6086b13917f96b0d9b
Trying to pull dell-r640-015:5000/coreos/etcd-operator@sha256:66a37fd61a06a43969854ee6d3e21087a98b93838e284a6086b13917f96b0d9b...
Getting image source signatures
Copying blob 80b1b554e5b4 skipped: already exists
Copying blob 59265c40e257 skipped: already exists
Copying blob 8ea0315241b4 skipped: already exists
Copying blob e05d0d7eb99a skipped: already exists
Copying blob 678f2cfebea6 skipped: already exists
Copying blob 6d4b4c91b3ff skipped: already exists
Copying blob a3ed95caeb02 done
Copying blob a3ed95caeb02 done
Writing manifest to image destination
Storing signatures
9d5c51d92fbddcda022478def5889a9ceb074305d83f2336cfc228827a03d5d5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment