docker-compose.yml:
version: '3.7'
services:
db:
image: mysql:8.0
docker-compose.test.yml:
version: '3.7'
services:
db:
ports:
- 3306:3306
docker-compose config
does not show the port. Why?
I'm trying to display the effective compose file, means: the merge result that is also used by docker-compose up
.
docker-compose version 1.25.0
According to the documentation, docker-compose will only automatically find files named docker-compose.yml
and docker-compose.override.yml
:
By default, Compose reads two files, a
docker-compose.yml
and an optionaldocker-compose.override.yml
file. By convention, thedocker-compose.yml
contains your base configuration. The override file, as its name implies, can contain configuration overrides for existing services or entirely new services.
If you want to use additional compose files, you need to specify them explicitly using -f <filename>
:
docker-compose up -f docker-compose.yml -f docker-compose.test.yml