Skip to content

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

@ci-vamp

Description

@ci-vamp

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);
    }
}

Metadata

Metadata

Assignees

Labels

Projects

Status

No status

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions