0
votes

Below are steps to reproduce the issue.

docker --version

Docker version 17.09.1-ce, build 19e2cf6

docker images | grep centos

centos latest 3fa822599e10 3 weeks ago 204MB

docker tag centos:latest 127.0.0.1:5000/centos

docker push 127.0.0.1:5000/centos

The push refers to a repository [127.0.0.1:5000/centos]

d1be66a59bc5: Pushed

latest: digest: sha256:3a32a170c945ffe18334b3f514fcb66f9c14001b2266c9ed8504c72db0acde11 size: 529

docker ps

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES

046a5d68c8b2 registry:2 "/entrypoint.sh /e..." About an hour ago Up About an hour 0.0.0.0:5000->5000/tcp festive_wozniak

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

{"repositories":["centos"]} -----We can list 'centos' repo after pushing.

docker stop 046a5d68c8b2

046a5d68c8b2

docker run -p 5000:5000 -d registry:2

bad6ec7aad590f91aaf1721703ce6468e8254d159e56a5b5f018e5e3c25cf7e0

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

{"repositories":[]} ---- after restarting registry, we cannot see 'centos' info

1

1 Answers

1
votes

Each docker run creates a new container.

To restart a container you can either run docker start 046a5d68c8b2 (following your example) or use the --restart=always option to docker run.

See:

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