How to use docker-compose with more projects?

I am a beginnner using Docker and Docker-compose.
I have several different projects, in different folders, each one with his own docker-compose.yml and each one with two or more containers.

The projects are completely unrelated. However when I type docker-compose up all the containers of all projects are started. Why? How can I run only the containers of one project?

Thank you.

If you are in a folder of a project, and there is only 1 docker-compose.yml file, and you type: docker-compose up -d, only that one project will start

Thank you, I thought this too, but this is not the case… other containers in other projects are started too

Can you explain/show your structure?
are the subdirectories on where you run the command where there are other docker-compose files?

I have destroyed all my containers and recreated them, and I cannot reproduce the issue anymore :frowning:

Good your got it resolved, sad that we dont know what caused it :wink:

Just for the records, I finally found out how to reproduce the error and why. All my projects contained a folder “Compose” containing docker-compose.yml. So, docker-compose recognises all projects as the same project “Compose”.

see docker compose orphan containers warning - Stack Overflow

That’s to be expected. The project name is what seperates the deployments. If no project name is provided (e.g. --project-name myproject1), the foldername will be used as the project name.

  -p, --project-name NAME     Specify an alternate project name
                              (default: directory name)

source: Overview of docker-compose CLI | Docker Documentation