question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add missing function `WithDockerCompose`

See original GitHub issue

Is your feature request related to a problem? Please describe. I love the approach of having a single container scenario for a test case but there are also scenarios where I’d like to spin up a whole set of containers and therefore use docker-compose as declaration.

Describe the solution you’d like I’d like to spin up a set of containers by specifying a docker-compose.yml similar to the Java version https://www.testcontainers.org/modules/docker_compose/

Describe alternatives you’ve considered Not sure If there is one

  • configuring the things as in the compose in code seems odd to me and leads to duplication of configuration and most of the times docker-compose.yml will also be used to deploy the application under test this would be strange.

Additional context Also other library authors could benefit from such an approach, I happen to know that https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks is using compose and I think it would be great improvement on there development experience (since you don’ t have to remember starting the containers in advance 😉 )

Cheers & let me know what you think of the idea

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:16
  • Comments:23

github_iconTop GitHub Comments

5reactions
LoremFooBarcommented, Aug 2, 2022

Thinking about the API design for this, I have a few points to raise:

  1. Since all of the public API surface revolves around working with a single container, I propose this API for compose:

    var compose = new DockerComposeBuilder()
      .WithComposeFile("path/to/docker-compose.yml")
      .Build();
    
    await compose.UpAsync();
    await compose.DownAsync();
    
  2. Regarding implementation - since compose is not part of the Docker Engine API, and the docker compose command has been part of Docker Desktop for a while now, I assume it is acceptable to use the docker compose command for the different compose methods (docker compose up, docker compose down etc.).

2reactions
HofmeisterAncommented, Aug 3, 2022

It would be nice to consider the testcontainers-java implementation. I’m not very familiar with it, but I think it is a good idea not to differentiate too much. OC, it should still be idiomatic with .NET.

Read more comments on GitHub >

github_iconTop Results From Across the Web

laravel - Docker-compose up missing files
My question is simple , when docker-compose build : some new folders will be generated using npm run prod command , I've added...
Read more >
Compose Build Specification
Compose warns you about the missing image attribute which prevents images being pushed. A Compose implementation may offer a mechanism to compute an...
Read more >
docker compose up
The docker compose up command aggregates the output of each container (like docker compose logs ... --no-build, Don't build an image, even if...
Read more >
Install the Compose plugin
Download and install Docker Compose on Linux with this step-by-step handbook. This plugin can be installed manually or by using a repository.
Read more >
'command not found' when I try to run docker-compose
I'm running Armbian (Debian Buster arm64) on an Odroid HC2 (XU4). I installed Docker Compose using the instrux found in the Linux section...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found