patternMinor
What are best practices to override complete sections using docker-compose?
Viewed 0 times
whataredockeroverridecompletepracticesusingcomposesectionsbest
Problem
The docker-compose.override contains:
The docker-compose:
When docker-compose up is run the override overwrite the
When a new volume is added to docker-compose, the override will try to mount is as well.
docker-compose.override
The docker-compose:
How to prevent that the override will use volumes that are defined in the docker-compose file?
When docker-compose.override contains
the b is still mounted...
volumes:
- ./a:/path/to/aThe docker-compose:
volumes:
- a:/path/to/aWhen docker-compose up is run the override overwrite the
./a overwrites the a.When a new volume is added to docker-compose, the override will try to mount is as well.
docker-compose.override
volumes:
- ./a:/path/to/aThe docker-compose:
volumes:
- a:/path/to/a
- b:/path/to/bHow to prevent that the override will use volumes that are defined in the docker-compose file?
When docker-compose.override contains
volumes:
- a:/path/to/a
- .b:/path/to/bthe b is still mounted...
Solution
According to this documentation it does not seem to be possible to override complete sections in docker-compose by using different docker-compose files.
If both files are present on the same directory level, Compose
combines the two files into a single configuration.
The configuration in the docker-compose.override.yml file is applied
over and in addition to the values in the docker-compose.yml file.
If both files are present on the same directory level, Compose
combines the two files into a single configuration.
The configuration in the docker-compose.override.yml file is applied
over and in addition to the values in the docker-compose.yml file.
Context
StackExchange DevOps Q#1310, answer score: 5
Revisions (0)
No revisions yet.