侧边栏壁纸
博主头像
WinJay博主等级

博观而约取 厚积而薄发

  • 累计撰写 306 篇文章
  • 累计创建 165 个标签
  • 累计收到 1 条评论
隐藏侧边栏

Docker-Compose挂载本地目录示例

WinJay
2021-12-02 / 0 评论 / 0 点赞 / 39 阅读 / 1,881 字 / 正在检测是否收录...
温馨提示:
本文最后更新于 2022-01-20,若内容或图片失效,请留言反馈。部分素材来自网络,若不小心影响到您的利益,请联系我们删除。

Docker-Compose挂载本地目录示例

# 执行时自动获取当前绝对路径并进行填充写入配置文件


volumes:
  - ./Proxy-nginx:/etc/nginx

## Demo
 portal:
    image: goharbor/harbor-portal:v2.2.1
    container_name: harbor-portal
    restart: always
    cap_drop:
      - ALL
    cap_add:
      - CHOWN
      - SETGID
      - SETUID
      - NET_BIND_SERVICE
    volumes:
      - type: bind
        source: ./common/config/portal/nginx.conf
        target: /etc/nginx/nginx.conf


---
services:
  log:
    image: goharbor/harbor-log:v2.2.1
    container_name: harbor-log
    restart: always
    dns_search: .
    cap_drop:
      - ALL
    cap_add:
      - CHOWN
      - DAC_OVERRIDE
      - SETGID
      - SETUID
    volumes:
      - /mnt/000.Docker/003.Harbor/log//:/var/log/docker/:z
      - type: bind
        source: ./common/config/log/logrotate.conf
        target: /etc/logrotate.d/logrotate.conf
      - type: bind
        source: ./common/config/log/rsyslog_docker.conf
        target: /etc/rsyslog.d/rsyslog_docker.conf

---
  redis:
    image: goharbor/redis-photon:v2.2.1
    container_name: redis
    restart: always
    cap_drop:
      - ALL
    cap_add:
      - CHOWN
      - SETGID
      - SETUID
    volumes:
      - /mnt/000.Docker/003.Harbor/Data/redis:/var/lib/redis



---
  proxy:
    image: goharbor/nginx-photon:v2.2.1
    container_name: nginx
    restart: always
    cap_drop:
      - ALL
    cap_add:
      - CHOWN
      - SETGID
      - SETUID
      - NET_BIND_SERVICE
    volumes:
      - ./common/config/nginx:/etc/nginx:z
      - /mnt/000.Docker/003.Harbor/Data/secret/cert:/etc/cert:z
      - type: bind
        source: ./common/config/shared/trust-certificates
        target: /harbor_cust_cert



---
  core:
    image: goharbor/harbor-core:v2.2.1
    container_name: harbor-core
    env_file:
      - ./common/config/core/env
    restart: always
    cap_drop:
      - ALL
    cap_add:
      - SETGID
      - SETUID
    volumes:
      - /mnt/000.Docker/003.Harbor/Data/ca_download/:/etc/core/ca/:z
      - /mnt/000.Docker/003.Harbor/Data/:/data/:z
      - ./common/config/core/certificates/:/etc/core/certificates/:z
      - type: bind
        source: ./common/config/core/app.conf
        target: /etc/core/app.conf
      - type: bind
        source: /mnt/000.Docker/003.Harbor/Data/secret/core/private_key.pem
        target: /etc/core/private_key.pem
      - type: bind
        source: /mnt/000.Docker/003.Harbor/Data/secret/keys/secretkey
        target: /etc/core/key
      - type: bind
        source: ./common/config/shared/trust-certificates
        target: /harbor_cust_cert

0

评论区