Uh oh!
There was an error while loading. Please reload this page.
feat: support with_copy_to - #976
Conversation
Solves #665 |
rhoban13
commented
Mar 11, 2026
I think this is the same use case as #852 |
Oh yeah. Look at that. You are absolutely right. I haven't seen yours. |
Uh oh!
There was an error while loading. Please reload this page.
alexanderankin
commented
Apr 1, 2026
still needed after #852 ? |
guenhter
commented
Apr 1, 2026
I'll rebase and bring in the modified startup handling in order to be able to copy in files before the container is started. |
Tranquility2
commented
Apr 1, 2026
Hi, just a quick checkup, is this still relevant now that we have |
At the moment, the following tests is not possible: deftest_copy_into_startup_file(transferable: Transferable):
destination_in_container="/tmp/my_file"container=DockerContainer("bash", command=f"cat {destination_in_container}")
container.with_copy_into_container(transferable, destination_in_container)
withcontainer:
exit_code=container._container.wait()
stdout, _=container.get_logs()
assertexit_code["StatusCode"] ==0assertstdout.decode() =="hello world"This is what I ment with
Who it works now: when the container is started, the file is copied into the started container. This is often crucial like when you want to copy in a config file which is used by the entrypoint script or even more: if you copy in the actual entrypoint script the container should start with. |
guenhter
commented
Apr 2, 2026
@rhoban13 I've updated this PR based on your changes. Maybe you can have a quick glimpse if it seems ok for you. |
rhoban13
commented
Apr 2, 2026
Ah - I see the use case, I suspect this will be a much larger piece of work. You're introducing here the notion of 2 immediate workarounds I can think of would be:
|
alexanderankin
commented
Apr 2, 2026
imo its ok if we start implementing create before start here (this is not a soc2 workplace where each PR needs an approved ticket), but the wait method idk if we want that at all, and image pulling would probably need a follow up to account for things like private mirrors, image pull policy (never, ifabsent, always), etc. other than that it looks ok, right? |
alexanderankin
commented
Apr 2, 2026
ok so lets centralize the discussion about creating before starting #997 because maybe there are some nuances to discuss although im not sure what they are, my approach was going to be to release some release candidates before the next minor version to test this stuff out |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@## main #976 +/- ##
==========================================
- Coverage 83.05% 82.97% -0.09%
==========================================
Files 16 16 Lines 1700 1721 +21 Branches 186 189 +3 ==========================================
+ Hits 1412 1428 +16 - Misses 234 236 +2 - Partials 54 57 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Uh oh!
There was an error while loading. Please reload this page.
🤖 I have created a release *beep* *boop* --- ## [4.15.0-rc2](testcontainers-v4.15.0-rc.1...testcontainers-v4.15.0-rc2) (2026-04-30) ### Features * **core:** support TESTCONTAINERS_HUB_IMAGE_NAME_PREFIX ([#961](#961)) ([be9a0a6](be9a0a6)) * **mongodb:** Add Atlas Local for MongoDb ([#873](#873)) ([73aeb43](73aeb43)) * support with_copy_to ([#976](#976)) ([59ec1ce](59ec1ce)) * **valkey:** add Valkey module ([#947](#947)) ([fc09dc1](fc09dc1)) ### Bug Fixes * **azurite:** use `HttpWaitStrategy` instead of deprecated `wait_container_is_ready` ([#1003](#1003)) ([9fe6b07](9fe6b07)), closes [#874](#874) * fix pr [#961](#961) ([#1011](#1011)) ([8eff908](8eff908)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: David Ankin <daveankin@gmail.com>
This PR supports copying files into the container before startup time:
To support this, I had to change how the container is started:
runis not longer used, but insteadcreateandstartare used now, in order to be able to make thecopybefore 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