Docker将本地的镜像上传到私有仓库

使用register镜像创建私有仓库

bash 复制代码
[root@openEuler-node1 ~]# docker run --restart=always -d -p 5000:5000 -v /opt/data/regostry:/var/lib/registry registry:2
bash 复制代码
[root@openEuler-node1 ~]# docker images
REPOSITORY                                          TAG         IMAGE ID       CREATED        SIZE
registry                                            2           a8781fe3b7a2   5 weeks ago    25.4MB
busybox                                             latest      3f57d9401f8d   6 weeks ago    4.26MB
ubuntu                                              18.04       f9a80a55f492   9 months ago   63.2MB
centos                                              7           eeb6ee3f44bd   2 years ago    204MB

(1) 先将本地仓库打上合适的标签

bash 复制代码
[root@openEuler-node1 ~]# docker tag busybox:latest 192.168.136.55:5000/busybox:v1

(2)尝试上传镜像

bash 复制代码
[root@openEuler-node1 ~]# docker pull 192.168.136.55:5000/busybox:v1
Error response from daemon: Get "https://192.168.136.55:5000/v2/": http: server gave HTTP response to HTTPS client

上传镜像失败,原因:docker上传下载默认只支持https协议,搭建的私有仓库是https协议。

(3) 修改重启docker服务

bash 复制代码
[root@openEuler-node1 ~]# mkdir /etc/docker
[root@openEuler-node1 ~]# vim /etc/docker/daemon.json

{
        "insecure-registries":["192.168.136.55:5000"]
}       
[root@openEuler-node1 ~]# systemctl daemon-reload 
[root@openEuler-node1 ~]# systemctl restart docker.service 

(4)再次上传镜像,成功

bash 复制代码
[root@openEuler-node1 ~]# docker push 192.168.136.55:5000/busybox:v1
The push refers to repository [192.168.136.55:5000/busybox]
2e112031b4b9: Pushed 
v1: digest: sha256:d319b0e3e1745e504544e931cde012fc5470eba649acc8a7b3607402942e5db7 size: 527

(5)验证

bash 复制代码
[root@openEuler-node1 ~]# ll /opt/data/regostry/docker/registry/v2/repositories/
总用量 4
drwxr-xr-x 5 root root 4096  3月  3 11:58 busybox

我们可以用可视化界面registry-web(docker自带的)来管理

bash 复制代码
[root@openEuler-node1 ~]# docker run -d -p 8080:8080 --name registry-web --restart=always --link b2878bdb5e1b -e registry_url=http://192.168.136.55:5000/v2 -e registry_name=localhost:5000 hyper/docker-registry-web:latest
相关推荐
叶非花3 分钟前
Ubuntu服务器性能检测工具NetData安装
linux·服务器·ubuntu
披着假发的程序唐22 分钟前
STM32 H743 MPU的配置使用方法
linux·c语言·c++·驱动开发·stm32·单片机·mcu
小此方24 分钟前
Re:Linux系统篇(十二)工具篇 · 四:make与Makefile:高效管理 C++ 工程项目构建
linux·运维·c++·开发工具
Harvy_没救了26 分钟前
【虚拟容器-docker】docker核心“铁三角“--网络、存储、镜像管理
网络·docker·容器
枳实-叶26 分钟前
【Linux驱动开发】第7天:总线-设备-驱动三大核心模型:通俗讲解+完整流程图
linux·驱动开发·流程图
BS_Li28 分钟前
【Linux网络编程】应用层自定义协议与序列化
linux·服务器·网络
泓博30 分钟前
docker ubuntu源码安装openclaw的常见问题
java·linux·开发语言·ai
小此方30 分钟前
Re:Linux系统篇(十一)工具篇 · 三:三分钟学会gcc/g++编译工具&&初步认识动静态库&&重温编译基本原理
linux·运维·服务器·开发工具
小吴伴学者30 分钟前
Linux TX报文处理流程解析
linux
深邃-35 分钟前
【Web安全】-计算机网络协议(2):请求方法,头部字段,DNS协议详解
linux·网络·网络协议·计算机网络·安全·web安全·网络安全