Docker Hub 虽然方便,但还是有些限制,比如
    1、需要Internet连接,上传下载速度慢
    2、上传到Docker Hub上的公共镜像任何人都能访问,私有Registry需要收费
    3、出于安全原因很多公司不允许将镜像放到外网
 
最简单的解决方案就是搭建本地Registry(Registry也支持认证和https加密,这里不做讲解)
 
root@docker-lab:~/020# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
root@docker-lab:~/020# docker build -t test020 .    #    构建一个用于测试上传下载的镜像
Sending build context to Docker daemon  2.048kB
Step 1/2 : FROM busybox
latest: Pulling from library/busybox
57c14dd66db0: Pull complete
Digest: sha256:b6e640a3768c460ad6066a003b6da52034c31aaf8500f9263057ddffcd830ef6
Status: Downloaded newer image for busybox:latest
---> 3a093384ac30
Step 2/2 : CMD echo "Hello www1707"
---> Running in d0817c08cb82
Removing intermediate container d0817c08cb82
---> d93c942a1584
Successfully built d93c942a1584
Successfully tagged test020:latest
root@docker-lab:~/020# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED              SIZE
test020             latest              d93c942a1584        About a minute ago   1.2MB
busybox             latest              3a093384ac30        12 days ago          1.2MB
root@docker-lab:~/020# docker run -d -p 5000:5000 -v /myregistry:/var/lib/registry registry:2Unable to find image 'registry:2' locally    #    运行本地Registry容器
2: Pulling from library/registry
cd784148e348: Pull complete
0ecb9b11388e: Pull complete
918b3ddb9613: Pull complete
5aa847785533: Pull complete
adee6f546269: Pull complete
Digest: sha256:1cd9409a311350c3072fe510b52046f104416376c126a479cef9a4dfe692cf57
Status: Downloaded newer image for registry:2
f9e7d22e21d6e0c03b146a3e2100c135c14203308c4323b0673c45eaea97030d
root@docker-lab:~/020# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED              SIZE
test020             latest              d93c942a1584        About a minute ago   1.2MB
registry            2                   33fbbf4a24e5        9 days ago           24.2MB
busybox             latest              3a093384ac30        12 days ago          1.2MB
root@docker-lab:~/020# docker tag test020:latest 127.0.0.1:5000/www1707/test020:v1    #    为上传镜像打tag
root@docker-lab:~/020# docker images
REPOSITORY                       TAG                 IMAGE ID            CREATED             SIZE
127.0.0.1:5000/www1707/test020   v1                  d93c942a1584        3 minutes ago       1.2MB
test020                          latest              d93c942a1584        3 minutes ago       1.2MB
registry                         2                   33fbbf4a24e5        9 days ago          24.2MB
busybox                          latest              3a093384ac30        12 days ago         1.2MB
root@docker-lab:~/020# docker push 127.0.0.1:5000/www1707/test020:v1    #    上传镜像
The push refers to repository [127.0.0.1:5000/www1707/test020]
683f499823be: Pushed
v1: digest: sha256:b3d65da9455ca71f2bc2d2e1343a1ad1058829b027eee576976becc5ecdce8af size: 527
root@docker-lab:~/020# docker rmi 127.0.0.1:5000/www1707/test020:v1    #    删掉本地镜像
Untagged: 127.0.0.1:5000/www1707/test020:v1
Untagged: 127.0.0.1:5000/www1707/test020@sha256:b3d65da9455ca71f2bc2d2e1343a1ad1058829b027eee576976becc5ecdce8af
root@docker-lab:~/020# docker rmi test020:latest
Untagged: test020:latest
Deleted: sha256:d93c942a158487248506ac545d33f6fc27c7af29960a5b139e2ef4510b39f37b
root@docker-lab:~/020# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
registry            2                   33fbbf4a24e5        9 days ago          24.2MB
busybox             latest              3a093384ac30        12 days ago         1.2MB
root@docker-lab:~/020# docker pull 127.0.0.1:5000/www1707/test020:v1    #    下载镜像测试
v1: Pulling from www1707/test020
57c14dd66db0: Already exists
Digest: sha256:b3d65da9455ca71f2bc2d2e1343a1ad1058829b027eee576976becc5ecdce8af
Status: Downloaded newer image for 127.0.0.1:5000/www1707/test020:v1
root@docker-lab:~/020# docker images
REPOSITORY                       TAG                 IMAGE ID            CREATED             SIZE
127.0.0.1:5000/www1707/test020   v1                  d93c942a1584        4 minutes ago       1.2MB
registry                         2                   33fbbf4a24e5        9 days ago          24.2MB
busybox                          latest              3a093384ac30        12 days ago         1.2MB
 
 

最新文章

  1. Newtonsoft.Json异常处理
  2. LeetCode之412. Fizz Buzz
  3. 1.0 UIApplication对象
  4. Some About Spring
  5. 开始进入Windows Phone 8开发
  6. J2SE知识点摘记-数据库(二)
  7. hdu 4349 Xiao Ming's Hope lucas
  8. Servlet转发和重定向的区别
  9. nginx根据条件跳转+跳转规则
  10. 转:Loadrunner上传文件解决办法(大文件)
  11. HighCharts之2D数值带有百分数的面积图
  12. SA SD SE 区别
  13. python day10 函数(第二篇)
  14. 994.Contiguous Array 邻近数组
  15. ubuntu 中文变成小方框 口
  16. svn服务器的搭建备份和还原和svnmanager的使用
  17. Python 总结一
  18. Oracle中Clob类型处理解析 (转)
  19. CF734F Anton and School (构造)
  20. Redis 复制原理及分析

热门文章

  1. Windows系统下在Git Bash中把文件内容复制到剪贴板的命令
  2. Hdoj 1160.FatMouse's Speed 题解
  3. linux中shell脚本引用另一shell脚本
  4. ⌈洛谷1312⌋⌈NOIP提高组2011⌋Mayan游戏【搜索】
  5. linux(fedora) 第三课
  6. 简单两步 ~ 绕过 "Paused in debugger"
  7. Unable to load script from assets 'index.android.bundle'.make sure you bundle is packaged correctly
  8. C语言进阶--Day2
  9. prototype 与 proto的关系是什么:
  10. appium desktop 1.7 byName不能用,重写