docs/modules/ollama.md
Testcontainers module for Ollama .
You can start an Ollama container instance from any Java application by using:
<!--codeinclude-->Ollama container inside_block:container
<!--/codeinclude-->Testcontainers allows executing commands in the container. So, pulling the model is as simple as:
<!--codeinclude-->Pull model inside_block:pullModel
<!--/codeinclude-->In order to create a new image that contains the model, you can use the following code:
<!--codeinclude-->Commit Image inside_block:commitToImage
<!--/codeinclude-->And use the new image along with Image name Substitution
<!--codeinclude-->Use new Image inside_block:substitute
<!--/codeinclude-->Add the following dependency to your pom.xml/build.gradle file:
=== "Gradle"
groovy testImplementation "org.testcontainers:testcontainers-ollama:{{latest_version}}"
=== "Maven"
xml <dependency> <groupId>org.testcontainers</groupId> <artifactId>testcontainers-ollama</artifactId> <version>{{latest_version}}</version> <scope>test</scope> </dependency>