本地镜像上传到-Docker Hub Repository

2022年05月12日 阅读数:2
这篇文章主要向大家介绍本地镜像上传到-Docker Hub Repository,主要内容包括基础应用、实用技巧、原理机制等方面,希望对大家有所帮助。



本地镜像上传到-Docker Hub Repository


本地Docker,根据Dockerfile制做好镜像好,能够上传到本身的Docker Hub Repositoryjavascript

1.环境准备

1.1安装好Docker,配置registry-mirrors是为了加速;​insecure-registries不须要配置

本地镜像上传到-Docker Hub Repository_docker

1.2 在Docker Hub上注册帐号并建立Repository

在Docker Hub上注册帐号:​​https://hub.docker.com​​​,并建立Repositoryjava

本地镜像上传到-Docker Hub Repository_docker_02

2. 制做镜像或者给镜像打tag

2.1 方式一,将现有镜像从新作tag

#语法说明 docker tag local-image:tagname new-repo:tagname
#语法说明 docker push new-repo:tagname

#实践,作tag
docker tag shl/tomcat8-5-cst:latest freddyshen/tomcat8-5-cst:latest
#实践,push镜像到docker hub repository
sai:~ ws$ docker push freddyshen/tomcat8-5-cst:latest
The push refers to repository [docker.io/freddyshen/tomcat8-5-cst]
6bf9758f43ad: Pushed
b925682fc3ed: Pushed
306258d1d538: Pushed
20df9d3d8e33: Pushed
d5b577ed85de: Pushed
e3d23368cb84: Pushed
5f70bf18a086: Mounted from anttiviljami/sftp-upload-http-api
4c9baa5f0a5a: Pushed
e4268ed32681: Pushed
8e1a65386432: Pushed
75619f724f08: Pushed
f321c8875327: Pushed
bbae598a0cda: Pushed
a8f626915068: Pushed
8d62e81b0366: Pushed
82c5ac32ba93: Pushed
981d8fe4c001: Pushed
daaf8d1e20cc: Pushed
latest: digest: sha256:6bd98487fbb2637eb2157b7b70920c280997c0f34cb0e9b09aceebcc2f6fc5e3 size: 4688

2.2 方式二,根据Dockerfile制做镜像

见前面一篇文章…​​根据Dockerfile制做镜像​docker

注意镜像的名称:​new-repo:tagnameapi

例如个人帐号freddyshen,个人仓库名称tomcat8-5-cst,组合是:freddyshen/tomcat8-5-cst:tagnametomcat

最后push:ide

docker push freddyshen/tomcat8-5-cst:latest

3.在Docker Hub查看结果

本地镜像上传到-Docker Hub Repository_docker_03

4. Enjoy it.