Ollama¶
Testcontainers module for Ollama .
Ollama usage examples¶
You can start an Ollama container instance from any NodeJS application by using:
await using container = await new OllamaContainer(IMAGE).start();
Pulling the model¶
const execResult = await container.exec(["ollama", "pull", "all-minilm"]);
Create a new Image¶
In order to create a new image that contains the model, you can use the following code:
await container.commitToImage(newImageName);
And use the new image:
await using newContainer = await new OllamaContainer(newImageName).start();
Adding this module to your project¶
npm install @testcontainers/ollama --save-dev