i currently have a docker-compose.yaml
file with a lot of services that depend on each other.the volumes, secrets, and networks tags take a lot of lines. so i thought i would export them into multiple files.
here is what i did:
# volumes.yamlx-volumes: &volumes driver: local driver_opts: type: bind o: bind device: /data/${{str}}vol1:<<: *volumes str: bla1vol2:<<: *volumes str: bla2
and for the networks:
# networks.yamlnginx:DLNA: driver: macvlan driver_opts: parent: eth0 ipam: config: - subnet: 192.168.178.0/24 gateway: 192.168.178.1 ip_range: 192.168.178.250/32vpn_apps: driver: bridge driver_opts: com.docker.network.bridge.name: "docker-apps" com.docker.network.bridge.enable_ip_masquerade: "true" com.docker.network.bridge.enable_icc: "true" com.docker.network.driver.mtu: "1500" ipam: driver: default config: - subnet: 172.21.0.0/16 gateway: 172.21.0.1
and for secrets i did something similiar:
# secrets.yamlsec1: file: /opt/secrets/sec1sec2: file: /opt/secrets/sec2
then in my main.yaml
:
version: "3.8"volumes:<<: ./volumes.yamlnetworks: <<: ./networks.yamlsecrets:<<: ./secrets.yamlservices: portainer: image: *images.portainer container_name: portainer restart: always volumes: - vol1: /some/path - vol2: /some/path2 networks: - nginx secrets: - sec1 - sec2
I'm getting the error: "yaml: map merge requires map or sequence of maps as the value"