环境
centos 7
docker
docker-compose
安装 docker-compose
https://github.com/docker/compose/releases/download/v2.13.0/docker-compose-linux-armv6
下载docker-compose
╰─# curl -L "https://github.com/docker/compose/releases/download/v2.13.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 100 43.5M 100 43.5M 0 0 1172k 0 0:00:38 0:00:38 --:--:-- 521k ╭─root@k202 ~ ╰─#
设置执行权限
╰─# chmod +x /usr/local/bin/docker-compose ╭─root@k202 ~ ╰─#
查看是否安装成功
╰─# docker-compose --version Docker Compose version v2.13.0 ╭─root@k202 ~ ╰─#
安装mysql
下载mysql镜像
docker pull mysql
运行mysql
docker run --name mysql -e MYSQL_ROOT_PASSWORD=123456 -d mysql:latest
安装harbor
下载harbor安装文件
wget https://github.com/goharbor/harbor/releases/download/v1.10.15/harbor-online-installer-v1.10.15.tgz
解压:
╰─# tar -zxvf harbor-online-installer-v1.10.15.tgz harbor/prepare harbor/LICENSE harbor/install.sh harbor/common.sh harbor/harbor.yml
编辑harbor/harbor.yml文件, 修改简单配置
# The IP address or hostname to access admin UI and registry service. # DO NOT use localhost or 127.0.0.1, because Harbor needs to be accessed by external clients. hostname: 192.168.10.202 # http related config http: # port for http, default is 80. If https enabled, this port will redirect to https port port: 28080 # https related config # 注释的https,如果不使用 #https: # https port for harbor, default is 443 # port: 443 # The path of cert and key files for nginx #certificate: /your/certificate/path #private_key: /your/private/key/path # Uncomment external_url if you want to enable external proxy # And when it enabled the hostname will no longer used # external_url: https://reg.mydomain.com:8433 # The initial password of Harbor admin # It only works in first time to install harbor # Remember Change the admin password from UI after launching Harbor. harbor_admin_password: admin # Harbor DB configuration database: # The password for the root user of Harbor DB. Change this before any production use. password: root123 # The maximum number of connections in the idle connection pool. If it <=0, no idle connections are retained. max_idle_conns: 50 # The maximum number of open connections to the database. If it <= 0, then there is no limit on the number of open connections. # Note: the default number of connections is 100 for postgres. max_open_conns: 100 # The default data volume data_volume: /harbor/data ....
执行harbor的安装脚本
执行.prepare, 进行准备工作
╭─root@k202 ~/harbor/harbor ╰─# ./prepare
安装harbor:
╰─# ./install.sh [Step 0]: checking if docker is installed ... Note: docker version: 20.10.17 [Step 1]: checking docker-compose is installed ... Note: docker-compose version: 2.13.0 [Step 2]: preparing environment ... [Step 3]: preparing harbor configs ... prepare base dir is set to /root/harbor/harbor Unable to find image 'goharbor/prepare:v1.10.15' locally
harbor 启动成功
浏览器打开harbor界面
用户名/密码: admin / admin
修改docker配置文件,使docker支持harbor
╰─# vim /etc/docker/daemon.json { "insecure-registries": [ "dev.kmx.k2data.com.cn:5001", "registry.docker-cn.com", "docker.mirrors.ustc.edu.cn", "192.168.10.202:28080" # docker 支持harbor ], "exec-opts":["native.cgroupdriver=systemd"], "registry-mirrors": [ "http://ovfftd6p.mirror.aliyuncs.com", "http://registry.docker-cn.com", "http://docker.mirrors.ustc.edu.cn", "http://hub-mirror.c.163.com" ] } ~ ~
重启docker
systemctl restart docker.service