首页 > 系统相关 >CENTOS docker拉取私服镜像

CENTOS docker拉取私服镜像

时间:2023-12-29 17:45:07浏览次数:37  
标签:55.136 5000 CENTOS 私服 10.55 fs.1 v1.2 docker

 

概述

docker的应用越来越多,安装部署越来越方便,批量自动化的镜像生成和发布都需要docker镜像的拉取。

centos6版本太老,docker的使用过程中问题较多,centos7相对简单容易。

本文档主要介绍centos系统安装docker和拉取docker私服镜像的步骤和问题解决。

环境

docker registry:2

centos 6 && docker 1.7.1

centos 7 && docker 24.0.6

centos6

docker安装,命令会自动安装依赖libcgroup。

yum install https://get.docker.com/rpm/1.7.1/centos-6/RPMS/x86_64/docker-engine-1.7.1-1.el6.x86_64.rpm

docker-engine     x86_64   1.7.1-1.el6

libcgroup              x86_64   0.40.rc1-27.el6_10

 

启动。

sudo service docker start

 

查看版本。

sudo docker version

Client version: 1.7.1

Client API version: 1.19

Go version (client): go1.4.2

Git commit (client): 786b29d

OS/Arch (client): linux/amd64

Server version: 1.7.1

Server API version: 1.19

Go version (server): go1.4.2

Git commit (server): 786b29d

OS/Arch (server): linux/amd64

 

拉取docker私服镜像报错。

$ sudo docker pull 10.55.55.136:5000/zr/centos.7-fs.1.6.19-release:v1.2

Error response from daemon: invalid registry endpoint https://10.55.55.136:5000/v0/: unable to ping registry endpoint https://10.55.55.136:5000/v0/

v2 ping attempt failed with error: Get https://10.55.55.136:5000/v2/: tls: oversized record received with length 20527

v1 ping attempt failed with error: Get https://10.55.55.136:5000/v1/_ping: tls: oversized record received with length 20527. If this private registry supports only HTTP orHTTPS with an unknown CA certificate, please add --insecure-registry 10.55.55.136:5000 to the daemon's arguments. In the case of HTTPS, if you have access to the registry's CA certificate, no need for the flag; simply place the CA certificate at /etc/docker/certs.d/10.55.55.136:5000/ca.crt

 

报错解决方案,修改docker启动参数。

sudo vi /etc/sysconfig/docker

other_args="--insecure-registry 10.55.55.136:5000"

 

重启。

sudo service docker restart

 

重新拉取私服镜像,成功。

$ sudo docker pull 10.55.55.136:5000/zr/centos.7-fs.1.6.19-release:v1.2

v1.2: Pulling from 10.55.55.136:5000/zr/centos.7-fs.1.6.19-release

376a065e9bca: Pull complete

e8ea2a607cf1: Pull complete

da288f16cf46: Pull complete

41a8d4a923cc: Extracting [==================================================>] 412.3 MB/412.3 MB

41a8d4a923cc: Pulling fs layer

41a8d4a923cc: Pull complete

Digest: sha256:d6ea6d10cf22cff4813f877762682969369392b2922cc4020be772166ce29943

Status: Downloaded newer image for 10.55.55.136:5000/zr/centos.7-fs.1.6.19-release:v1.2

centos7

centos7系统需要安装docker-ce版本。

删除centos7系统默认docker。

yum remove docker \

                  docker-client \

                  docker-client-latest \

                  docker-common \

                  docker-latest \

                  docker-latest-logrotate \

                  docker-logrotate \

                  docker-selinux \

                  docker-engine-selinux \

                  docker-engine

 

安装依赖包。

yum install -y yum-utils device-mapper-persistent-data lvm2

 

docker-ce的yum源。

yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

 

安装docker-ce。

yum makecache fast

yum -y install docker-ce

 

启动。

systemctl start docker

 

拉取docker私服镜像报错。

$ sudo docker pull 10.55.55.136:5000/zr/centos.7-fs.1.6.19-release:v1.2

Error response from daemon: Get "https://10.55.55.136:5000/v2/": http: server gave HTTP response to HTTPS client

 

报错解决方案,修改docker启动参数。

sudo vi /etc/docker/daemon.json

{

       "insecure-registries":[

              "10.55.55.136:5000"

       ]

}

 

重启。

sudo systemctl restart docker

 

重新拉取私服镜像,成功。

$ sudo docker pull 10.55.55.136:5000/zr/centos.7-fs.1.6.19-release:v1.2

v1.2: Pulling from zr/centos.7-fs.1.6.19-release

Digest: sha256:310545c07c5628db19032840a74c22992c5916b70c5dea3a1660181bbc48eb43

Status: Image is up to date for 10.55.55.136:5000/zr/centos.7-fs.1.6.19-release:v1.2

10.55.55.136:5000/zr/centos.7-fs.1.6.19-release:v1.2

 

容器导出导入

如果系统无法实现自动拉取镜像,也可以通过save功能将镜像保存为tar包,然后在宿主机上通过load加载镜像。

sudo docker save -o centos.7-fs.1.6.19-release.v1.2.tar 10.55.55.136:5000/zr/centos.7-fs.1.6.19-release:v1.2

sudo docker load -i centos.7-fs.1.6.19-release.v1.2.tar

 

总结

尽快切换掉centos6系统。

docker registry的私服镜像使用更方便。

docker镜像包的瘦身工作要持续进行。

 

空空如常

求真得真

标签:55.136,5000,CENTOS,私服,10.55,fs.1,v1.2,docker
From: https://www.cnblogs.com/qiuzhendezhen/p/17935410.html

相关文章

  • docker安装rabbitmq3.11.9镜像集群
    准备3台服务器安装配置镜像集群IP1:192.168.0.1IP2:192.168.0.2IP3:192.168.0.3yuminstall-ylrzsztelnetnciftopunzipyum-utilsepel-releasesystemctlstopfirewalld.service&&systemctldisablefirewalld.serviceyum-config-manager--add-repohttp://mirrors.aliyu......
  • CentOS 宝塔 安装 onlyoffice
    1.宝塔默认软件安装1.1Nginx需要编译安装默认版本没有http_secure_link_module所以需要重新编译安装一遍cd/www/server/nginx/src./configure\--user=www\--group=www\--prefix=/www/server/nginx\--with-http_secure_link_module\--with-http_ssl_module\-......
  • DockerCompose中重启某个服务时提示: (iptables failed: iptables --wait -t nat -A D
    场景DockerCompose修改某个服务的配置(添加或编辑端口号映射)后如何重启单个服务使其生效:https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/134666413除了以上重启某个服务的方式外。基于docker-compose的方式,如果只是要单纯的重启某个服务,则可以通过docker-compo......
  • ubuntu 安装 docker
    ubuntu安装docker详细步骤ubuntu下自带了docker的库,不需要添加新的源。但是ubuntu自带的docker版本太低,需要先卸载旧的再安装新的。卸载旧版本apt-getremovedockerdocker-enginedocker.iocontainerdrunc安装前提依赖aptupdateapt-getinstallca-certificates......
  • Rocky Linux 8.9 发布 - CentOS 的权威替代
    RockyLinux8.9发布-CentOS的权威替代RockyLinux由CentOS项目的创始人GregoryKurtzer领导作者主页:sysin.org以社区方式驱动的企业LinuxRockyLinux是一个开源的企业级操作系统,旨在与RedHatEnterpriseLinux®100%1:1兼容。它正处于社区的密集开发中。以社区驱......
  • AlmaLinux 8.9 发布 - RHEL 下游免费发行版(CentOS 稳定版的替代品)
    AlmaLinux8.9发布-RHEL下游免费发行版(CentOS稳定版的替代品)AlmaLinuxOS是一个开源、社区驱动的项目,旨在提供CentOS稳定版的替代品。作者主页:sysin.org2023.11.21,AnnouncingAlmaLinux8.9Stable!关于新增功能可以参考:RedHatEnterpriseLinux(RHEL)8.9(x86_64,aarc......
  • linux环境docker安装使用nginx
    1、dockersearchnginx 命令来查看可用版本$dockersearchnginxNAMEDESCRIPTIONSTARSOFFICIALAUTOMATEDnginxOfficialbuildofNginx.3260[OK]......
  • Docker安装sqlserver-2019(已做持久化)
    Docker安装sqlserver-2019一.新建挂载目录并赋权mkdirsqlservercdsqlservermkdir-p/data/mssql#给目录赋予写的权限,不然在容器启动的时候,文件无法挂载chmod-R777./data/mssql二.准备docker-compose文件#在预先创建的sqlserver目录下vidocker-compose.yml#写入......
  • centos7 升级curl-8.2.1 支持http2 (yum update)
    转载于:https://www.cnblogs.com/huangweimin/articles/15882913.htmlCentOS7默认的curl版本最新就到7.29 ,它是不支持http2的#curl--versioncurl7.29.0(x86_64-redhat-linux-gnu)libcurl/7.29.0NSS/3.53.1zlib/1.2.7libidn/1.28libssh2/1.8.0Protocols:dict......
  • 解决PHP项目在Docker(WSL2)中运行缓慢的问题(转)
    原文:https://blog.csdn.net/ljfrocky/article/details/1298073081、环境Windows11DockerDesktop4.17.1(开启WSL2)WSL2(Ubuntu-22.04)2、前言最近在使用Docker容器运行PHP项目的时候,发现特别缓慢。例如一个干净的ThinkPHP5.1框架,访问首页都需要1秒以上,如果再加上数据库查......