为什么不能在重新启动registry后通过web API在本地registry中显示docker repo:v2?

以下是重现该问题的步骤。

docker工人 – 版本

Docker版本17.09.1-ce,build 19e2cf6

docker图片| grep centos

centos最新3fa822599e10 3周前204MB

docker标签centos:最新的127.0.0.1:5000/centos

docker推送127.0.0.1:5000/centos

推送是指一个存储库[127.0.0.1:5000/centos]

d1be66a59bc5:推

最新:摘要:sha256:3a32a170c945ffe18334b3f514fcb66f9c14001b2266c9ed8504c72db0acde11 size:529

docker工人

容器ID图像命令创build状态端口名称

046a5d68c8b2registry:2“/entrypoint.sh/e …”大约一个小时以前Up大约一个小时0.0.0.0:5000->5000/tcp festive_wozniak

curl -X GET http:// localhost:5000 / v2 / _catalog

{“存储库”:[“centos”]} —–我们可以在推送后列出'centos'回购。

docker停止046a5d68c8b2

046a5d68c8b2

docker运行-p 5000:5000 -dregistry:2

bad6ec7aad590f91aaf1721703ce6468e8254d159e56a5b5f018e5e3c25cf7e0

curl -X GET http:// localhost:5000 / v2 / _catalog

{“repositories”:[]} —-重新启动registry后,我们看不到'centos'信息

每个docker运行创build一个新的容器。

要重启一个容器,你可以运行docker start 046a5d68c8b2 (以你的例子为例),或者使用--restart=always选项来运行--restart=always

看到:

https://docs.docker.com/engine/reference/commandline/run/#restart-policies-restart