minus-squareJuanjo Salvador@programming.devtoDocker@programming.dev•Is it possible to inherit declarations from one Docker-Compose.yaml to another?linkfedilinkEnglisharrow-up4·10 months agoAnswer has been solved but, just in case someone is curious about it: yes, is possible to extend a docker-compose.yaml file with another. From Docker’s docs: https://docs.docker.com/compose/multiple-compose-files/extends/ You can have a common-services.yml file (or whatever name you want to give to it) with a service defined inside, like this: services: webapp: build: . ports: - "8000:8000" volumes: - "/data" And then, in your docker-compose.yaml file just extend it with more specific things. services: web: extends: file: common-services.yml service: webapp linkfedilink
Answer has been solved but, just in case someone is curious about it: yes, is possible to extend a
docker-compose.yaml
file with another.From Docker’s docs: https://docs.docker.com/compose/multiple-compose-files/extends/
You can have a
common-services.yml
file (or whatever name you want to give to it) with a service defined inside, like this:services: webapp: build: . ports: - "8000:8000" volumes: - "/data"
And then, in your
docker-compose.yaml
file just extend it with more specific things.services: web: extends: file: common-services.yml service: webapp