美文网首页
使用dockerhub存放镜像

使用dockerhub存放镜像

作者: 明天你好_ee9a | 来源:发表于2020-10-21 11:48 被阅读0次

dockerhub其实跟github一样 一个是镜像托管,一个是代码托管,本文介绍dockerhua存放私有镜像

第一步,当然是注册dockerhub账号啦
打开https://registry.hub.docker.com/

image.png

填写完账号密码后需要邮箱验证,基操了

然后去到

image.png

然后起一个牛逼的名字就可以了


image.png

起好自己的镜像库后,在自己的服务器上登录账号

[root@izuf69nj83ng3r7vgh9pmhz ~]# docker login
Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one.
Username: jinanaav666
Password: 
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store

Login Succeeded

登录成功后做一个小测试

[root@izuf69nj83ng3r7vgh9pmhz ~]# docker pull busybox
Using default tag: latest
latest: Pulling from library/busybox
9758c28807f2: Pull complete 
Digest: sha256:a9286defaba7b3a519d585ba0e37d0b2cbee74ebfe590960b0b1d6a5e97d1e1d
Status: Downloaded newer image for busybox:latest
docker.io/library/busybox:latest
[root@izuf69nj83ng3r7vgh9pmhz ~]# docker tag busybox:latest jinanaav666/thjupyter:v1.0
[root@izuf69nj83ng3r7vgh9pmhz ~]# docker push jinanaav666/thjupyter:v1.0
The push refers to repository [docker.io/jinanaav666/thjupyter]
d2421964bad1: Pushed 
v1.0: digest: sha256:c9249fdf56138f0d929e2080ae98ee9cb2946f71498fc1484288e6a935b5e5bc size: 527

这个时候注意打tag的格式
\color{#FF3030}{docker tag busybox:latest [docker hub用户名]/[docker hub 私有库名字]:tagname}
例如我的就是 docker tag busybox:latest jinanav666/thjupyter:v1.0
jinanav666 是我的账号名
thjupyter 就是镜像名
v1.0 当然就是tagname了
查看dockerhub

image.png
完成

相关文章

网友评论

      本文标题:使用dockerhub存放镜像

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