| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
Solves #665 |
Sorry, something went wrong.
|
I think this is the same use case as #852 |
Sorry, something went wrong.
|
Oh yeah. Look at that. You are absolutely right. I haven't seen yours. |
Sorry, something went wrong.
|
I'll rebase and bring in the modified startup handling in order to be able to copy in files before the container is started. |
Sorry, something went wrong.
|
Hi, just a quick checkup, is this still relevant now that we have container.copy_into_container(my_file, "/tmp/my_file.txt") ready? |
Sorry, something went wrong.
|
At the moment, the following tests is not possible: def test_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)
with container:
exit_code = container._container.wait()
stdout, _ = container.get_logs()
assert exit_code["StatusCode"] == 0
assert stdout.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. |
Sorry, something went wrong.
|
@rhoban13 I've updated this PR based on your changes. Maybe you can have a quick glimpse if it seems ok for you. |
Sorry, something went wrong.
|
Ah - I see the use case, I suspect this will be a much larger piece of work. You're introducing here the notion of createing a container prior to starting it, which I think is a good idea, but feels like a different piece or work. I believe @alexanderankin has talked about the need do this, but quick glance I'm not seeing any issues tracking that work. 2 immediate workarounds I can think of would be:
|
Sorry, something went wrong.
|
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? |
Sorry, something went wrong.
|
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 |
Sorry, something went wrong.
Codecov Report❌ Patch coverage is 83.33333% with 4 lines in your changes missing coverage. Please review.
@@ 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.
|
Sorry, something went wrong.
🤖 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>
| Back | FazBrowse Home | New Git URL |
This PR supports copying files into the container before startup time:
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