Giter VIP home page Giter VIP logo

registry-mirror's Introduction

自建 Docker 镜像加速&缓存服务

利用 Registry 的 镜像代理与缓存 功能加速&缓存镜像,同时支持 dockerhub、gcr.io、quay.io、nvcr.io、registry.k8s.io 等多个仓库,保持原有仓库的镜像tag不变,且一次拉取之后打包整个仓库目录可离线使用,

1. 安装docker

git clone https://github.com/shiquan1988/registry-mirror.git
cd registry-mirror
./get-docker.sh --mirror Aliyun

2. 生成证书

./gencert.sh

3. 启动服务端

# 如果在无法访问gcr.io的机器上启动服务则需要增加代理
# export PROXY=ip:port
docker compose up -d

4. 配置客户端

修改/etc/hosts将域名解析劫持到自己的IP(如果有自建DNS服务也可以改DNS配置)

# vim /etc/hosts 
192.168.1.1 gcr.io quay.io docker.io registry-1.docker.io nvcr.io registry.k8s.io custom.local

信任证书(不同操作系统步骤可能不一样)

# macOS
sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain cert/ca.crt
# Debian/Ubuntu
sudo apt install ca-certificates
sudo cp cert/ca.crt /usr/local/share/ca-certificates/ca.crt
sudo update-ca-certificates
# CentOS/Fedora/RHEL
sudo yum install ca-certificates
sudo update-ca-trust force-enable
sudo cp cert/ca.crt /etc/pki/ca-trust/source/anchors/
sudo update-ca-trust

重启docker

sudo systemctl daemon-reload
sudo systemctl restart docker

测试

docker pull registry.k8s.io/pause:3.9

registry-mirror's People

Contributors

brighill avatar jdxia 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.