Skip to content

feat: support with_copy_to#976

Open
guenhter wants to merge 1 commit intotestcontainers:mainfrom
guenhter:with-copy-to
Open

feat: support with_copy_to#976
guenhter wants to merge 1 commit intotestcontainers:mainfrom
guenhter:with-copy-to

Conversation

@guenhter
Copy link

@guenhter guenhter commented Mar 4, 2026

This PR supports copying files into the container like this:

DockerContainer("alpine")
    .with_command(["cat", "/tmp/copied.txt"])
    .with_copy_to("/tmp/copied.txt", src)

To support this, I had to change how the container is started: run is not longer used, but instead create and start are used now, in order to be able to make the copy before the container is actually running.

Inspired by testcontainers/testcontainers-rs#730 where I did exactly the same feature for the rust implementation of testcontainers :)


No tests are failing

> uv run pytest -v core/tests
...
================================== 306 passed, 1 skipped, 1 warning in 161.30s (0:02:41) ==================================

@guenhter
Copy link
Author

guenhter commented Mar 4, 2026

Solves #665

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

Successfully merging this pull request may close these issues.

1 participant