`
dbp_cn
  • 浏览: 81923 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

docker仓库使用简介

阅读更多

1.docker 登陆后 push镜像到docker hub 中遇到unauthorized authentication required问题,

镜像分公有和私有,你pull的镜像是公有镜像,由docker hub来维护,那个地址对你来说只能做pull操作,不能做push操作,所以会提示没有权限。
你要push到你自己的镜像库中去。先要用tag修改下镜像的名字,也就是docker tag hello-world your_namespace/hello-world
docker push your_namespace/hello-world.
比如我的hub的repo名为billdan, 并新新建了一个hello-world镜像则需要如下操作:
docker tag hello-world billdan/hello-world
docker push billdan/hello-world
2.新建自己的仓库:
sudo docker run -d -p 5000:5000 -v /apps/myRegistry:/tmp/registry --name localRegistry registry
推送本地镜像:
    1) 给镜像重置repository: sudo docker tag docker.io/alpine 172.31.50.39:5000/alpine
     2) 上传镜像:sudo docker push 172.31.50.39:5000/alpine
 
3. 查询私有仓库包含哪些镜像:
VirtualBox:~$ curl -X GET http://172.31.50.39:5000/v2/_catalog
{"repositories":["alpine","redis"]}
 从上面命令可以看到仓库含有两个镜像:alpine 和redis
查询某一镜像包含哪些tag:
VirtualBox:~$ curl -X GET http://172.31.50.39:5000/v2/redis/tags/list
{"name":"redis","tags":["alpine"]}
 本例查询镜像redis的tag
 
   

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics