dockerHub镜像仓库的使用

本文涉及的产品
容器镜像服务 ACR,镜像仓库100个 不限时长
简介: dockerHub镜像仓库的使用

dockerHub镜像仓库

注册账号

官网:https://hub.docker.com/


登录账号

通过 docker login 命令输入账号密码登录 DockerHub

[root@centos8 dockerfile]# docker login 
Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one.
Username: flippedxyy
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@centos8 dockerfile]# 

推送镜像至仓库

先给镜像设置标签

再将镜像推送至仓库

docker tag local-image:tagname new-repo:tagname
docker push new-repo:tagname 

如果没有指定TAG,那么默认为latest,镜像名必须全小写

[root@centos8 dockerfile]# docker tag hello-world:latest flippedxyy/my_hello_world
[root@centos8 dockerfile]# docker tag hello-world:latest flippedxyy/my_hello_world:1.0
[root@centos8 dockerfile]# docker images
REPOSITORY                  TAG       IMAGE ID       CREATED        SIZE
flippedxyy/my_hello_world   1.0       feb5d9fea6a5   3 weeks ago    13.3kB
flippedxyy/my_hello_world   latest    feb5d9fea6a5   3 weeks ago    13.3kB
hello-world                 latest    feb5d9fea6a5   3 weeks ago    13.3kB
[root@centos8 dockerfile]# docker push flippedxyy/my_hello_world
Using default tag: latest
The push refers to repository [docker.io/flippedxyy/my_hello_world]
e07ee1baac5f: Mounted from flippedxyy/test_hello_world 
latest: digest: sha256:f54a58bc1aac5ea1a25d796ae155dc228b3f0e11d046ae276b39c4bf2f13d8c4 size: 525
[root@centos8 dockerfile]# docker push flippedxyy/my_hello_world:1.0 
The push refers to repository [docker.io/flippedxyy/my_hello_world]
e07ee1baac5f: Layer already exists 
1.0: digest: sha256:f54a58bc1aac5ea1a25d796ae155dc228b3f0e11d046ae276b39c4bf2f13d8c4 size: 525
[root@centos8 dockerfile]#

查看仓库


拉取镜像

通过 docker pull xxxx/test-hello-world 测试镜像是否可以拉取

[root@centos8 dockerfile]# docker rmi flippedxyy/my_hello_world:latest flippedxyy/my_hello_world:1.0 
Untagged: flippedxyy/my_hello_world:latest
Untagged: flippedxyy/my_hello_world:1.0
Untagged: flippedxyy/my_hello_world@sha256:f54a58bc1aac5ea1a25d796ae155dc228b3f0e11d046ae276b39c4bf2f13d8c4
[root@centos8 dockerfile]# docker pull flippedxyy/my_hello_world
Using default tag: latest
latest: Pulling from flippedxyy/my_hello_world
Digest: sha256:f54a58bc1aac5ea1a25d796ae155dc228b3f0e11d046ae276b39c4bf2f13d8c4
Status: Downloaded newer image for flippedxyy/my_hello_world:latest
docker.io/flippedxyy/my_hello_world:latest
[root@centos8 dockerfile]# docker pull flippedxyy/my_hello_world:1.0
1.0: Pulling from flippedxyy/my_hello_world
Digest: sha256:f54a58bc1aac5ea1a25d796ae155dc228b3f0e11d046ae276b39c4bf2f13d8c4
Status: Downloaded newer image for flippedxyy/my_hello_world:1.0
docker.io/flippedxyy/my_hello_world:1.0
[root@centos8 dockerfile]# docker images
REPOSITORY                  TAG       IMAGE ID       CREATED        SIZE
flippedxyy/my_hello_world   1.0       feb5d9fea6a5   3 weeks ago    13.3kB
flippedxyy/my_hello_world   latest    feb5d9fea6a5   3 weeks ago    13.3kB
hello-world                 latest    feb5d9fea6a5   3 weeks ago    13.3kB
[root@centos8 dockerfile]# 

退出账号

docker logout

[root@centos8 dockerfile]# docker logout 
Removing login credentials for https://index.docker.io/v1/


相关实践学习
通过容器镜像仓库与容器服务快速部署spring-hello应用
本教程主要讲述如何将本地Java代码程序上传并在云端以容器化的构建、传输和运行。
Kubernetes极速入门
Kubernetes(K8S)是Google在2014年发布的一个开源项目,用于自动化容器化应用程序的部署、扩展和管理。Kubernetes通常结合docker容器工作,并且整合多个运行着docker容器的主机集群。 本课程从Kubernetes的简介、功能、架构,集群的概念、工具及部署等各个方面进行了详细的讲解及展示,通过对本课程的学习,可以对Kubernetes有一个较为全面的认识,并初步掌握Kubernetes相关的安装部署及使用技巧。本课程由黑马程序员提供。   相关的阿里云产品:容器服务 ACK 容器服务 Kubernetes 版(简称 ACK)提供高性能可伸缩的容器应用管理能力,支持企业级容器化应用的全生命周期管理。整合阿里云虚拟化、存储、网络和安全能力,打造云端最佳容器化应用运行环境。 了解产品详情: https://www.aliyun.com/product/kubernetes
目录
相关文章
|
JSON 安全 应用服务中间件
docker <应用分享> 上传镜像到 私有仓库 / 本地仓库,从私库拉取镜像
前两篇博客写了docker上传镜像到dockerhub,以及上传镜像到阿里云仓库。感兴趣的可以点下面链接
|
3月前
|
运维 Linux Docker
安装Harbor镜像仓库
本文介绍了如何在Linux系统上安装和配置Harbor镜像仓库。首先通过阿里云镜像源安装Docker,然后下载并解压Harbor离线安装包。配置Harbor服务的相关参数。最后,通过运行安装脚本完成Harbor的安装,并进行基本的测试,包括登录、构建和推送Docker镜像。文章还提供了相关资源链接,方便读者进一步了解和学习。
206 2
|
应用服务中间件 虚拟化 数据安全/隐私保护
|
消息中间件 NoSQL 安全
docker公共镜像仓库Docker-hub&私有化仓库harbor
1.docker公共镜像仓库Docker-hub的使用:推送、拉取镜像到个人仓库; 2.私有化仓库harbor的搭建及使用过程:推送、拉取镜像到harbor;
docker公共镜像仓库Docker-hub&私有化仓库harbor
|
Docker 容器 数据安全/隐私保护
Docker-在Harbor镜像仓库上推拉镜像
  之前搭建好了docker和harbor,现在就可以在harbor上进行镜像管理了。 环境准备   两台机器,物理机、虚拟机不限,分别作为docker镜像仓库和客户端。
4543 0
|
存储 数据库 Docker
Docker Hub和镜像仓库
Docker Hub 是 Docker 公司提供的官方公共 Docker 镜像注册表,允许用户存储、分享和获取 Docker 镜像。在 Docker Hub 上,你可以找到许多官方和社区维护的 Docker 镜像,这些镜像涵盖了各种常见的应用程序和服务,如数据库、Web 服务器、应用程序框架等。
5537 0
|
9月前
|
存储 Docker 容器
Docker Hub 镜像仓库
前言 Docker Hub 是 Docker 公司提供的官方公共 Docker 镜像注册表,允许用户存储、分享和获取 Docker 镜像。在 Docker Hub 上,你可以找到许多官方和社区维护的 Docker 镜像。 搜索镜像 登录后,你可以使用 Docker Hub 的搜索功能来查找感兴趣的镜像。你可以在搜索栏中输入关键词,然后浏览结果。 创建存储库 注册或登录到 Docker Hub,选择“创建存储库”按钮,选择公有库或者私有库。
8425 1
|
7月前
|
Kubernetes 算法框架/工具 Docker
k8s拉取harbor仓库镜像
k8s拉取harbor仓库镜像
351 5
|
9月前
|
存储 安全 数据库
搭建Harbor镜像仓库
搭建Harbor镜像仓库
379 2
|
Docker 容器
docker使用阿里云镜像仓库
docker使用阿里云镜像仓库1:阿里云docker仓库 https://dev.aliyun.com/search.html 2:进去注册帐号后,点击自己的管理中心。 3:在管理中心点击加速器,右边面板会有你的加速地址,右边面板下面有详细设置步骤。
38947 1

热门文章

最新文章