Commit Container? #1072
-
Hello, I'm currently looking into testcontainers to speedup our test process.
and now I want to commit the container so that it can be used by all test assemblies. I can build this container either with a msbuild task or with a I know that I can put the sql script inside the container but the script would still load a while, so I want to load it upfront and save it so that postgres always has the initial migration data already inside the container. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Committing a container state is not yet built into Testcontainers for .NET. I double-checked the Docker Engine API, including Docker.DotNet, both expose the necessary APIs 👍. This is something we need to implement. Would you be interested in contributing this feature? In the meantime, you can achieve something similar with the image builder API (schema initialization during the build) or by utilizing Docker volumes. However, both approaches will not work with the integrated cleanup mechanism of Testcontainers, so you will need to disable it. |
Beta Was this translation helpful? Give feedback.
This is very likely, Ryuk. It tracks resources and cleans them up after the test session/run to prevent the system from getting littered. I do not recommend disabling Ryuk. Instead, we should figure out how to remove the label from the committed image. Let's continue the discussion on the mentioned issue.