docker-compose 部署 harbor

环境:centos7.6
1、安装 docker-ce (version > 17.06),修改 /etc/docker/daemon.json 配置 docker registry

如果 docker-ce 版本低于 version > 17.06,请升级

yum update docker-ce

2、安装 docker-compose

yum install docker-compose

3、进入 github 官网,下载 harbor-offline-installer-v2.0.0.tgz

4、解压,修改配置文件: 修改 hostaname、注释 https

tar -zxvf harbor-offline-installer-v2.0.0.tgz
cd harbor
cp harbor.yml.tmpl harbor.yml
...
hostname: 10.2.7.107
...
#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 following will enable tls communication between all harbor components
# internal_tls:
#   # set enabled to true means internal tls is enabled
#   enabled: true
#   # put your cert and key files on dir
#   dir: /etc/harbor/tls/internal
...

5、执行安装脚本

./install.sh

注意事项:

1、docker-compose 默认会创建 docker network harbor_harbor,网段 172.17.0.1/24。

2、执行 docker-compose down -v 后,再次执行./install.sh, harbor 中数据不会变,但是 harbor_harbor 网段会变,每次增 1

3、如果想修改 harbor_harbor 网段,可以修改 docker-compose.yml 文件( ./install.sh 会重新生成 docker-compose.yml 文件),增加

networks:
  harbor:
    external: false
    driver: bridge
    ipam:
      driver: default
      config:
      - subnet: 177.177.177.0/24
        gateway: 177.177.177.1

删除 container

docker-compose down -v

创建、启动 container

docker-compose up -d

参考文章:

https://www.jianshu.com/p/327b7b607d87

你可能感兴趣的:(运维,linux)