Search code examples
dockerserverdocker-composedroplet

How to run a few Docker Compose with similar names of images?


I have >10 projects with similar architecture, but not identical. Names of images in docker-compose are the same. So I need to run all of them on one droplet. How can I run it with out conflicts?


Solution

  • Docker compose uses the current directoy as "project name", for example:

    cd foo
    docker-compose up
    

    This will create every service declared as foo_<servicename>_1.

    You can specify a parameter on docker-compose changing the default project name for each compose file:

    docker-compose --file mycompose.yml --project-name anyname up
    

    --file can be -f and --project-name can be -p