Docker 创建本地Registry

事前准备1台装了docker的centos8.2虚拟机

k8s119-master 192.168.31.12

Step1

启动registry

docker run -d -p 5000:5000 --restart always -v /opt/registry:/var/lib/registry --name registry registry:2

Step2

配置registry

sudo vi /etc/docker/daemon.json
---add
"insecure-registries": ["192.168.31.12:5000"]
---
sudo systemctl daemon-reload
sudo systemctl restart docker

Step3

确认registry

docker tag container-registry.oracle.com/os/oraclelinux:7-slim 192.168.31.12:5000/oracle/os/oraclelinux:7-slim
docker push 192.168.31.12:5000/oracle/os/oraclelinux:7-slim
curl -X GET http://192.168.31.12:5000/v2/_catalog
{
     "repositories":["oracle/os/oraclelinux"]}
curl -X GET http://192.168.31.12:5000/v2/oracle/os/oraclelinux/tags/list
{
     "name":"oracle/os/oraclelinux","tags":["7-slim"]}

完结!

你可能感兴趣的:(docker,docker,registry)