How does Docker Compose work with multiple .yml files?

Experience Level: Senior
Tags: Docker Compose

Answer

You can combine a configuration from multiple files like this:

docker compose -f file1.yml -f file2.yml -f file3.yml up

When you do this, Docker Compose processes files from the first one to the last one, in the order as they are defined. If the file defined later contains the same property as a file defined earlier, the property values are overridden.

Comments

No Comments Yet.
Be the first to tell us what you think.
Docker Compose
Docker Compose

Are you learning Docker Compose ? Try our test we designed to help you progress faster.

Test yourself