Skip to content

Conversation

cimnine
Copy link
Contributor

@cimnine cimnine commented Jul 17, 2025

What does this PR do?

This change should make it more explicit that, when providing a string, the target is always a directory and never a file path. To specify a file path, a instance of FileInfo must be passed.

Why is it important?

When coming from docker-compose.yml, it is unexpected that the second argument of WithResourceMapping is always a path to a directory, never a file.

Given .WithResourceMapping(new FileInfo("file.txt"), "/file.txt");, my expectation was a file at /file.txt, but it ends up at /file.txt/file.txt in the container.

Related issues

Relates to #1486

Add an example for copying to a file. This should make it more explicit that, when providing a string, the target is a directory, not a file. For a file to be a target, a `FileInfo` must be passed.

Relates to testcontainers#1486
Copy link

netlify bot commented Jul 17, 2025

Deploy Preview for testcontainers-dotnet ready!

Name Link
🔨 Latest commit 75b6be1
🔍 Latest deploy log https://app.netlify.com/projects/testcontainers-dotnet/deploys/6878d958ea7bbb00099f279a
😎 Deploy Preview https://deploy-preview-1487--testcontainers-dotnet.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@HofmeisterAn HofmeisterAn added the documentation Docs, docs, docs. label Jul 17, 2025
@HofmeisterAn HofmeisterAn changed the title Improve WithResourceMapping examples docs: Extend example copying files to a container Jul 17, 2025
Copy link
Collaborator

@HofmeisterAn HofmeisterAn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@HofmeisterAn HofmeisterAn merged commit a35862d into testcontainers:develop Jul 17, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Docs, docs, docs.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants