-
Notifications
You must be signed in to change notification settings - Fork 833
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
Currently, the MongoDB container is being recreated every time it is stopped, even though the same configuration is used each time.
Expected Behavior
Only one persistent container created for any number of runs with the same configuration.
Steps To Reproduce
var mongo = builder.AddMongoDB("mongo", 27020)
.WithContainerName("mongo")
.WithEnvironment("MONGO_INITDB_DATABASE", "MyTestDB")
.WithEnvironment("MONGO_INITDB_ROOT_USERNAME", "user")
.WithEnvironment("MONGO_INITDB_ROOT_PASSWORD", "pass")
.WithDataVolume("mtmongodata")
.WithBindMount("./init-mongo.js", "/docker-entrypoint-initdb.d/mongo-init.js", isReadOnly: true)
.WithLifetime(ContainerLifetime.Persistent);
- Run the aspire project with this configuration
- After the projected started successfully, run
docker stop <cotnainerid> - Run again the aspire project with the same configuration.
Exceptions (if any)
No response
.NET Version info
.NET SDK:
Version: 9.0.304
Commit: f12f5f689e
Workload version: 9.0.300-manifests.610a1858
MSBuild version: 17.14.16+5d8159c5f
Runtime Environment:
OS Name: Windows
OS Version: 10.0.26100
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\9.0.304\
Anything else?
Project target framework: NET 9.0
Aspire.Hosting.AppHost version: 9.3.1
Aspire.Hosting.MongoDB version: 9.3.1