Docker系列~將映象推送到DockerHub(七)
阿新 • • 發佈:2018-12-26
向Docker Hub上推送必須要在該網站上進行註冊,在需要推送的機器上使用下面的命令進行登入。Docker login進行登入:
- [[email protected]-10-63-106 ~]# docker
login
- Username: frank
- Password:
- Email: [email protected].com
- Login Succeeded
登入的認證資訊存放在.dockercfg
[[email protected] ~]# cat .dockercfg
{"https://index.docker.io/v1/":{"auth":"ZnJhbmt6Zno6NjY0MzUwMTE=","email":" [email protected]"}}
推送到Docker Hub上的映象必須按照下面的格式進行:/,使用docker images命令檢視本地的docker映象,如果當初命名的映象名字不是按照上面的規則進行的,則可以使用docker tag 新增新增自己的名字。
- [[email protected]-10-63-106 ~]# docker
images
- REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
- frankzfz/complie-kernel v1 d157772a9d3c 9 days ago 1.747 GB
- centos6.3-
- [[email protected]-10-63-106 ~]#docker
tag centos6.3-base frankzfz/centos6.3-base
- [[email protected]-10-63-106 ~]# docker
images
- REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
- frankzfz/complie-kernel v1 d157772a9d3c 9 days ago 1.747 GB
- centos6.3-base latest a8fe6b2d8f23 9 days ago 724.
- frankzfz/centos6.3-base latest a8fe6b2d8f23 9 days ago 724.6 MB
使用docker push進行推送,如果推送成功後,可以看到下面的資訊
- [[email protected]-10-63-106 ~]# docker
push frankzfz/centos6.3-base:latest
- The push refers to a repository [frankzfz/centos6.3-base] (len: 1)
- Sending image list
- Pushing repository frankzfz/centos6.3-base (1 tags)
- a8fe6b2d8f23: Image already pushed, skipping
- Pushing tag for rev [a8fe6b2d8f23] on {https://cdn-registry-1.docker.io/v1/repositories/frankzfz/centos6.3-base/tags/latest}
上面把基礎映象推送到Docker Hub上,如果是使用Dockerfile進行build的images也可以使用同樣的方法進行推送,但是在推送之前必須把使用該映象的容器stop,然後才能推送成功,一開始沒有停止容器,始終不能成功的把映象推送到Docker Hub上
點選(此處)摺疊或開啟
- docker push frankzfz/complie-kernel:v1
- The push refers to a repository [frankzfz/complie-kernel] (len: 1)
- Sending image list
- Pushing repository frankzfz/complie-kernel (1 tags)
- a8fe6b2d8f23: Image already pushed, skipping
- 3317841922a1: Image already pushed, skipping
- 1922df6f140f: Pushing [==================================================>] 652.8
MB/652.8 MB
- 2015/03/11 19:50:38
但是也並沒有提示任何的錯誤資訊,推送成功後的正確資訊如下:
點選(此處)摺疊或開啟
- [[email protected]-10-63-106 ~]# docker
push frankzfz/complie-kernel:v1
- The push refers to a repository [frankzfz/complie-kernel] (len: 1)
- Sending image list
- Pushing repository frankzfz/complie-kernel (1 tags)
- a8fe6b2d8f23: Image already pushed, skipping
- 3317841922a1: Image already pushed, skipping
- 1922df6f140f: Image successfully pushed
- fb9bd8bb39d0: Image successfully pushed
- b4657c91837b: Image successfully pushed
- ac088768389c: Image successfully pushed
- 4cecba576ec9: Image successfully pushed
- 2bba67df2882: Image successfully pushed
- 5c664d95439d: Image successfully pushed
- a6c6c1776843: Image successfully pushed
- 71c24758ec01: Image successfully pushed
- b1e1803ae471: Image successfully pushed
- 05ef73a94126: Image successfully pushed
- 3239ca21052e: Image successfully pushed
- 40661c45e523: Image successfully pushed
- d157772a9d3c: Image successfully pushed
- Pushing tag for rev [d157772a9d3c] on {https://cdn-registry-1.docker.io/v1/repositories/frankzfz/complie-kernel/tags/v1}