Skip to content

Conversation

@LaurentRDC
Copy link
Collaborator

This PR adds a new function, withCopyFileToContainer, which allows to, well, copy files to a container. This is very useful, for example, when initializing a Postgres database.

In order to copy files to the container, the run function was modified to use docker create + docker start rather than docker run. This allows to get the container ID early (from docker create), and thus copy files using docker cp before calling docker start.

@LaurentRDC LaurentRDC requested a review from alexbiehl as a code owner July 31, 2025 02:03
dockerCreate =
concat $
[["run"]]
++ [["--detach"]]
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Note that the --detach flag isn't supported by docker start, because this is the default behavior

Copy link
Collaborator

@alexbiehl alexbiehl left a comment

Choose a reason for hiding this comment

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

Good stuff!

@alexbiehl
Copy link
Collaborator

If you rebase your changes we should get a working CI again.

@LaurentRDC
Copy link
Collaborator Author

I also updated the Changelog, assuming that the next release will be 0.5.2.0

Copy link
Collaborator

@alexbiehl alexbiehl left a comment

Choose a reason for hiding this comment

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

Good stuff!

@alexbiehl alexbiehl merged commit e64665a into testcontainers:master Jul 31, 2025
6 checks passed
@LaurentRDC LaurentRDC deleted the copy-files branch July 31, 2025 14:07
@LaurentRDC
Copy link
Collaborator Author

Thanks for the quick turnaround :)

@LaurentRDC
Copy link
Collaborator Author

@alexbiehl Would you be able to create a new release, 0.5.2.0, to deploy this change?

Alternatively, I see I'm allowed to upload releases on Hackage, but I'm not allowed to commit to this repo directly. If you prefer, you could give me permission to commit on the master branch (so I can update the cabal file) and I can create a release myself

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.

2 participants