Docker Hub镜像公共仓库使用

简介: 这篇文章介绍了如何使用Docker Hub公共仓库进行镜像的创建、上传、下载和管理。

作者:尹正杰
版权声明:原创作品,谢绝转载!否则将追究法律责任。

一.登录Docker Hub

1>.访问Docker Hub官网(https://hub.docker.com/)****

2>.点击“Create Repository”(自行注册一下docker hub官网的id,大约不到2分钟就能搞定)**

3>.填写创建仓库的相关信息后,并点击"Create"**

4>.镜像仓库创建成功

二.上传镜像到Docker Hub

1>.在命令中中登录Docker Hub

[root@docker101.yinzhengjie.org.cn ~]# docker login -u yinzhengjie2019
Password: 
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store
Login Succeeded
[root@docker101.yinzhengjie.org.cn ~]#

  如下图所示,登录成功可以看到docker的镜像仓库地址。

2>.对本地镜像打tag编号

[root@docker101.yinzhengjie.org.cn ~]# docker image ls
REPOSITORY                                                TAG                   IMAGE ID            CREATED             SIZE
centos-haproxy                                            v1.8.20               1858fe05d96f        5 hours ago         606MB
tomcat-app01                                              v0.1                  bf45c22f2d5b        24 hours ago        983MB
tomcat-base                                               8.5.50                9ff79f369094        2 days ago          968MB
jdk-base                                                  1.8.0_231             0f63a97ddc85        2 days ago          953MB
centos-base                                               7.6.1810              b4931fd9ace2        2 days ago          551MB
centos                                                    centos7.6.1810        f1cb7c7d58b7        10 months ago       202MB
registry.cn-beijing.aliyuncs.com/yinzhengjie2020/centos   v0.1_centos7.6.1810   f1cb7c7d58b7        10 months ago       202MB
[root@docker101.yinzhengjie.org.cn ~]# 
[root@docker101.yinzhengjie.org.cn ~]# docker image tag centos:centos7.6.1810 yinzhengjie2019/centos:v0.1_centos7.6.1810
[root@docker101.yinzhengjie.org.cn ~]# 
[root@docker101.yinzhengjie.org.cn ~]# 
[root@docker101.yinzhengjie.org.cn ~]# docker image ls
REPOSITORY                                                TAG                   IMAGE ID            CREATED             SIZE
centos-haproxy                                            v1.8.20               1858fe05d96f        5 hours ago         606MB
tomcat-app01                                              v0.1                  bf45c22f2d5b        24 hours ago        983MB
tomcat-base                                               8.5.50                9ff79f369094        2 days ago          968MB
jdk-base                                                  1.8.0_231             0f63a97ddc85        2 days ago          953MB
centos-base                                               7.6.1810              b4931fd9ace2        2 days ago          551MB
centos                                                    centos7.6.1810        f1cb7c7d58b7        10 months ago       202MB
yinzhengjie2019/centos                                    v0.1_centos7.6.1810   f1cb7c7d58b7        10 months ago       202MB
registry.cn-beijing.aliyuncs.com/yinzhengjie2020/centos   v0.1_centos7.6.1810   f1cb7c7d58b7        10 months ago       202MB
[root@docker101.yinzhengjie.org.cn ~]# 
[root@docker101.yinzhengjie.org.cn ~]#

3>.将镜像推送到Docker Hub的Registry

[root@docker101.yinzhengjie.org.cn ~]# docker image ls
REPOSITORY                                                TAG                   IMAGE ID            CREATED             SIZE
centos-haproxy                                            v1.8.20               1858fe05d96f        6 hours ago         606MB
tomcat-app01                                              v0.1                  bf45c22f2d5b        24 hours ago        983MB
tomcat-base                                               8.5.50                9ff79f369094        2 days ago          968MB
jdk-base                                                  1.8.0_231             0f63a97ddc85        2 days ago          953MB
centos-base                                               7.6.1810              b4931fd9ace2        2 days ago          551MB
centos                                                    centos7.6.1810        f1cb7c7d58b7        10 months ago       202MB
yinzhengjie2019/centos                                    v0.1_centos7.6.1810   f1cb7c7d58b7        10 months ago       202MB
registry.cn-beijing.aliyuncs.com/yinzhengjie2020/centos   v0.1_centos7.6.1810   f1cb7c7d58b7        10 months ago       202MB
[root@docker101.yinzhengjie.org.cn ~]# 
[root@docker101.yinzhengjie.org.cn ~]# 
[root@docker101.yinzhengjie.org.cn ~]# docker image push yinzhengjie2019/centos:v0.1_centos7.6.1810 
The push refers to repository [docker.io/yinzhengjie2019/centos]
89169d87dbe2: Mounted from library/centos 
v0.1_centos7.6.1810: digest: sha256:747b2de199b6197a26eb1a24d69740d25483995842b2d2f75824095e9d1d19eb size: 529
[root@docker101.yinzhengjie.org.cn ~]#

三.从Docker Hub下载镜像到本地

[root@docker102.yinzhengjie.org.cn ~]# docker image ls
REPOSITORY                                                TAG                   IMAGE ID            CREATED             SIZE
registry.cn-beijing.aliyuncs.com/yinzhengjie2020/centos   v0.1_centos7.6.1810   f1cb7c7d58b7        10 months ago       202MB
[root@docker102.yinzhengjie.org.cn ~]# 
[root@docker102.yinzhengjie.org.cn ~]# docker image pull yinzhengjie2019/centos:v0.1_centos7.6.1810
v0.1_centos7.6.1810: Pulling from yinzhengjie2019/centos
Digest: sha256:747b2de199b6197a26eb1a24d69740d25483995842b2d2f75824095e9d1d19eb
Status: Downloaded newer image for yinzhengjie2019/centos:v0.1_centos7.6.1810
docker.io/yinzhengjie2019/centos:v0.1_centos7.6.1810
[root@docker102.yinzhengjie.org.cn ~]# 
[root@docker102.yinzhengjie.org.cn ~]# 
[root@docker102.yinzhengjie.org.cn ~]# docker image ls
REPOSITORY                                                TAG                   IMAGE ID            CREATED             SIZE
yinzhengjie2019/centos                                    v0.1_centos7.6.1810   f1cb7c7d58b7        10 months ago       202MB
registry.cn-beijing.aliyuncs.com/yinzhengjie2020/centos   v0.1_centos7.6.1810   f1cb7c7d58b7        10 months ago       202MB
[root@docker102.yinzhengjie.org.cn ~]# 
[root@docker102.yinzhengjie.org.cn ~]#

目录
相关文章
|
13天前
|
应用服务中间件 Linux nginx
Docker镜像-手动制作yum版nginx镜像
这篇文章介绍了如何手动制作一个基于CentOS 7.6的Docker镜像,其中包括下载指定版本的CentOS镜像,创建容器,配置阿里云软件源,安装并配置nginx,自定义nginx日志格式和web页面,最后提交镜像并基于该镜像启动新容器的详细步骤。
70 21
Docker镜像-手动制作yum版nginx镜像
|
13天前
|
应用服务中间件 nginx Docker
Docker镜像-基于DockerFile制作编译版nginx镜像
这篇文章介绍了如何基于Dockerfile制作一个编译版的nginx镜像,并提供了详细的步骤和命令。
91 17
Docker镜像-基于DockerFile制作编译版nginx镜像
|
13天前
|
Docker 容器
Docker自建仓库之Harbor高可用部署实战篇
关于如何部署Harbor高可用性的实战教程,涵盖了从单机部署到镜像仓库同步的详细步骤。
48 15
Docker自建仓库之Harbor高可用部署实战篇
|
13天前
|
应用服务中间件 Linux nginx
Docker镜像管理篇
关于Docker镜像管理的教程,涵盖了Docker镜像的基本概念、管理命令以及如何制作Docker镜像等内容。
62 7
Docker镜像管理篇
|
13天前
|
应用服务中间件 Linux nginx
Docker镜像-基于DockerFile制作yum版nginx镜像
本文介绍了如何使用Dockerfile制作一个基于CentOS 7.6.1810的yum版nginx镜像,并提供了详细的步骤和命令。
55 20
|
13天前
|
存储 测试技术 数据安全/隐私保护
Docker自建仓库之Harbor部署实战
关于如何部署和使用Harbor作为Docker企业级私有镜像仓库的详细教程。
32 12
|
13天前
|
运维 数据安全/隐私保护 Docker
Docker自建仓库之Docker Registry部署实战
关于如何使用Docker Registry镜像搭建本地私有Docker仓库的实战教程,包括了下载镜像、创建授权目录和用户名密码、启动Registry容器、验证端口和容器、测试登录仓库、上传和下载镜像的详细步骤。
53 5
|
19天前
|
运维 Ubuntu Shell
掌握Docker容器的创建:从镜像到实例
【8月更文挑战第27天】
81 4
|
17天前
|
物联网 Serverless API
函数计算产品使用问题之怎么部署Docker镜像进行lora训练
函数计算产品作为一种事件驱动的全托管计算服务,让用户能够专注于业务逻辑的编写,而无需关心底层服务器的管理与运维。你可以有效地利用函数计算产品来支撑各类应用场景,从简单的数据处理到复杂的业务逻辑,实现快速、高效、低成本的云上部署与运维。以下是一些关于使用函数计算产品的合集和要点,帮助你更好地理解和应用这一服务。
|
12天前
|
应用服务中间件 nginx 数据安全/隐私保护
使用Harbor搭建Docker私有仓库
Harbor是一款开源的企业级Docker仓库管理工具,分为私有与公有仓库两种类型,其中私有仓库被广泛应用于运维场景。Harbor提供图形化界面,便于直观操作,并且其核心组件均由容器构建而成,因此安装时需预先配置Docker及docker-compose。Harbor支持基于项目的用户与仓库管理,实现细粒度的权限控制;具备镜像复制、日志收集等功能,并可通过UI直接管理镜像,支持审计追踪。部署Harbor涉及配置文件调整、登录认证等步骤,并可通过客户端进行镜像的上传、拉取等操作。系统内置多种角色,包括受限访客、访客、开发者、维护人员及管理员,以满足不同场景下的使用需求。
62 0