建立docker 私有仓库 registry - xd21303/Notebook GitHub Wiki

拉registry镜像,运行,注意挂载目录和映射端口。

docker pull registry
docker run -d -p 5100:5000 --restart=always --name registry     -v /media/data/registry:/var/lib/registry     registry:latest

修改docker配置文件

sudo vim /etc/docker/daemon.json
{
  "registry-mirrors": ["https://3aymwc8n.mirror.aliyuncs.com"],
  "insecure-registries": ["80.80.80.229:5100"],
  "log-driver":"json-file",
  "log-opts": {"max-size":"500m", "max-file":"3"}
}

修改完后 Flush changes:

sudo systemctl daemon-reload

重启docker daemon

sudo systemctl restart docker

先构建image,打标签,tag,然后上传私有仓库。

docker tag mlflow-kubeflow_test localhost:5100/mlflow-kubeflow_test
docker push localhost:5100/mlflow-kubeflow_test
docker tag model-serve localhost:5100/model-serve
docker push localhost:5100/model-serve

查询registry中的镜像

curl -XGET http://localhost:5100/v2/_catalog

查询某个镜像的标签列表

curl -XGET http://6localhost:5100/v2/model-serve/tags/list

查询具体镜像的digest

curl  -I -s -XGET --header "Accept: application/vnd.docker.distribution.manifest.v2+json" http://localhost:5100/v2/model-serve/manifests/latest  | awk '/Docker-Content-Digest/{print $NF}'