Hello,
Suppose you need to use different services such as Apache, Nginx, MySQL, MongoDB, Node.js, etc. for a project. Some of these services must be connected to each other and others not. Is there a problem if only one YAML file is created for all these services?
A problem, no, I don’t think so as soon as you can manage the file easily.
Two weeks ago I’ve answered to one of your question and the answer was about the COMPOSE_FILE variable. On my side, I’m using a lot of yaml files (perhaps ten) and I mention them, in a specific order, in COMPOSE_FILE then let docker to “merge” them.
Hello,
Thank you so much for your reply.
What you mean is that I can have multiple YAML files but use COMPOSE_FILE to specify the order in which they are executed. Is it true? For example:
To understand how docker compose will “merge” files (only in memory, not on disk).
In my example, I’m using PHP, Apache, PostgreSQL and Redis. Both services are declared in their own yaml files and I’m first adding in the list the “main” file (like php) then I put the one who override it (i.e. the one who update a given node).
docker compose config will allow you to understand what will happens.
Hi,
Thank you so much for your reply.
Suppose I have several YAML files and now I want to specify the order of their execution. In which YAML file should I put the following line?
The most I read your questions, the most I think you miss prerequisites and you make a mix of a lot of things.
To your last question: no YAML files at all; it’s a command you should fired on the console. You can put such commands in a Linux script (files having .sh or .bash extensions).