zsyzhou 发表于 2019-2-22 07:55:58

docker部署私有仓库

1.下载仓库镜像

    # docker pull /daocloud.io/registry:latest
2.将宿主机端口映射到容器的端口

    # docker run -d -it -p 5000:5000 daocloud.io/registry
3.查看仓库容器是否添加成功

    # docker ps
或者进入容器查看端口是否运行

    # docker exec -it 容器ID /bin/sh
4.在本机查看能否访问该私有库

    # curl -I 127.0.0.1:5000
5.在上传前需要将镜像做个tag,注明IP和端口

    # docker tag daocloud.io/daocloud/daocloud-toolest 10.18.44.171:5000/mydaocloud:v1
6.向私有仓库上传镜像

    # docker pull 10.18.44.171:5000/mydaocloud:v1
解决问题

如果出现下列问题
  Get https://master.up.com:5000/v1/_ping: http: server gave HTTP response to HTTPS client

    # vim /etc/docker/daemon.json
{ "insecure-registries":["10.18.44.171:5000"] }
  重启docker

    # systemctl restart docker
  启动仓库容器

    # docker start 容器ID
  重新上传

    # docker push 10.18.44.171:5000/my_daocloud:v1
  查看仓库里的镜像

    # curl 10.18.44.171:5000/v2/_catalog


页: [1]
查看完整版本: docker部署私有仓库