AI Personal Learning
and practical guidance

Cloudflare Serverless Registry: A Serverless Container Registry Based on Cloudflare Workers

General Introduction

Cloudflare Serverless Registry is a serverless container registry based on Cloudflare Workers and R2 storage. It supports push and pull of images and provides username password and public key based JWT authentication. The project is easy to deploy, compatible with Docker operations, and suitable for managing container images in a serverless environment. Despite some limitations, Serverless Registry provides a lightweight and scalable solution for developers.

 

Function List

  • Support for mirror push and pull
  • Provide username password and JWT authentication
  • Compatible with Docker operations
  • Support for fallback to other registries
  • Easy to deploy and manage

 

Using Help

Installation and deployment

  1. Installing dependencies: Use pnpm to install all dependencies (other package managers may work, but only pnpm is supported).
    $ pnpm install
    
  2. Preparing the wrangler file: Copy the example file and configure it.
    $ cp wrangler.toml.example wrangler.toml
    
  3. Setting up the R2 Storage Bucket: Create an R2 storage bucket.
    $ npx wrangler --env production r2 bucket create r2-registry
    
  4. Configuring wrangler.toml: Add the R2 storage bucket configuration to the wrangler.toml file.
    r2_buckets = [
      { binding = "REGISTRY", bucket_name = "r2-registry" }
    ]
    
  5. Deployment Registry: Deploy the registry to a production environment.
    $ npx wrangler deploy --env production
    

User Name Password Authentication

  1. Setting the user name and password: Set the username and password to confidential.
    $ npx wrangler secret put USERNAME --env production
    $ npx wrangler secret put PASSWORD --env production
    

JWT Certification

  1. Add JWT public key: Add a base64-encoded JWT public key to authenticate the password or token.
    $ npx wrangler secret put JWT_REGISTRY_TOKENS_PUBLIC_KEY --env production
    

Pushing and Pulling Images with Docker

  1. Logging into Docker: Log in to Docker with your username and password.
    export REGISTRY_URL=your-url-here
    echo $PASSWORD | docker login --username $USERNAME --password-stdin $REGISTRY_URL
    
  2. push mirror (computing): Push the image to the registry.
    docker pull ubuntu:latest
    docker tag ubuntu:latest $REGISTRY_URL/ubuntu:latest
    docker push $REGISTRY_URL/ubuntu:latest
    
  3. Pulling Mirrors: Pull the image from the registry.
    docker rmi ubuntu:latest
    docker pull $REGISTRY_URL/ubuntu:latest
    

Configuring pullbacks

  1. Setting the fallback registry: Configure the fallback registry in the wrangler.toml file.
    [env.production]
    REGISTRIES_JSON = "[{ \ "registry\": \ "url-to-other-registry\", \ "password_env\": \ "REGISTRY_TOKEN\", \ "username\": \ "username-to-use\" }]"
    
  2. Setting the registry token: Set the registry token to confidential.
    cat . /registry-service-credentials.json | base64 | wrangler --env production secrets put REGISTRY_TOKEN
    

AI Easy Learning

The layman's guide to getting started with AI

Help you learn how to utilize AI tools at a low cost and from a zero base.AI, like office software, is an essential skill for everyone. Mastering AI will give you an edge in your job search and half the effort in your future work and studies.

View Details>
May not be reproduced without permission:Chief AI Sharing Circle " Cloudflare Serverless Registry: A Serverless Container Registry Based on Cloudflare Workers

Chief AI Sharing Circle

Chief AI Sharing Circle specializes in AI learning, providing comprehensive AI learning content, AI tools and hands-on guidance. Our goal is to help users master AI technology and explore the unlimited potential of AI together through high-quality content and practical experience sharing. Whether you are an AI beginner or a senior expert, this is the ideal place for you to gain knowledge, improve your skills and realize innovation.

Contact Us
en_USEnglish