分分钟搞定阿里云私有Docke镜像仓库的搭建_win11登录阿里云私有镜像仓库

在这里插入图片描述
在镜像仓库中可以看到该私有镜像仓库的公网地址跟专有地址,底下也有阿里云提供的详细操作指南。包括可以设置一些子账号的仓库权限。

6.登录阿里云镜像仓库

[root@localhost ~]# sudo docker login --username=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
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/.docker/config.json文件中,之后再登录就不需要密码了,如果要删除密码就可以去/root/.docker/config.json文件中删除。
在这里插入图片描述
7.上传镜像至阿里云私有镜像仓库

  • 7.1 为要上传的镜像选择镜像仓库并打上版本号标签(打标签时选择的镜像仓库如果先前没有在阿里云上创建,那么在上传镜像的时候会自动创建镜像仓库)

sudo docker tag 镜像ID registry.cn-zhangjiakou.aliyuncs.com/命名空间/镜像仓库名称:镜像版本号

[root@localhost ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
mytomcat v1 c0b9a81cd686 5 days ago 639MB

[root@localhost ~]# docker tag c0b9a81cd686 registry.cn-zhangjiakou.aliyuncs.com/lss-docker-images/mytomcat:1.0
//给镜像ID为c0b9a81cd686的镜像打上版本标签,选择上传的镜像仓库名称为mytomcat,版本为1.0

[root@localhost ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
mytomcat v1 c0b9a81cd686 5 days ago 639MB
registry.cn-zhangjiakou.aliyuncs.com/lss-docker-images/mytomcat 1.0 c0b9a81cd686 5 days ago 639MB

  • 7.2 将打好版本号标签的镜像上传至阿里云私有镜像仓库中
    sudo docker push registry.cn-zhangjiakou.aliyuncs.com/命名空间/镜像仓库名称:镜像版本号

[root@localhost ~]# docker push registry.cn-zhangjiakou.aliyuncs.com/lss-docker-images/mytomcat:1.0
//上传版本号为1.0的镜像至镜像仓库名为mytomcat的镜像仓库中
The push refers to repository [registry.cn-zhangjiakou.aliyuncs.com/lss-docker-images/mytomcat]
377b5223baf6: Layer already exists
5f5f84b30131: Layer already exists
2a0b10f7f9ba: Layer already exists
2653d992f4ef: Layer already exists
1.0: digest: sha256:083382b6cc0b5d039c91e99f791bac10dd68e794f776b93e046ae0a14d0e0a16 size: 1166

  • 7.3 再上传一个镜像版本号为2.0的镜像到mytomcat镜像仓库中

[root@localhost ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
mytomcat v1 c0b9a81cd686 5 days ago 639MB
registry.cn-zhangjiakou.aliyuncs.com/lss-docker-images/mytomcat 1.0 c0b9a81cd686 5 days ago 639MB
mycentos 2.0 040f98e77919 6 days ago 291MB

[root@localhost ~]# sudo docker tag 040f98e77919 registry.cn-zhangjiakou.aliyuncs.com/lss-docker-images/mytomcat:2.0
//将镜像ID为040f98e77919的镜像上传至mytomcat镜像仓库中,版本号为2.0

[root@localhost ~]# sudo docker push registry.cn-zhangjiakou.aliyuncs.com/lss-docker-images/mytomcat:2.0
The push refers to repository [registry.cn-zhangjiakou.aliyuncs.com/lss-docker-images/mytomcat]
b49a94a64103: Pushed
88d59513ebbc: Pushed
2653d992f4ef: Layer already exists
2.0: digest: sha256:88025ccfcc439853ecab8f4b5ca7a2f44ca09f180bfc0e8dab983083e9f53ca1 size: 953

8.查看上传的镜像

可以看到我们在上传镜像的时候可以选择将当前要上传的镜像上传至哪一个镜像仓库中,一个镜像仓库可以存放多个不同版本的镜像。
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
可以看到目前mytomcat镜像仓库中已经上传了版本分别为1.0跟2.0的镜像。

9.从阿里云镜像仓库拉取镜像

9.1 因为阿里云镜像仓库中只有之前上传的镜像,所以现在先将本地的这个镜像删除,再从阿里云镜像仓库拉取到本地。

[root@localhost ~]# docker rmi registry.cn-zhangjiakou.aliyuncs.com/lss-docker-images/mytomcat:1.0
//删除标签为版本1.0,镜像仓库为mytomcat的镜像
Untagged: registry.cn-zhangjiakou.aliyuncs.com/lss-docker-images/mytomcat:1.0
Untagged: registry.cn-zhangjiakou.aliyuncs.com/lss-docker-images/mytomcat@sha256:083382b6cc0b5d039c91e99f791bac10dd68e794f776b93e046ae0a14d0e0a16

[root@localhost ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
mytomcat v1 c0b9a81cd686 5 days ago 639MB
registry.cn-zhangjiakou.aliyuncs.com/lss-docker-images/mytomcat 2.0 040f98e77919 6 days ago 291MB
mycentos 2.0 040f98e77919 6 days ago 291MB

  • 9.2 从阿里云镜像仓库拉取镜像
    sudo docker pull registry.cn-zhangjiakou.aliyuncs.com/命名空间/镜像仓库名称:镜像版本号

[root@localhost ~]# sudo docker pull registry.cn-zhangjiakou.aliyuncs.com/lss-docker-images/mytomcat:1.0
//从阿里云镜像仓库mytomcat中拉取版本为1.0的镜像
1.0: Pulling from lss-docker-images/mytomcat
Digest: sha256:083382b6cc0b5d039c91e99f791bac10dd68e794f776b93e046ae0a14d0e0a16
Status: Downloaded newer image for registry.cn-zhangjiakou.aliyuncs.com/lss-docker-images/mytomcat:1.0
registry.cn-zhangjiakou.aliyuncs.com/lss-docker-images/mytomcat:1.0

[root@localhost ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
registry.cn-zhangjiakou.aliyuncs.com/lss-docker-images/mytomcat 1.0 c0b9a81cd686 5 days ago 639MB
mytomcat v1 c0b9a81cd686 5 days ago 639MB
mycentos 2.0 040f98e77919 6 days ago 291MB
registry.cn-zhangjiakou.aliyuncs.com/lss-docker-images/mytomcat 2.0 040f98e77919 6 days ago 291MB

自我介绍一下,小编13年上海交大毕业,曾经在小公司待过,也去过华为、OPPO等大厂,18年进入阿里一直到现在。

深知大多数软件测试工程师,想要提升技能,往往是自己摸索成长或者是报班学习,但对于培训机构动则几千的学费,着实压力不小。自己不成体系的自学效果低效又漫长,而且极易碰到天花板技术停滞不前!

因此收集整理了一份《2024年软件测试全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友,同时减轻大家的负担。
img
img
img
img
img

既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,基本涵盖了95%以上软件测试开发知识点,真正体系化!

由于文件比较大,这里只是将部分目录大纲截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且后续会持续更新

如果你觉得这些内容对你有帮助,可以添加V获取:vip1024b (备注软件测试)
img

一个人可以走的很快,但一群人才能走的更远。不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎扫码加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!

件测试)**
[外链图片转存中…(img-sMiehwzS-1713015835477)]

一个人可以走的很快,但一群人才能走的更远。不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎扫码加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!

  • 21
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
当然可以!下面是一个简单的私有Docker镜像仓库搭建教程: 1. 安装Docker和Docker Compose:首先,确保你的主机上已经安装了Docker和Docker Compose。你可以根据你的操作系统文档中的步骤进行安装。 2. 创建一个目录:在你的主机上创建一个目录来存储你的私有镜像仓库的数据。例如,你可以创建一个名为`docker-registry`的目录。 3. 编写docker-compose.yml文件:在你的`docker-registry`目录下创建一个名为`docker-compose.yml`的文件,并添加以下内容: ```yaml version: '3.8' services: registry: restart: always image: registry:2 ports: - 5000:5000 volumes: - ./data:/var/lib/registry ``` 这将启动一个名为`registry`的容器,使用Docker官方提供的`registry:2`镜像。容器将通过`5000`端口对外提供服务,并将数据存储在`./data`目录中。 4. 启动私有镜像仓库:在你的`docker-registry`目录下运行以下命令启动私有镜像仓库: ```bash docker-compose up -d ``` 这将在后台启动私有镜像仓库容器,并将其绑定到`5000`端口。 5. 配置客户端:现在你的私有镜像仓库已经启动,你可以配置Docker客户端来使用它。在你的客户端主机上执行以下命令: ```bash echo "{ \"insecure-registries\": { \"localhost:5000\": {} } }" > /etc/docker/daemon.json sudo systemctl restart docker ``` 这将在`/etc/docker/daemon.json`文件中添加一个配置,以允许Docker客户端信任私有镜像仓库的地址。 现在,你就可以使用私有镜像仓库了。你可以使用`docker push`命令将本地构建的镜像推送到私有仓库,使用`docker pull`命令从私有仓库拉取镜像。 希望这个教程对你有所帮助!如果你有任何其他问题,请随时提问。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值