当前位置:   article > 正文

Docker发布镜像(DockerHub,阿里云)

Docker发布镜像(DockerHub,阿里云)

目录

1、发布到DockerHub上

2、发布到阿里云镜像服务上

小结


1、发布到DockerHub上

1.地址https://hub.docker.com/注册自己的账号

2.确定这个账号可以登录

3.在服务器上提交自己的镜像

  1. [root@wq test]# docker login --help
  2. Usage: docker login [OPTIONS] [SERVER]
  3. Log in to a registry.
  4. If no server is specified, the default is defined by the daemon.
  5. Options:
  6. -p, --password string Password
  7. --password-stdin Take the password from stdin
  8. -u, --username string Username
  9. #登录成功结果
  10. [root@wq test]# docker login -u skymuxue
  11. Password:
  12. WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
  13. Configure a credential helper to remove this warning. See
  14. https://docs.docker.com/engine/reference/commandline/login/#credentials-store
  15. Login Succeeded

4.登录完毕后就可以提交镜像了,docker push

  1. [root@wq test]# docker images
  2. REPOSITORY TAG IMAGE ID CREATED SIZE
  3. diytomcat latest dfa3156617fc 40 hours ago 893MB
  4. #出现问题如下
  5. #直接push出现拒绝
  6. [root@wq test]# docker push diytomcat
  7. Using default tag: latest
  8. The push refers to repository [docker.io/library/diytomcat]
  9. 5f70bf18a086: Preparing
  10. ba6599e516c6: Preparing
  11. ff45e9332326: Preparing
  12. 5cf43dcf601f: Preparing
  13. d3b0d4081fd0: Preparing
  14. 174f56854903: Waiting
  15. denied: requested access to the resource is denied # 拒绝
  16. #出现不存在
  17. [root@wq test]# docker push skymuxue/diytomcat:1.0
  18. The push refers to repository [docker.io/skymuxue/diytomcat]
  19. An image does not exist locally with the tag: skymuxue/diytomcat
  20. #解决方法 添加一个tag标签
  21. [root@wq test]# docker tag dfa3156617fc skymuxue/tomcat:1.0
  22. [root@wq test]# docker images
  23. REPOSITORY TAG IMAGE ID CREATED SIZE
  24. diytomcat latest dfa3156617fc 40 hours ago 893MB
  25. skymuxue/tomcat 1.0 dfa3156617fc 40 hours ago 893MB
  26. #docker push上去即可!自己发布的镜像尽量带上版本号
  27. [root@wq test]# docker push skymuxue/tomcat:1.0
  28. The push refers to repository [docker.io/skymuxue/tomcat]
  29. 5f70bf18a086: Pushed
  30. ba6599e516c6: Pushing [============================> ] 171.3MB/296.9MB
  31. ff45e9332326: Pushed
  32. 5cf43dcf601f: Pushing [===============================> ] 240.2MB/376.1MB
  33. d3b0d4081fd0: Pushed
  34. 174f56854903: Pushed


2、发布到阿里云镜像服务上

1.登录阿里云,地址阿里云-计算,为了无法计算的价值 (aliyun.com)

2.找到容器镜像服务

打开容器镜像服务

创建个人实例

设置密码

3.创建命名空间

4.创建容器镜像

5.浏览阿里云

点击上一步创建的镜像仓库,参考官方文档

小结

save可以打成一个tar包,方便使用

  1. [root@wq ~]# docker save --help
  2. Usage: docker save [OPTIONS] IMAGE [IMAGE...]
  3. Save one or more images to a tar archive (streamed to STDOUT by default)
  4. Aliases:
  5. docker image save, docker save
  6. Options:
  7. -o, --output string Write to a file, instead of STDOUT

load可以将压缩的镜像文件进行解压,直接使用

  1. [root@wq ~]# docker load --help
  2. Usage: docker load [OPTIONS]
  3. Load an image from a tar archive or STDIN
  4. Aliases:
  5. docker image load, docker load
  6. Options:
  7. -i, --input string Read from tar archive file, instead of STDIN
  8. -q, --quiet Suppress the load output

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

闽ICP备14008679号