Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

docker-compose.yml file naming convention [closed]

Tags:

What is the naming convention for the docker-compose.yml file? Should it always be named like this or am I free to rename it to, for instance, docker-compose-jenkins.yml?

like image 246
Titulum Avatar asked Apr 08 '18 13:04

Titulum


People also ask

What should be the name of the Docker compose file?

The default filename is docker-compose. yml . You can name the manifest name as you like, but you have to pass the filename in the docker-compose command.

Can you rename Docker compose file?

Given that the tool supports using any file name you'd like, you're free to name the file whatever you'd like. In fact, you can even specify multiple files at once.

What file format is used by the Docker Compose configuration file?

The Compose file is a YAML file defining services, networks and volumes. The default path for a Compose file is ./docker-compose.yml . Tip: You can use either a .yml or .yaml extension for this file. They both work.

How do I validate a docker compose file?

Validating your file now is as simple as docker-compose -f docker-compose. yml config . As always, you can omit the -f docker-compose. yml part when running this in the same folder as the file itself or having the COMPOSE_FILE environment variable pointing to your file.


1 Answers

default name:

Note that docker-compose.yml is the default name so if you want to use docker-compose up without specifying a filename, you will need to use that format. As mentioned, you can use multiple files as overrides (see docs), by specifying one file per -f argument.

Docker reference:

The -f flag is optional. If you don’t provide this flag on the command line, Compose traverses the working directory and its parent directories looking for a docker-compose.yml and a docker-compose.override.yml file. You must supply at least 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.

[docs link]

like image 158
ldg Avatar answered Oct 12 '22 23:10

ldg