• KunPeng平台 cAdvisor 0.36.0移植安装指南
    1 cAdvisor简介        cAdvisor(容器顾问)使用容器用户了解其运行容器的资源使用情况和性能特征。它是一个运行态的守护程序,用于收集、聚合、处理和导出有关正在运行的容器的信息。具体来说,对于每个容器, 它保留其资源隔离参数,历史资源使用情况,完整历史资源使用情况,并通过直方图的形式展示出来。  2 环境信息2.1 环境信息目版本下载地址CentOS7.6https://www.centos.org/download/Kernel4.14.0包含在操作系统镜像中CPU鲲鹏920服务器配置16U16GB40GB3 配置编译环境3.1 Yum源配置                说明:根据依赖或软件来源的不同,以及配置过程的不同,yum源配置分为如下三种:                ·  本地yum源                ·  网络yum源                ·  华为yum源                不作任何配置时,则默认使用Centos官方yum源(需要外网权限)。                Yum源详细配置,可以参考:《KunPeng平台软件移植Yum源配置参考》,本次使用Centos官方默认yum源。                ----结束3.2 安装依赖包        步骤1   安装依赖包。                yum install gcc git wget unzip yum-utils                                ----结束3.3 安装配置go        步骤 1   下载go。                wget https://studygolang.com/dl/golang/go1.14.1.linux-arm64.tar.gz                                说明:如果提示”wget: 未找到命令”,请先用yum install wget安装wget工具。        步骤 1   解压go到指定目录。                tar -C /usr/local -zxvf go1.14.1.linux-arm64.tar.gz                        步骤 2   配置go环境变量。                执行如下命令行,在/etc/profile添加环境变量配置:                echo 'export GOROOT=/usr/local/go' >> /etc/profile                echo 'export GOPATH=/usr/lib64/golang' >> /etc/profile                echo 'export GO111MODULE=on' >> /etc/profile                echo 'export GOPROXY=https://goproxy.io'  >> /etc/profile                echo "export PATH=/usr/local/go/bin:$PATH" >> /etc/profile                执行/etc/profile,使用配置生效:                source /etc/profile        步骤3   查看go版本信息。                go version                                ----结束4 安装                说明:本文将介绍两种安装方式,请视具体情况选择其中一种安装方式。                表 4-1 安装方式说明安装方式安装说明源码编译安装  源码安装,与环境内核无冲突,可定制,但是复杂度高。rpm方式安装rpm包方式,方便简单(当部署环境与本文档环境一致时,推荐使用本方式)。4.1 源码编译安装4.1.1 获取源码        步骤 1   下载cAdvisor。                wget https://github.com/google/cadvisor/archive/v0.36.0.zip                                如何出现”“错误,请在wget后增加—no-check-certificate选项参数                                wget https://github.com/google/cadvisor/archive/v0.36.0.zip --no-check-cerfificate                4.1.2 编译安装cAdvisor        步骤 1   解压cAdvisor压缩包。                解压压缩包。                unzip v0.36.0.zip                        步骤 3   编译cAdvisor。                进入cAdvisor解压目录,并增加文件可执行权限:                cd cadvisor-0.36.0/                chmod –R 744 *                                开始编译:                make build                        步骤 4   配置cAdvisor。                为了方便管理使用,建议将cAdvisor-0.36.0移至/usr/local目录,并将路径添加至环境变量。                mv cadvisor-0.36.0 /usr/local/                                echo "export PATH=/usr/local/cadvisor-0.36.0:$PATH"  >> /etc/profile                source /etc/profile                                ----结束4.2 RPM方式安装        说明:rpm都是通过开源代码编译打包而成,并验证通过,打包过程参考”6 RPM打包“。         步骤 1   从附件获取RPM包,并复制RPM包至服务器“ /home”目录并安装。                ls /home                        步骤 2   安装RPM包。                yum localinstall /home/cadvisor-0.36.0-1.el7.aarch64.rpm                        步骤 3   刷新PATH环境变量。                echo "export PATH=/usr/local/cadvisor-0.36.0:$PATH" >> /etc/profile                source /etc/profile                                ----结束5 运行和验证5.1 验证准备        步骤 1   安装docker容器。                安装yum-utils:                sudo yum install yum-utils                                下载docket yum源仓库文件:                sudo yum-config-manager –add-repo http://download.docker.com/linux/centos/docker-ce.repo                                通过yum安装docker:                yum install docker-ce docker-ce-cli containerd.io                                启动docker服务:                sudo systemctl start docker                                创建示例容器:                Sudo docker run hello-world                        步骤 2   停止部署环境上的firewall。                为了测试方便,停止部署环境上的firewall服务:                systemctl stop firewalld.service                        步骤 3   启动cAdvisor。                                ----结束5.2 运行测试        步骤 1   通过浏览器,相看cAdvisor对容器的监控统计。                http://server_ip:8080,自动重定向到 http://server_ip:8080/containers/                                ----结束6 RPM打包(参考)                说明:本段提供了RPM包制作的详细过程,当部署环境与本文档环境不兼容时,可参考此打包过程,自制RPM包,然后再安装到部署环境。6.1 准备RPM 打包环境        步骤 1   安装打包依赖。                RPM打包依赖与编译依赖相同,请参考“3 配置编译环境“。        步骤 2   安装rpmdevtools。                yum install rpmdevtools                        步骤 3   生成打包目录树。                cd ~/                rpmdev-setuptree        步骤 4   进入目录~/rpmbuild,应有如下文件夹:                cd ~/rpmbuild                        步骤 5   下载源码包,并移至~/rpmbuild/SOURCES:                mv ~/v0.36.0.zip  ~/rpmbuild/SOURCES                ls                                ----结束6.2 编辑SPEC文件        步骤 1   生成SPEC文件模板。                1.切换目录至~/rpmbuild/SPECS。                        cd ~/rpmbuild/SPECS                2.生成模板文件cadvisor.spec。                        rpmdev-newspec cadvisor                        ls                                步骤 2   修改SPEC文件。                vi cadvisor.spec                修改后,cadvisor.spec文件内容如下:                                    Name:           cadvisor                    Version:        0.36.0                    Release:        1%{?dist}                    Summary:        ccAdvisor (Container Advisor) provides container users an understanding of the resource usage and performance characteristics of their running containers                    License:        Apache License                    URL:            https://github.com/google/cadvisor/                    Source0:        v0.36.0.zip                    BuildRequires:  gcc git wget unzip                     %description                    cAdvisor (Container Advisor) provides container users an understanding of the resource usage and performance characteristics of their running containers. It is a running daemon that collects, aggregates, processes, and exports information about running containers. Specifically, for each container it keeps resource isolation parameters, historical resource usage, histograms of complete historical resource usage and network statistics. This data is exported by container and machine-wide.                    cAdvisor has native support for Docker containers and should support just about any other container type out of the box. We strive for support across the board so feel free to open an issue if that is not the case. cAdvisor's container abstraction is based on lmctfy's so containers are inherently nested hierarchically.                    %prep                    %setup -q                    %define install_path %{_prefix}/local                    %define target_path %{buildroot}%{install_path}                    %build                    make build                     mkdir %{target_path} -p                    cp -r %{_builddir}/%{name}-%{version} %{target_path}                    %files                    %{install_path}                    %changelog                    ----结束6.3 RPM打包        步骤 1   rpmlint检查SPEC文件或RPM包。                1.安装rpmlint。                        yum install rpmlint                                        2.错误检查。                        说明:如果返回错误/警告,使用 “-i” 选项查看更详细的信息。但由于rpmlint检测较严格,一些错误可忽略,                                  可根据实际情况结合检测结果进行修改。                        rpmlint –i cadvisor.spec                                步骤 2   构建SRPM和RPM。                rpmbuild -bb cadvisor.spec                                 ........                        步骤 3   查看生成的RPM包。                ls ~/rpmbuild/RPMS/aarch64                        步骤 4   RPM包验证。                RPM包的验证,可参考”5 运行和验证“。                ----结束7 参考7.1 RPM打包流程、示例及问题集                参考:https://bbs.huaweicloud.com/forum/thread-38327-1-1.html7.2 官方文档                参考:https://github.com/google/cadvisor/tree/master
  • [问题求助] 求助贴,DockerHub地址变成空白
  • 华为开源镜像站DockerHub地址又变成空白
    华为开源镜像站DockerHub地址又变成空白
  • [问题求助] Docker-CE安装镜像描述说明不完善
    mirrors内arm64的安装方式与官方不同,且在鲲鹏920环境下安装armhf分支是失败的
  • arm鲲鹏服务器使用docker-compose部署问题
    arm鲲鹏服务器使用docker-compose部署问题描述1:项目开发:基于java的微服务,在使用x86部署时没有任何问题2:使用arm架构的服务器安装使用docker和docker-compose在启动的适合总是报以下错误 ---> de764ad211deStep 2/13 : MAINTAINER lengleng(wangiegie@gmail.com) ---> Using cache ---> 41ec295856a6Step 3/13 : RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime ---> Running in 9b8129a5a173standard_init_linux.go:211: exec user process caused "exec format error"ERROR: Service 'pigx-mysql' failed to build: The command '/bin/sh -c ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime' returned a non-zero code: 1错误排查:1:排除window到unix环境转换的格式问题,使用dos2unix转换仍然不行2:错误原因,在指令执行过程中出现指令格式执行错误
  • docker hub 镜像加速配置源之后,无法下载镜像
    已经按照提示,配置了加速地址: ![image.png](https://bbs-img-cbc-cn.obs.cn-north-1.myhuaweicloud.com/data/attachment/forum/202001/11/231040r6wrxn0y5zzjkvw8.png) 如下是 Mac 配置内容: ![image.png](https://bbs-img-cbc-cn.obs.cn-north-1.myhuaweicloud.com/data/attachment/forum/202001/11/230928mvfindaxhib1bv8c.png) 使用 `docker pull centos` 下载镜像时,没有速度!!!如果改为163或其他地址,就是好用的。看上图中,貌似缺少什么证书~
  • Docker-CE镜像源不可用的问题
    按照网站提供的信息进行安装操作。在debian/ubuntu系linux上执行信任Docker的GPG公钥:curl -fsSL https://mirrors.huaweicloud.com/linux/ubuntu/gpg | sudo apt-key add - 时系统总是提示root@abc:~# curl -fsSL https://mirrors.huaweicloud.com/linux/ubuntu/gpg | sudo apt-key add -gpg: no valid OpenPGP data found.在centos/rhel系linux上执行根据版本不同,下载repo文件。wget -O /etc/yum.repos.d/docker-ce.repo https://mirrors.huaweicloud.com/linux/centos/docker-ce.repo系统提示404即repo文件不存在已经在多台设备上进行测试过,问题一直存在希望官方解决
  • 鲲鹏云支持不支持微服务docker部署
    使用的spring cloud alibaba开发的微服务,部署使用docker-compose,怎么部署到鲲鹏920服务器
  • 【问题反馈】DockerHUB官方镜像加速源的地址也有问题。。。
    DockerHUB官方镜像加速源的地址也有问题,直接变成空的了,啥情况啊这是:
  • [问题反馈]Docker-Ce的地址是错误的,请注意修改
    Docker-Ce的镜像的使用说明中,"Fedora/CentOS/RHEL"页面下:其中命令:2、根据版本不同,下载repo文件。您使用的发行版: wget -O /etc/yum.repos.d/docker-ce.repo https://repo.huaweicloud.com/linux/centos/docker-ce.repo下面的链接地址是错的,无法下载,经测试,正确地址应该是:https://repo.huaweicloud.com/docker-ce/linux/centos/docker-ce.repo下面截图所示:
  • [产品体验官] 体验官有奖体验滴13期| 华为云鲲鹏弹性云服务器KC1体验测试报告--hw91475066
    使用场景描述:我们公司在许多实际项目中有用到MQTT,鉴于每次新的项目重新部署MQTT的环境不清真,因此在申请了体验资源后,想尝试在鲲鹏服务器上部署一套基于Doker环境的MQTT数据输入图形化监视(TICK+Mosquitto),来实现MQTT的可复用和图形化监测目的。测试步骤实现:1.     本次测试用户以Root为例,服务器详细配置如下图所示:                                               2.     为了方便测试,我点击“一键放通”放开大部分常用的端口:3.     尝试过多次想修改root用户的密码,发觉修改不了,可能因为是免费测试版的原因,感觉有点不清真:4.     直接使用VNC远程登录云服务器,可正常登录:   再次点击控制台上的“远程登录”按钮,弹出新的浏览器页签,画面不显示:5.     好了,现在直接进入主题,在CentOS 7.6 64bit with ARM中安装Docker:1)  docker-ce的安装sudo yum install –y yum-utilssudo yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.reposudo yum install docker-ce2) 至此Docker安装成功,测试一下是否可用:Docker版本信息正常显示,接下来启动Docker,并将Docker设置为开机启动:3) 接下来Docker安装Portainer镜像何为Portainer?Portainer是Docker的图形化管理工具,提供状态显示面板、应用模板快速部署、容器镜像网络数据卷的基本操作(包括上传下载镜像,创建容器等操作)、事件日志显示、容器控制台操作、Swarm集群和服务等集中管理和操作、登录用户管理和控制等功能。功能十分全面,基本能满足中小型单位对容器管理的全部需求。查询Portainer镜像下载Portainer镜像本地运行 命令行设置启动sudo docker volume create portainer_data浏览器访问设置,密码创建一个用户访问主机9000端口(9000为启动时配置端口) 选择本地运行模式,点击“Connect“进入本地管理项目,管理当前容器列表    安装Mosquitto镜像,先搜索Mosquitto镜像默认安装方式控制台添加需要的端口通过Portainer查看容器情况快速部署TICKTICK Stack简介InfluxData平台用于处理度量和事件的时间序列平台,常被称为TICK stack,包含4个组件:Telegraf,influxDB,Chronograf和Kapacitor,分别负责时间序列数据的:data collection,data storage,data visualization,和data processing and alerting。 安装InfluxDB镜像先从镜像仓库拉取镜像源,没有开代理,这是一个痛苦的过程鲲鹏服务器各项指标监测情况:安装Telegraf镜像针对MQTT输入自定义配置文件获取telegraf配置文件模板另存为telegraf.confsudo docker run --rm telegraf telegraf config > telegraf.conf 更换了镜像源,增加了阿里云的镜像加速器,Download的速度依旧很慢再次看下带宽利用率:   跳过Telegraf镜像,安装Chronograf镜像sudo docker run -d --net=container:m2influx \        --name m2_chronograf \        -v chronograf:/var/lib/chronograf \        Chronograf安装Kapacitor镜像$ sudo docker run -d -p 9092:9092 \      -v kapacitor:/var/lib/kapacitor \      Kapacitor 浏览器访问主机IP地址的8888端口连接InfluxDB数据库,使用用户名与密码连接。进入仪表盘,可看到有选择Docker的源 接下来进入Kapacitor的连接页面,暂时我们不连接,跳过下一步完成向导 接下来,看看我们的劳动成果,图形化监控MQTT信息  总结一下整体使用感受:整个测试过程使用下来,有一些亮点,也遇到了一些困难。1)  服务器整体性能还是不错,相比较AWS的服务器,鲲鹏服务器可操作性更适用于国人。2) 在输入命令的方式上提供了可复制粘贴的功能,对于linux菜鸟级人员来说,可操作性有很大的帮助。这是比较人性化的地方。值得吐槽的点,有以下两点:1)  只是每次粘贴命令后需要输入空格,“发送”按钮才能启用,不知道是不是产品故意设置防止误操作的。2) 前提条件是镜像仓库用的阿里的,开启了阿里的镜像加速器之后,在拉取Docker镜像的时候,感觉速度不是很给力,为了拉取所需要的Docker镜像,已经历过耗时1个晚上,仍然有很多镜像拉取失败的情况。具体不清楚是否是带宽的影响还是对某些镜像源支持不太友好。 最后还是要感谢华为鲲鹏产品服务人员给予这次测评的机会,希望你们的产品设计越来越好,服务器大卖!  
  • 鲲鹏云服务器 Docker 安装指南(CentOS 7.5/Ubuntu 18.04)
    软件介绍Docker是一个开源的应用容器引擎,让开发者可以打包他们的应用以及依赖包到一个可移植的镜像中,然后发布到任何流行的Linux或Windows机器上,也可以实现虚拟化。容器是完全使用沙箱机制,相互之间不会有任何接口。支持的操作系统经过华为云严格实测,以下操作系统在鲲鹏生态中可以完整运行Docker的全部功能:l   CentOS 7.5centos-extra仓库必须处于“enabled”状态。这是操作系统默认配置,如果你已经设置成“disabled”,则需要重新设置。相关命令如下:l  查询仓库状态:yum repolist all例如:yum repolist all|grep "CentOS-7 - Extras"l  设置为“enabled”状态:yum-config-manager --enable例如: yum-config-manager --enable "CentOS-7 - Extras - mirrors.huaweicloud.com"l  设置为“disabled”状态:yum-config-manager --disable例如:yum-config-manager --disable "CentOS-7 - Extras - mirrors.huaweicloud.com"l   EulerOS 2.8l   Ubuntu 18.04安装与部署方式Ubuntu操作系统1.      准备环境准备实例从华为云官网购买鲲鹏云服务ECS实例,详细配置如下:类别子项版本云服务器配置ECS实例类型kc1.xlarge.4ECS配置4U16GBEVS(系统盘)高IO(40GB)EVS(数据盘)高IO(40GB)云OSUbuntu18.04Kernel4.15.0-29安装依赖包执行以下命令安装依赖包。sudo apt-get updatesudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common2.      执行安装方式一:通过软件仓库安装1)     老版本的Docker的命名为“docker”、“docker.io” 或 “docker-engine”,如果安装了这些版本,需要先卸载掉。保存在“/var/lib/docker”/中的内容,包括图片、磁盘和网络配置等都会保留下来。sudo apt-get remove docker docker-engine docker.io containerd runc2)     添加Docker官方GPG key。curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -3)     设置Docker CE软件仓库版本为arm64。sudo add-apt-repository \"deb [arch=arm64] https://download.docker.com/linux/ubuntu \$(lsb_release -cs) \stable"4)     安装docker-ce软件。sudo apt-get updatesudo apt-get install docker-ce docker-ce-cli containerd.io如果需要安装指定版本的docker-ce,可以执行以下命令:sudo apt-get install docker-ce=<VERSION_STRING> docker-ce-cli=<VERSION_STRING> containerd.io方式二:下载软件包安装1)     通过https://download.docker.com/linux/ubuntu/dists/bionic/pool/stable/arm64/,下载指定版本的软件包。2)     执行命令安装软件包及依赖。“package.deb”为下载的软件包。sudo dpkg -i /path/to/package.deb3.      启动软件1)     启动docker。sudo systemctl start docker2)     使用一个hello-world镜像验证docker是否正常。sudo docker run hello-world回显内容如下:Unable to find image 'hello-world:latest' locallylatest: Pulling from library/hello-world3b4173355427: Pull complete Digest: sha256:41a65640635299bab090f783209c1e3a3f11934cf7756b09cb2f1e02147c6ed8Status: Downloaded newer image for hello-world:latest Hello from Docker!This message shows that your installation appears to be working correctly. To generate this message, Docker took the following steps: 1. The Docker client contacted the Docker daemon. 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.    (arm64v8) 3. The Docker daemon created a new container from that image which runs the    executable that produces the output you are currently reading. 4. The Docker daemon streamed that output to the Docker client, which sent it    to your terminal. To try something more ambitious, you can run an Ubuntu container with: $ docker run -it ubuntu bash Share images, automate workflows, and more with a free Docker ID: https://hub.docker.com/ For more examples and ideas, visit: https://docs.docker.com/get-started/CentOS操作系统1.      准备环境准备实例从华为云官网购买鲲鹏云服务ECS实例,详细配置如下:类别子项版本云服务器配置ECS实例类型rc3.xlarge.4ECS配置4U14GBEVS(系统盘)高IO(40GB)EVS(数据盘)高IO(40GB)云OSCentOS7.5Kernel4.14.0-49                安装依赖包执行以下命令安装依赖包。sudo yum install -y yum-utils device-mapper-persistent-data lvm22.      执行安装方式一:使用软件仓库安装1)     老版本的docker的命名为“docker”或 “docker-engine”,如果安装了这些版本,需要先卸载掉。保存在“/var/lib/docker/”中的内容,包括图片、磁盘和网络配置等都会保留下来。sudo yum remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate2)     配置软件仓库。sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo3)     安装docker-ce。sudo yum install docker-ce docker-ce-cli containerd.io这个命令总是会安装最新版本的docker-ce,如果需要安装指定版本的可以参考下面的操作:sudo yum install docker-ce-<VERSION_STRING> docker-ce-cli-<VERSION_STRING> containerd.io方式二:下载软件包安装1)     通过https://download.docker.com/linux/centos/7/aarch64/stable/Packages/,下载指定版本的软件包。2)     执行命令安装软件包及依赖。“package.rpm”为下载的软件包。sudo yum install /path/to/package.rpm3.      启动软件1)     启动Docker。sudo systemctl start docker2)     使用一个hello-world镜像验证Docker是否正常。sudo docker run hello-world回显内容如下:Unable to find image 'hello-world:latest' locallylatest: Pulling from library/hello-world3b4173355427: Pull complete Digest: sha256:41a65640635299bab090f783209c1e3a3f11934cf7756b09cb2f1e02147c6ed8Status: Downloaded newer image for hello-world:latest Hello from Docker!This message shows that your installation appears to be working correctly. To generate this message, Docker took the following steps: 1. The Docker client contacted the Docker daemon. 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.    (arm64v8) 3. The Docker daemon created a new container from that image which runs the    executable that produces the output you are currently reading. 4. The Docker daemon streamed that output to the Docker client, which sent it    to your terminal. To try something more ambitious, you can run an Ubuntu container with: $ docker run -it ubuntu bash Share images, automate workflows, and more with a free Docker ID: https://hub.docker.com/ For more examples and ideas, visit: https://docs.docker.com/get-started/软件下载源码下载:立即下载
  • [交流分享] 鲲鹏平台安装docker-compose参考
    Docker Compose由Docker创建,用于简化开发和测试多容器应用程序的过程,Docker-Compose项目是Docker官方的开源项目,负责实现对Docker容器集群的快速编排。Docker-Compose将所管理的容器分为三层,分别是工程(project),服务(service)以及容器(container)。Docker-Compose运行目录下的所有文件(docker-compose.yml,extends文件或环境变量文件等)组成一个工程,若无特殊指定工程名即为当前目录名。一个工程当中可包含多个服务,每个服务中定义了容器运行的镜像,参数,依赖。一个服务当中可包括多个容器实例。Docker-compose的运行依赖于docker的安装和运行,如果已经安装了docker,并能成功运行docker,可以跳过docker安装这一章节,直接进入到docker-compose的安装。一.安装依赖selinux安装docker安装时需要依赖于selinux,可以提前安装selinux。安装方式是,wget先下载到本地wget http://mirror.centos.org/centos/7/updates/x86_64/Packages/selinux-policy-targeted-3.13.1-229.el7_6.12.noarch.rpm然后用yum install /localpath/to/rpm来安装docker安装Docker需要下载aarch64版本的:https://download.docker.com/linux/centos/7/aarch64/stable/Packages/,可以下载18版本的,如docker-ce-18.03.1.ce-1.el7.centos.aarch64.rpm这个版本。先使用wget 进行下载wget https://download.docker.com/linux/centos/7/aarch64/stable/Packages/docker-ce-18.03.1.ce-1.el7.centos.aarch64.rpm  --no-check-certificate下载之后,使用yum安装yum install /path/to/package.rpm启动docker配置正确的Docker运行hello-world时会打印如下信息systemctl start docker运行hello-world,检查Docker配置是否已经正确docker run hello-world执行之后,如果打印“Hello from Docker!This message shows that your installation appears to be working correctly”则启动正常二. docker-compose安装Docker-compose的安装依赖于docker,所以需要先确保docker可以正常运行起来,如docker run hello-world运行时不会报错github已经有aarch64的docker-compose版本,可以直接从github下载arm64版本:https://github.com/ubiquiti/docker-compose-aarch64git clone https://github.com/ubiquiti/docker-compose-aarch64.git下载之后,主要有Dockerfile文件用来构建compose镜像,README.md则是具体构建方法:docker build . -t docker-compose-aarch64-builderdocker run --rm -v "$(pwd)":/dist docker-compose-aarch64-builder总共就两步:构建docker-compose镜像运行docker-compose镜像,同时在本地生成可执行文件docker-compose-Linux-aarch64详细步骤:1.修改Dockefile文件,增加http代理环境变量,由于Dockerfile是在Dokcer容器内部执行的,默认不使用系统设置的代理,需要在Dockerfile中增加环境变量ENV 来设置http_proxy/https_proxy代理,否则Dockerfile中和远程仓库交互的命令都会报错2.注释掉Dockerfile中的交叉编译选择“#RUN [ "cross-build-start" ]”,因为arm64只要编译成功即可,不需要在x86平台上跑,如果不注释掉,会出现“exec format error”格式执行错误3.在docker-compose-aarch64当前目录直接执行如下命令,构建compose镜像docker build . -t docker-compose-aarch64-builder运行docker-compose镜像在本地生成docker-compose-Linux-aarch64可执行文件1.执行docker run --rm -v "$(pwd)":/dist docker-compose-aarch64-builder,可以看到在当前目录下生成了一个docker-compose-Linux-aarch64的可执行程序同时也可以用docker images查看刚生成的docker-compose-aarch64-builder镜像2.查看docker-compose版本号,同时将此可执行文件路径添加到PATH中,便于其他组件直接调用./docker-compose-Linux-aarch64 version
  • [技术干货] 教程:添加OBS存储到官方docker registry,实现采用OBS对象存储服务作为registry存储后端。
        技术背景    Docker作为一种热门的虚拟化技术,当前被广泛应用于各领域之中。在Docker中,主要包含三个概念,分别是镜像(Image)、容器(Container)及仓库(Repository),其中镜像是Docker中的核心部分。Docker镜像是一种特殊的文件系统,其提供了容器运行时所需要的程序、库、资源、配置等文件。镜像构建完成后即可在对应的宿主机上执行。但当需要将镜像提供给其他用户在其他服务器上使用时,就需要一种镜像分发服务,当前官方Docker Registry即可以提供该种服务。在使用Docker registry服务时可以指定对应的后端存储类型以存储镜像等文件,但当前Docker registry后端存储类型中暂不支持采用华为云对象存储(OBS)服务,由此给希望采用OBS服务作为存储后端的用户带来了不便。针对该问题,利用Docker官方提供的Docker registry开源代码,我们实现了可支持OBS存储的registry服务。    github地址    该registry基于Docker registry1.7.1版本开发,源代码地址为:https://github.com/redabc/distribution.git。    使用方法    1. 安装依赖组件Docker、docker-compose;    2. 从上述地址获取registry代码:git clone https://github.com/redabc/distribution.git;    3. 进入distribution目录,执行编译命令:docker build . -t "obs/registry-photon:v1.7.1",红色部分表示registry库编译后的镜像名称,可以自行指定为自定义的镜像名称。    4. 执行docker run命令,创建并运行步骤3中编译得到的镜像。对应命令:docker run -d -p 5000:5000 --name registry obs/registry-photon:v1.7.1。红色部分为步骤3中编译registry镜像时指定的镜像名称。    5. 执行步骤4后即可采用新的编译后的registry服务。但是由于Docker registry默认情况下采用的是filesystem存储后端,即将镜像等文件存储在本地指定路径下,因此如需采用OBS存储后端时,还需要额外修改registry的配置文件。        5.1 默认的registry配置文件路径为/etc/docker/registry/config.yml,该文件路径对应存在于步骤4中运行的registry容器中。为了指定采用OBS存储后端,需要先将该文件拷贝至宿主机环境,执行拷贝命令: docker cp contain_id:/etc/docker/registry/config.yml  config.yml,其中contain_id为步骤4中运行的容器对应的ID,可以通过docker ps命令查询。执行该条命令会将config文件拷贝至宿主机当前命令路径下。        5.2 修改宿主机目录中的config.yml文件,在config.yml文件中的storage字段中添加obs为后端存储,同时删除filesystem字段。    6. 执行docker stop registry 命令停止步骤4中运行的容器,红色部分表示步骤4中命令指定的容器名,可以通过docker ps命令查询。停止后删除该容器。    7. 执行命令:docker run -d -p 5000:5000 -v  `pwd`/config.yml:/etc/docker/registry/config.yml --name registry obs/registry-photon:v1.7.1重新创建并运行。其中红色部分表示利用宿主机上指定路径下的config.yml配置文件运行容器,此时即可根据步骤5中修改的config.yml文件采用obs服务作为存储后端。2019/11/29更新:    1. 考虑到部分用户在使用OBS作为docker registry存储后端时,对应用户无创建桶的权限,只有与上传及下载相关的操作权限,该情况下用户将无法启动该registry服务。针对这一情况,当前代码中去掉了创桶操作。为保证功能的正常使用,目前需要提前创建要使用的OBS桶,或传入已存在的桶名。
  • [交流分享] Docker安装ELK
    #化鲲为鹏,我有话说#检查本机是否安装旧版本rpm -qa|grep docker卸载yum remove docker  docker-common docker-selinux docker-engine更新yum包yum update设置yum源yum -y install yum-utilsyum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo安装dockeryum install docker-ce  #由于repo中默认只开启stable仓库,故这里安装的是最新稳定版17.12.0启动并加入开机启动systemctl start dockersystemctl enable docker============================检索源docker search elk拉取elkdocker pull sebp/elkdocker images启动docker run -d --privileged -p 5601:5601 -p 9200:9200 -p 5044:5044 --name elk sebp/elk
总条数:476 到第
上滑加载中