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
feat: Add docker compose support (#122) #1082
base: develop
Are you sure you want to change the base?
feat: Add docker compose support (#122) #1082
Conversation
✅ Deploy Preview for testcontainers-dotnet ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Thanks for the initial PR. Could you please provide additional information in the PR description, specifying which parts are addressed by the PR and which parts are not covered, in comparison to the features provided by Java? Additionally, what aspects do we need to take care of afterward? What follow-ups are necessary, etc.? |
I have added some additional information, but I am not sure that this is enough. Please take a look at this. |
Thanks. I will need some days to review it. A lot of other topics have accumulated over the holidays. |
Hi, Any updates here? |
Sorry, I haven't had the time yet, but it is the next item in my GH inbox. I cannot promise it, but I will try to look at it sometime next week. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the PR. Sorry for the late response, I hadn't found the time earlier. I still need to run and test it locally. Meanwhile, I have a couple of suggestions and improvements. It would be great if we could discuss and address them in the meantime. Thanks again for your contribution.
Thanks, I think next week, I'll check and fix all the issues. |
I think it's done, could you please review the code again? |
Please see my suggestions and comments here: nkz-soft#1. Overall, it looks good, but there are still a few things we need to discuss and sort out first. |
…cker-compose-1 refactor: Reuse the the builder configuration in local mode
Hello all. Best Regards |
What does this PR do?
Adds docker compose support
Why is it important?
We have docker compose support for java implementations, but that's not here yet. This PR does not contain a complete implementation of all methods in the java library, but it is a starting point from which you can begin to port the rest of the methods.
Related issues
WithDockerCompose
#122Additional information
At this time, there are only two methods in the
DockerComposeBuilder
class:WithLocalCompose
- Specifies thedocker-compose
file that needs to be executed.WithComposeFile
- Whether or not to executedocker-composer
locally or in a container.Additional methods are available for implementing in Java, listed in order of importance (to me):
withOptions
- Adds options to the docker-compose command, e.g. docker-compose --compatibility.withRemoveImages
- Remove images after containers shutdown.withRemoveVolumes
- Remove volumes after containers shut down.withBuild
- Whether to always build images before starting containers.withExposedService
- Specifies the port for current service. According to the documentation, Testcontainers will spin up a small 'ambassador' container, which will proxy between the Compose-managed containers and ports that are accessible to your tests. This is done using a separate, minimal container that runs socat as a TCP proxy. I don't fully understand the necessity of creating a proxy (ambassador) container here, perhaps to avoid port conflicts or to allow the port to listen.getServiceHost
- Returns the IP address where the container is listening (via an ambassador container).getServicePort(serviceName, servicePort)
- Returns the Docker mapped port for a port that has been exposed (via an ambassador container).It's my opinion that we should start with the first four methods that cover 90% of the functionality.
The implementation of proxy and port forwarding functions in docker-compose can be done directly through a yaml file.