docker pull registry:latest
mkdir -p /home/docker/registry/
docker run --name registry01 -d --restart=always -v /home/docker/registry/:/var/lib/registry/ -p 6000:5000 registry
因为宿主机的 5000 端口被占用了,所以我就改用了 6000 端口
docker run --name registry01 -d --restart=always -v /home/:/var/lib/registry/ -p 6000:5000 registry
curl http://localhost:6000/v2/_catalog
若能正常访问 registry 接口 _catalog,证明 registry 服务启动成功。
docker login localhost:6000
Username: zzy0209
Password:
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store
Login Succeeded
docker tag am/service_gateway:74a5635 localhost:6000/zzy0209/am/service_gateway:74a5635
docker push localhost:6000/zzy0209/am/service_gateway
curl http://localhost:6000/v2/_catalog
{"repositories":["zzy0209/am/service_gateway"]}
原文:https://www.cnblogs.com/journet/p/12789610.html