这个有点类似于composer的仓库地址就是用来存储我们开发人员的镜像地址的;
官网:https://hub.docker.com/
注册账号进行登录
docker login
#根据提示输入用户名和密码
在执行上面的代码可能出现如下异常error response from daemon: Get https://registry-1.docker.io/v2/library/hello-world/manifest
这个问题的异常主要是:
1.解析ip不可用
2.dns域名没有解析
解决:
~yum install bind-utils
~dig @114.114.114.114 registry-1.docker.io
; <<>> DiG 9.11.4-P2-RedHat-9.11.4-9.P2.el7 <<>> @114.114.114.114 registry-1.docker.io
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 57840
;; flags: qr rd ra; QUERY: 1, ANSWER: 8, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;registry-1.docker.io. IN A
;; ANSWER SECTION:
registry-1.docker.io. 33 IN A 34.205.88.205
registry-1.docker.io. 33 IN A 35.169.133.189
registry-1.docker.io. 33 IN A 34.202.247.184
registry-1.docker.io. 33 IN A 3.224.11.4
registry-1.docker.io. 33 IN A 3.82.34.201
registry-1.docker.io. 33 IN A 34.195.36.112
registry-1.docker.io. 33 IN A 3.221.133.86
registry-1.docker.io. 33 IN A 3.224.75.242
;; Query time: 26 msec
;; SERVER: 114.114.114.114#53(114.114.114.114)
;; WHEN: 三 4月 22 04:41:31 CST 2020
;; MSG SIZE rcvd: 177
~vi /etc/hosts
34.205.88.205 registry-1.docker.io
~ systemctl restart docker
注意docker hub的push要求是如下格式
docker push 注册名/镜像名:tag
如果不符合格式指向tag修改
#注意:镜像名称和dockerHub上的一样
docker tag docker.io/openresty/openresty dark68/openresty:v1
#查看
docker images
然后用docker push发布
docker push dark68/openresty:v1
发布成功后查看
然后docker rmi dark68/openresty:v1本地镜像
#重新下载
docker pull dark68/openresty:v1
网友评论