Giter Club home page Giter Club logo

cloudflare-docker-proxy's Introduction

cloudflare-docker-proxy

deploy

If you're looking for proxy for helm, maybe you can try cloudflare-helm-proxy.

Deploy

Deploy to Cloudflare Workers

  1. create an cloudflare API Token first (token ONLY SHOW ONCE), Account ID is needed. (Account ID is different from Login ID. If Account ID Not Found, create an Application in cloudflare workers page first.)
  2. fork this project
  3. modify the link of the above button to your fork url
  4. modify routes as your need:
    4.1. use cloudflare worker host: only support proxy one registry
    • modify routes as follow: (in file src/index.js)
    const routes = {
      "${workername}.${username}.workers.dev/": "https://registry-1.docker.io",
    };
    4.2. use custom domain: support proxy multiple registries route by host (assume your domain is yourdomain.com)
    • modify routes according to your domain as follow: (in file src/index.js)
    const routes = {
      "docker.yourdomain.com": "https://registry-1.docker.io",
      "quay.yourdomain.com": "https://quay.io",
      "gcr.yourdomain.com": "https://k8s.gcr.io",
      "k8s-gcr.yourdomain.com": "https://k8s.gcr.io",
      "ghcr.yourdomain.com": "https://ghcr.io",
    };
  5. click the button, you will be redirected to the deploy page.
  6. if you choose 4.2 use custom domain in step 4, you need to do the following steps:
  • host your domain DNS on cloudflare
  • add all domains (which config in step 4.2. eg: docker.yourdomain.com, quay.yourdomain.com etc.) to Custom Domains of the worker you have deployed.

*Attention: Click Triggers in the worker page to show Custom Domains and Routes info.

Config Docker mirrors

  1. modify /etc/docker/daemon.json, add registry-mirrors as follow:
    • if you choose 4.1 use cloudflare worker host.
      Change the following url to your actually url (which you can find in Preview or Routes of your worker).
    {
        "registry-mirrors": ["https://<workername>.<username>.workers.dev"]
    }
    • if you choose 4.2 use custom domain
    {
        "registry-mirrors": ["https://docker.yourdomain.com"]
    }
  2. restart docker daemon
   systemctl restart docker.service

Enjoy yourself!

cloudflare-docker-proxy's People

Contributors

ciiiii avatar jiamliang avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.