Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not dispose composite service #269

Open
codechrysalis-doug opened this issue Aug 9, 2022 · 6 comments
Open

Could not dispose composite service #269

codechrysalis-doug opened this issue Aug 9, 2022 · 6 comments

Comments

@codechrysalis-doug
Copy link

codechrysalis-doug commented Aug 9, 2022

Hello, I inherited a legacy codebase and am not familiar with C#. The application is dockerized, so I tried running it in AWS ECS and this is the error I received. If this is the wrong place to ask, could you please point me in the right direction?

2022-08-09 17:20:50[08:20:50 ERR] Top Level Exception occured. Trying to soldier on! Could not dispose composite service from file(s) /app/images/node-git-karma/docker-compose.yaml
2022-08-09 17:20:50 Ductus.FluentDocker.Common.FluentDockerException: Could not dispose composite service from file(s) /app/images/node-git-karma/docker-compose.yaml
2022-08-09 17:20:50 at Ductus.FluentDocker.Services.Impl.DockerComposeCompositeService.Dispose()
2022-08-09 17:20:50 at Ductus.FluentDocker.Fd.Run[T](Func`2 builder, Action`1 run, String name)
2022-08-09 17:20:50 at Ductus.FluentDocker.Fd.Composite(Func`2 builder, Action`1 run, String name)

Does anyone have an idea of what this might mean? the image is in there and the file exists, but am not certain on why it's failing.

Here is the version:

<PackageReference Include="Ductus.FluentDocker" Version="2.8.3" />

Here is the code in question:

      var image = Path.Combine(Directory.GetCurrentDirectory(),
        "images",
        ImageName,
        "docker-compose.yaml");
      
      ...

      Fd.Composite(
        c => c.UseContainer()
          .UseCompose()
          .FromFile(image)
          .RemoveOrphans()
          .ForceBuild(),
        svc =>
        {
          ...
        });
@mariotoffia
Copy link
Owner

Hi @codechrysalis-doug. Can you, please, check your console (if you enable logging) what docker commands being executed during dispose? If you run those manually what is the output?

@codechrysalis-doug
Copy link
Author

Hi @codechrysalis-doug. Can you, please, check your console (if you enable logging) what docker commands being executed during dispose? If you run those manually what is the output?

Hey, thank you for getting back to me! I checked the https://github.com/mariotoffia/FluentDocker#logging and wasn't sure which file that configuration belonged to. Could you explain to me how I can set the logs? I have no experience with C# and it's ecosystems, my apologies.

I did find in the code base there was a logger set, but the logs didn't give the granularity that you mentioned.

    private static void ConfigureLogging()
    {
      Log.Logger = new LoggerConfiguration()
        .MinimumLevel.Debug()
        .WriteTo.Console()
        .CreateLogger();
    }

@codechrysalis-doug
Copy link
Author

codechrysalis-doug commented Aug 20, 2022

Hi @codechrysalis-doug. Can you, please, check your console (if you enable logging) what docker commands being executed during dispose? If you run those manually what is the output?

Follow-up: I tried to enable logging and a few other things and I wasn't able to get the FluentDocker to give me the logs even with log level debug. It does show me the error, but that's it. Do you have an example project for how I can get the logs from FluentDocker running the container?

@mariotoffia
Copy link
Owner

Hi @codechrysalis-doug sorry for late reply. Can you please test LoggerTests.cs.

If it works properly, you should get the following log statements.

Ductus.FluentDocker: message 1
Ductus.FluentDocker: message 2
Ductus.FluentDocker: message 3

Btw do you enable logging via

Logging.Enabled();

Cheers,
Mario :)

@gbirchmeier
Copy link

gbirchmeier commented Mar 15, 2023

Get anywhere on this? I'm finding a possibly similar issue.

The error is:
Ductus.FluentDocker.Common.FluentDockerException : Could not dispose composite service from file(s) docker-compose.yaml

and the top of the stacktrace is just a call to

    _compose.Dispose(); // var is a DockerComposeCompositeService

It's not much help in diagnosing the problem.

@codechrysalis-doug
Copy link
Author

Get anywhere on this? I'm finding a possibly similar issue.

The error is: Ductus.FluentDocker.Common.FluentDockerException : Could not dispose composite service from file(s) docker-compose.yaml

and the top of the stacktrace is just a call to

    _compose.Dispose(); // var is a DockerComposeCompositeService

It's not much help in diagnosing the problem.

I made some progress by further debugging into the application level. It seems the errors didn't bubble up in our situation, but we ultimately decided to move away from using this all together in favor of a more cloud native solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants