当前位置:   article > 正文

四、本地镜像发布到阿里云

四、本地镜像发布到阿里云

目录

一、本地镜像发布到阿里云流程图

二、镜像的生成方法

三、将本地镜像推送到阿里云


一、本地镜像发布到阿里云流程图

二、镜像的生成方法

1、第三章使用的 commit 方法

2、Dockerfile的方法,后续讲解

三、将本地镜像推送到阿里云

1、登录阿里云

2、选择控制台,进入容器镜像服务

3、选择个人实例

4、创建命名空间

5、创建镜像仓库

 

 

 

6、将本地镜像推送到阿里云

  1. [root@localhost ~]# docker images
  2. REPOSITORY TAG IMAGE ID CREATED SIZE
  3. wu/ubuntu 1.1 a32a52da6413 20 hours ago 177MB
  4. wu/ubuntu latest 9fd000d64b52 46 hours ago 72.8MB
  5. redis latest 7614ae9453d1 2 years ago 113MB
  6. ubuntu latest ba6acccedd29 2 years ago 72.8MB
  7. hello-world latest feb5d9fea6a5 2 years ago 13.3kB
  8. [root@localhost ~]#
  9. [root@localhost ~]# docker login --username=aliyun9421012936 registry.cn-hangzhou.aliyuncs.com
  10. Password:
  11. WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
  12. Configure a credential helper to remove this warning. See
  13. https://docs.docker.com/engine/reference/commandline/login/#credentials-store
  14. Login Succeeded
  15. [root@localhost ~]#
  16. [root@localhost ~]# docker tag a32a52da6413 registry.cn-hangzhou.aliyuncs.com/wuzhaobo_test/myubuntu:1.1
  17. [root@localhost ~]#
  18. [root@localhost ~]# docker push registry.cn-hangzhou.aliyuncs.com/wuzhaobo_test/myubuntu:1.1
  19. The push refers to repository [registry.cn-hangzhou.aliyuncs.com/wuzhaobo_test/myubuntu]
  20. fd9600ce66a0: Pushed
  21. fcdbee711a3d: Pushed
  22. 1.1: digest: sha256:2ffb01e77cbd8c65ab27417a8733818fd05f0897de10751c637c392d2219e4b0 size: 741
  23. [root@localhost ~]#
  24. 上传完之后,为了验证,需要把本地的镜像删除,从阿里云拉取测试
  25. [root@localhost ~]# docker images
  26. REPOSITORY TAG IMAGE ID CREATED SIZE
  27. wu/ubuntu 1.1 a32a52da6413 20 hours ago 177MB
  28. registry.cn-hangzhou.aliyuncs.com/wuzhaobo_test/myubuntu 1.1 a32a52da6413 20 hours ago 177MB
  29. wu/ubuntu latest 9fd000d64b52 46 hours ago 72.8MB
  30. redis latest 7614ae9453d1 2 years ago 113MB
  31. ubuntu latest ba6acccedd29 2 years ago 72.8MB
  32. hello-world latest feb5d9fea6a5 2 years ago 13.3kB
  33. [root@localhost ~]#
  34. [root@localhost ~]# docker rmi -f a32a52da6413
  35. Untagged: wu/ubuntu:1.1
  36. Untagged: registry.cn-hangzhou.aliyuncs.com/wuzhaobo_test/myubuntu:1.1
  37. Untagged: registry.cn-hangzhou.aliyuncs.com/wuzhaobo_test/myubuntu@sha256:2ffb01e77cbd8c65ab27417a8733818fd05f0897de10751c637c392d2219e4b0
  38. Deleted: sha256:a32a52da64130f18a01cb0f1a228e87e203fe08738bd651ff616d4c2e564666f
  39. Deleted: sha256:7e6257efdd107305b9c3e816d52e86104601e79c1e32324e55d0560976f75c4a
  40. [root@localhost ~]#
  41. #拉取镜像
  42. [root@localhost ~]# docker pull registry.cn-hangzhou.aliyuncs.com/wuzhaobo_test/myubuntu:1.1
  43. 1.1: Pulling from wuzhaobo_test/myubuntu
  44. 3ad9c1e2849d: Already exists
  45. 2e2e4f44b383: Pull complete
  46. Digest: sha256:2ffb01e77cbd8c65ab27417a8733818fd05f0897de10751c637c392d2219e4b0
  47. Status: Downloaded newer image for registry.cn-hangzhou.aliyuncs.com/wuzhaobo_test/myubuntu:1.1
  48. registry.cn-hangzhou.aliyuncs.com/wuzhaobo_test/myubuntu:1.1
  49. [root@localhost ~]#
  50. [root@localhost ~]# docker images
  51. REPOSITORY TAG IMAGE ID CREATED SIZE
  52. registry.cn-hangzhou.aliyuncs.com/wuzhaobo_test/myubuntu 1.1 a32a52da6413 21 hours ago 177MB
  53. wu/ubuntu latest 9fd000d64b52 46 hours ago 72.8MB
  54. redis latest 7614ae9453d1 2 years ago 113MB
  55. ubuntu latest ba6acccedd29 2 years ago 72.8MB
  56. hello-world latest feb5d9fea6a5 2 years ago 13.3kB
  57. [root@localhost ~]#
  58. [root@localhost ~]# docker run -it a32a52da6413 /bin/bash
  59. root@1f4beccfdf0e:/#
  60. root@1f4beccfdf0e:/# cd /tmp/
  61. root@1f4beccfdf0e:/tmp# vim a.txt
  62. root@1f4beccfdf0e:/tmp#
  63. root@1f4beccfdf0e:/tmp# cat a.txt
  64. this is docker
  65. hello
  66. root@1f4beccfdf0e:/tmp#

 

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Li_阴宅/article/detail/782358
推荐阅读
相关标签
  

闽ICP备14008679号