Orphaned Docker Containers

Occasionally during docker-compose up you’ll get a warning like Found orphan containers (xyz …) for this project even though the containers from the warning are not related to the current project. The thing is that docker-compose uses the current directory name as the project name.

If you have the docker-compose.yml in a subdirectory named docker—as many tutorials suggest—docker-compose will use docker as the project name.

The solution is to either set an environment variable with the project name on the command line or in an .env file.