public MongoDockerFixture() { docker = new DockerClientConfiguration(new Uri("npipe://./pipe/docker_engine")).CreateClient(); docker.CreateImageIfNotExist(MongoDbImageName, MongoDbImageTag).Wait(); docker.RemoveContainerIfExist(MongoDbContainerName).Wait(); // docker run --name mongo-tests -p 33381:27017 -d mongo:4; var containerId = docker.RunContainer(MongoDbImage, MongoDbContainerName, ExposedPort, HostPort).Result; docker.WaitBeforeContainerInit(containerId).Wait(); }
public void Dispose() { docker.RemoveContainerIfExist(MongoDbContainerName).Wait(); docker.Dispose(); }