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
评论区