docker - 镜像仓库registry

安装容器

# 拉取 registry 镜像
docker pull registry				
# git 上没找到 x86 版本的 tar 包,可以保存一个备用
docker save registry:latest -o registry_x86_latest.tar

# 创建一个数据卷
docker volume create registry_data

# 运行镜像
docker run -d -p 5000:5000 --restart=always -v registry_data:/var/lib/registry --name registry registry

# docker tag 镜像ID 镜像仓库地址/目标镜像名:[标签名]
docker tag hello-world:latest localhost:5000/hello-world:1.0.0

# docker push 镜像仓库地址/目标镜像名:[标签名]
docker push localhost:5000/hello-world:1.0.0

# 拉取镜像
docker pull localhost:5000/hello-world:1.0.0

# 做到这里,已经基本满足使用了,
# 后续还有添加证书、配置域名、用户认证等,暂时没这方面需求,就写到这了。

查看仓库


# 查看所有镜像
curl -X GET http://localhost:5000/v2/_catalog
curl -u [username]:[password] http://localhost:5000/v2/_catalog

# 查看特定镜像的所有标签
curl -X GET http://localhost:5000/v2/[image-name]/tags/list

# 删除特定镜像的特定标签
curl -X DELETE http://localhost:5000/v2/[image-name]/manifests/[tag]

posted on 2024-05-20 21:31  疯狂的妞妞  阅读(7)  评论(0编辑  收藏  举报

导航