- 添加CentOS-7仓库的变量
echo 7 > /etc/yum/vars/releasever
为啥是7,我用到的是CentOS-7的软件源,你们用来其他版本的自由设置。不设置该变量,会导致Docker源失效。至于为啥失效,看下Docker源的文件就知道了
- 参照Docker官方链接,添加Docker最新源
#移除旧版本 sudo yum remove docker \ docker-client \ docker-client-latest \ docker-common \ docker-latest \ docker-latest-logrotate \ docker-logrotate \ docker-engine sudo yum install -y yum-utils
#添加安装源
sudo yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
3.参照Docker官方链接
#安装最新版的Docker sudo yum install docker-ce docker-ce-cli containerd.io docker-compose-plugin
遇到的问题
1. 安装失败,提示 “需要:container-selinux >= 2:2.74”
X86架构下的解决方案
请参考链接
ARM架构下的解决方案
第一步:编辑repo源
vi /etc/yum.repo.d/CentOS-Base.repo, 写入以下内容
# CentOS-Base.repo # # The mirror system uses the connecting IP address of the client and the # update status of each mirror to pick mirrors that are updated to and # geographically close to the client. You should use this for CentOS updates # unless you are manually picking other mirrors. # # If the mirrorlist= does not work for you, as a fall back you can try the # remarked out baseurl= line instead. # # [base] name=CentOS-$releasever - Base #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os baseurl=http://mirrors.ustc.edu.cn/centos-altarch/$releasever/os/$basearch/ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-AltArch-Arm32 #released updates [updates] name=CentOS-$releasever - Updates # mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates baseurl=http://mirrors.ustc.edu.cn/centos-altarch/$releasever/updates/$basearch/ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-AltArch-Arm32 #additional packages that may be useful [extras] name=CentOS-$releasever - Extras # mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras baseurl=http://mirrors.ustc.edu.cn/centos-altarch/$releasever/extras/$basearch/ gpgcheck=0 #跳过检测,不然会报错:fuse-overlayfs-0.7.2-6.el7_8.aarch64.rpm is not installed gpg key enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-AltArch-Arm32 #additional packages that extend functionality of existing packages [centosplus] name=CentOS-$releasever - Plus # mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus baseurl=http://mirrors.ustc.edu.cn/centos-altarch/$releasever/centosplus/$basearch/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-AltArch-Arm32
第二步:获取GPG Key
不获取GPG KEY,安装部分软件会报“Error:GPG check FAILED”,当然也可以将gpgcheck=1改为gpgcheck=0去跳过校验,但是不建议。
获取GPG KEY有导入和下载两种方式,二选一即可。
1.导入
rpm --import https://www.centos.org/keys/RPM-GPG-KEY-CentOS-7 rpm --import https://www.centos.org/keys/RPM-GPG-KEY-CentOS-7-aarch64 rpm --import https://www.centos.org/keys/RPM-GPG-KEY-CentOS-SIG-AltArch-Arm32
2.下载
cd /etc/pki/rpm-gpg wget https://www.centos.org/keys/RPM-GPG-KEY-CentOS-7 wget https://www.centos.org/keys/RPM-GPG-KEY-CentOS-7-aarch64 wget https://www.centos.org/keys/RPM-GPG-KEY-CentOS-SIG-AltArch-Arm32
第三步:参照解决方案2的步骤3,安装最新的Docker即可
2. fuse-overlayfs-0.7.2-6.el7_8.aarch64.rpm is not installed gpg key
该问题应该是GPG Key没有安装完全导致的。我采用了比较粗暴的解决方案,将CentOS-Base.repo [extras]源的gpgcheck=1改为gpgcheck=0,跳过GPG检测。
1. 首先开始pull zabbix所需要模块的镜像,我自己用的docker版本是20.10.9
docker pull mysql:8-oracle docker pull zabbix/zabbix-server-mysql:centos-latest docker pull zabbix/zabbix-web-nginx-mysql:latest docker pull zabbix/zabbix-agent:latest docker pull zabbix/zabbix-java-gateway:latest
mysql:5.7数据服务没啥可说
zabbix-server后端镜像,选择支持MySQL数据库zabbix-server-mysql,选择的是centos-latest版本,后面如果想自己重做镜像的话,需要exec进入容器中,选择centos版本,用着会更简单一点。
Zabbix-web镜像,这里使用的是基于Nginx web服务器及支持MySQL数据库的Zabbix web接口zabbix/zabbix-web-nginx-mysql
zabbix-java-gateway镜像,Zabbix本身不支持直接监控Java,而是使用zabbix-java-gateway监控jvm/tomcat性能
abbix/zabbix-agent镜像, 可以运行在各种支持的平台上,包括 Linux、UNIX 和 Windows,并从设备收集 CPU、内存、磁盘和网络接口使用情况等数据
2.下载完镜像开始搭建容器
docker run --name mysql-server -t -e MYSQL_DATABASE="zabbix" -e MYSQL_USER="zabbix" -e MYSQL_PASSWORD="zabbix" -e MYSQL_ROOT_PASSWORD="zabbixroot" -v /sfapp/docker/mysql:/var/lib/mysql -v /etc/localtime:/etc/localtime -d mysql --character-set-server=utf8 --collation-server=utf8_bin docker run --name zabbix-server-mysql -t -e DB_SERVER_HOST="mysql-server" -e MYSQL_DATABASE="zabbix" -e MYSQL_USER="zabbix" -e MYSQL_PASSWORD="zabbix" -e MYSQL_ROOT_PASSWORD="zabbixroot" -v /etc/localtime:/etc/localtime --link mysql-server:mysql -p 10051:10051 -d zabbix/zabbix-server-mysql:centos-latest docker run --name zabbix-web-nginx-mysql -t -e DB_SERVER_HOST="mysql-server" -e MYSQL_DATABASE="zabbix" -e MYSQL_USER="zabbix" -e MYSQL_PASSWORD="zabbix" -e MYSQL_ROOT_PASSWORD="zabbixroot" -v /etc/localtime:/etc/localtime --link mysql-server:mysql --link zabbix-server-mysql:zabbix-server -p 8090:8080 -d zabbix/zabbix-web-nginx-mysql:latest docker run --name zabbix_agent --link zabbix-server-mysql:zabbix-server -e ZBX_HOSTNAME="zabbix-server-mysql" -e ZBX_SERVER_PORT="10051" -e ZBX_SERVER_HOST="192.168.1.100" -p 10050:10050 -d zabbix/zabbix-agent:latest docker run -v /etc/localtime:/etc/localtime -dit --restart=always --name=zabbix-java-gateway zabbix/zabbix-java-gateway:latest
账号:Amdin 密码:zabbix
测试没问题了,可以使用了,但我的目录是以后秒搭建,所以接下来准备自己写compoes.yml文件
删除指定容器
docker rm -f <containerid>
删除未启动成功的容器
docker rm $(docker ps -a|grep Created|awk '{print $1}') 或者 docker rm $(docker ps -qf status=created)
删除退出状态的容器
docker rm $(docker ps -a|grep Exited|awk '{print $1}') 或者 docker rm $(docker ps -qf status=exited)
删除所有未运行的容器
docker rm $(docker ps -a -q) #正在运行的删除不了,所有未运行的都被删除了 或者 docker container prune #Docker 1.13版本以后,可以使用 docker containers prune 命令,删除孤立的容器
问题:安装mysql
root@4:~# docker pull mysql Using default tag: latest latest: Pulling from library/mysql no matching manifest for linux/arm64/v8 in the manifest list entries
解决办法:
docker pull mysql:8-oracle
参考链接
docker搭建zabbix
ARM架构下银河麒麟V10系统安装最新版本Docker
标签:CentOS,V10,GPG,etc,zabbix,mysql,docker From: https://www.cnblogs.com/shuai666/p/16987895.html