有時(shí)候想要保存自己的docker鏡像,又不想自己搭建docker registry,那么就可以了借用DockerHub來用,一般不會(huì)有多少人在意你的鏡像,不過萬一被人看上了呢,這誰說的準(zhǔn)呢,廢話不多說,下面來看看操刀記錄
- 在DockerHub上創(chuàng)建賬號(hào):https://hub.docker.com/
這里我的賬號(hào)是firewarm - 本地下載鏡像(這里拿alpine做示例),并為鏡像打tag
[root@host-30 ~]# docker pull alpine:3.4
[root@host-30 ~]# docker tag alpine:3.4 firewarm/alpine:3.4
- 登錄到DockerHub上
[root@host-30 ~]# docker login
# 輸入用戶名和密碼
- push鏡像到DockerHub上
[root@host-30 ~]# docker push firewarm/alpine:3.4
The push refers to a repository [docker.io/firewarm/alpine]
4fe15f8d0ae6: Pushed
3.4: digest: sha256:dc89ce8401da81f24f7ba3f0ab2914ed9013608bdba0b7e7e5d964817067dc06 size: 528
- 打完收工