美文网首页
docker系列2: 自建docker仓库

docker系列2: 自建docker仓库

作者: Andy_1ee | 来源:发表于2020-12-28 20:53 被阅读0次

    有些时候为了使用方便,我们需要自己手动搭建自己的docker仓库,搭建docker仓库的方法比较简单
    在准备作为docker仓库的机器上安装好docker,将docker换源

    # 拉取仓库镜像
    docker pull registry
    # 运行仓库
    docker run -d -v /registry:/var/lib/registry -p 10000:5000 --restart=always --privileged=true --name registry image_id
    # 查看自己的docker仓库
    docker ps
    

    使用上述方式就可以轻松的搭建出属于自己的docker仓库

    docker pull first_image
    docker tag first_image dockerhost:10000/first_image
    docker push dockerhost:10000/first_image
    

    使用此方式搭建仓库后, 我们在客户端制作好镜像后push时会报错, 这是因为默认docker客户端使用的是https请求, 我们需要将客户端也设置为http请求

    # 客户端配置
    vim /etc/docker/daemon.json
    # 增加以下配置
    "insecure-registries":["192.168.1.100:10000"]
    

    重启客户端docker服务

    systemctl daemon-reload
    systemctl restart docker
    

    相关文章

      网友评论

          本文标题:docker系列2: 自建docker仓库

          本文链接:https://www.haomeiwen.com/subject/mfjpnktx.html