Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to store Docker registry to aliyun oss

2025-04-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains "how to store Docker registry to aliyun oss". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn "how to store Docker registry to aliyun oss"!

Docker registry is stored to aliyun oss

Registry has many configurations and usually needs to be modified by passing in environment variables through-e.

The default registry data is stored on the local disk / var/lib/registry

[root@iZ23mynm1ezZ ~] # docker exec registry cat / etc/docker/registry/config.ymlversion: 0.1log: fields: registrystorage: cache: blobdescriptor: inmemory filesystem: rootdirectory: / var/lib/registryhttp: addr:: 5000 headers: X-Content-Type-Options: [nosniff] health: storagedriver: enabled: true interval: 10s threshold: 3

For better expansion. For example, registry needs to configure load balancing. Including the place where the data is stored, the ssl certificate, the redis are all the same..

Here we configure oss, and the names of environment variables are grouped according to the hierarchy of yml. such as

Storage: filesystem: rootdirectory: / var/lib/registry

The corresponding environment variable is named 'REGISTRY_STORAGE_FILESYSTEM_ ROOTDIRECTORY` (uppercase)

Docker run-d-p 5001etc/letsencrypt/archive/registry.xxxx.com/:/certs 5000-- restart=always-- name registry1\-v / etc/letsencrypt/archive/registry.xxxx.com/:/certs\-e REGISTRY_HTTP_TLS_CERTIFICATE=/certs/fullchain1.pem\-e REGISTRY_HTTP_TLS_KEY=/certs/privkey1.pem\-v `pwd` / auth:/auth\-e "REGISTRY_AUTH=htpasswd"\-e "REGISTRY_AUTH_HTPASSWD_REALM=Registry Realm"\-e REGISTRY_AUTH_HTPASSWD_PATH=/auth/htpasswd\-e REGISTRY_STORAGE=oss\ -e REGISTRY_STORAGE_OSS_ACCESSKEYID=xxxx\-e REGISTRY_STORAGE_OSS_ACCESSKEYSECRET=xxxxxxx\-e REGISTRY_STORAGE_OSS_REGION=oss-cn-hangzhou\-e REGISTRY_STORAGE_OSS_BUCKET=bkt_name\ registry:2

test

[root@srv00 ~] # docker login registry.xxxx.com:5001Username: hippoPassword: Login Succeeded [root@srv00 ~] # docker push registry.xxxx.com:5001/ubuntuThe push refers to a repository [registry.xxxx.com:5001/ubuntu] 5f70bf18a086: Pushed a3b5c80a4eba: Pushed 7f18b442972b: Pushed 3ce512daaf78: Pushed 7aae4540b42d: Pushed latest: digest: sha256:92c80b28023de63d528c722c295bbe82a20722e3fd7a9b4f14a688bea2cacdac size: 1356

Log in to oss to see an extra docker folder

If your conditions cannot be met by environment variables, you can create a config.yml file and overwrite the configuration file (/ etc/docker/registry/config.yml) in the container by mounting the data volume file.

At this point, I believe you have a deeper understanding of "how to store Docker registry to aliyun oss". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report