FluentDocker icon indicating copy to clipboard operation
FluentDocker copied to clipboard

How to pass multiple compose files like -f <file> -f <other file>?

Open ci-vamp opened this issue 3 years ago • 1 comments

here is what i am trying to accomplish

docker-compose --project-directory ./docker -f docker-compose.yml -f docker-compose.prod.yml up

got the following exception

Unhandled exception. Ductus.FluentDocker.Common.FluentDockerException: Could not dispose composite service from file(s) docker-compose.yml, docker-compose.prod.yml

attempt with fluent docker

using Ductus.FluentDocker.Services;
using Ductus.FluentDocker.Services.Impl;
using Ductus.FluentDocker.Model.Compose;

var hosts = new Hosts().Discover();
var _docker = hosts.FirstOrDefault(host => host.IsNative) ?? hosts.FirstOrDefault(host => host.Name == "default");

var composeConfig = new DockerComposeConfig
{
    ProjectDirectory = Path.Combine(Directory.GetCurrentDirectory(), "docker"),
    ComposeFilePath = new List<string> { "docker-compose.yml", "docker-compose.prod.yml" },
    ForceRecreate = true,
    RemoveOrphans = true,
    StopOnDispose = true,
};


using (var serviceManager = new DockerComposeCompositeService(_docker, composeConfig))
{
    foreach (var container in serviceManager.Containers)
    {
        Console.WriteLine(container.Name);
    }
}

ci-vamp avatar Nov 16 '22 19:11 ci-vamp

Thanks @ms-vamp for your bug report! I'll add it to my long todo list - but this one should be fairly simple to fix.

Cheers, Mario :)

mariotoffia avatar Nov 28 '22 08:11 mariotoffia