This guide shows how to create a local docker registry on internal Cloudian S3 Storage.
Create a s3-registry-config.yaml config file for docker registry such as the sample config file below.
- region, regionendpoint, v4auth, secure are critical values to be set exactly the same as the sample for it to work with Element's internal Cloudian S3.
- By setting rootdirectory to / it will store the data under the following path in S3 bucket: $bucket/docker/registry/v2/
version: 0.1 log: fields: service: registry storage: s3: accesskey: ************************** secretkey: ************************************************************** region: region1 regionendpoint: http://s3internal.servername bucket: dockerreg rootdirectory: / v4auth: true secure: false cache: blobdescriptor: inmemory http: addr: :5000 headers: X-Content-Type-Options: [nosniff] health: storagedriver: enabled: true interval: 10s threshold: 3
start a registry container, note please run the following command from the path where the above configuration file located.
docker run -d -p 5000:5000 --restart=always --name registry -v `pwd`/s3-registry-config.yaml:/etc/docker/registry/config.yml registry:2
test the local docker registry
# Pull the ubuntu:16.04 image from Docker Hub. docker pull ubuntu:16.04 # Tag the image as localhost:5000/my-ubuntu. This creates an additional tag for the existing image. When the # first part of the tag is a hostname and port, Docker interprets this as the location of a registry, when # pushing. docker tag ubuntu:16.04 localhost:5000/my-ubuntu # Push the image to the local registry running at localhost:5000: docker push localhost:5000/my-ubuntu # Remove the locally-cached ubuntu:16.04 and localhost:5000/my-ubuntu images, so that you can test pulling the # image from your registry. This does not remove the localhost:5000/my-ubuntu image from your registry. docker image remove ubuntu:16.04 docker image remove localhost:5000/my-ubuntu # Pull the localhost:5000/my-ubuntu image from your local registry. docker pull localhost:5000/my-ubuntu # Validate image data are in the local registry aws s3 ls --recursive s3://dockerreg/ --endpoint-url http://s3internal.servername
- Deploy a registry server - https://docs.docker.com/registry/deploying/
- Configuring a registry - https://docs.docker.com/registry/configuration/#storage