🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
## 一、概述 Docker官方维护了一个DockerHub的公共仓库,里边包含有很多平时用的较多的镜像。除了从上边下载镜像之外,我们也可以将自己自定义的镜像发布(push)到DockerHub上,实现镜像的复用和共享; > 首先需要获得一个DockerHub(https://hub.docker.com)的账号密码; ## 二、仓库操作 登录仓库:docker login,输入你的用户名、密码即可登录成功; 退出仓库:docker logout 搜索镜像:docker search ${imagename} ,查找官方仓库中的镜像 拉取镜像:docker pull ${imagenameorid},从官方仓库拉镜像下载到本地; 打上标签:docker tag ${imageId} 你的用户名/${imageId};如果不这么做,推送会失败; 推送镜像:docker push ${imageId} ## 三、实战 登录仓库: ![](https://img.kancloud.cn/0a/4f/0a4f0c2ff342e49b32131554b080de8f_1050x168.png) 退出仓库: ![](https://img.kancloud.cn/b9/fe/b9fe5330f1049bb0b7f3f7c6af469d3d_1055x64.png) 索索镜像: ![](https://img.kancloud.cn/2a/88/2a886db47e3e49117601e913c1e166ef_1051x428.png) 拉取镜像: ![](https://img.kancloud.cn/03/f9/03f924f671db4a8dda766c0d762395f4_1050x155.png) 查看镜像: ![](https://img.kancloud.cn/e7/17/e7174a288169e96253f45f27aca63c48_1052x90.png) 打标签和推送镜像: ![](https://img.kancloud.cn/9e/f0/9ef0bf393171c38d2f1dbf0a8a070849_1047x213.png) ![](https://img.kancloud.cn/d9/f9/d9f9f2235610f3de42cff4f64d341871_1051x234.png) ![](https://img.kancloud.cn/65/be/65beca5069c91100e24c132b6842c64d_1366x625.png) 拉取刚才推送的镜像: ![](https://img.kancloud.cn/6d/f1/6df1231257d4ea28c8cf9ef371fdfe9d_1366x657.png) ![](https://img.kancloud.cn/fb/11/fb11054fe3a74d148756b020f91c772a_1051x82.png) ![](https://img.kancloud.cn/49/b6/49b62f2d7c68d40bcc3dfdeb67a65edb_1046x227.png)