Agentic OS Ollama container image
This topic describes the interface exposure and access control policy, the startup process, and the resource prerequisites of the Ollama image. It also covers how to enable access from outside the container, replace the model, perform health checks, and configure model directory persistence and probe windows in Kubernetes.
This image provides the CPU version of Ollama to deliver local small-model inference for the security detection of Agentic OS. Semantic checks such as prompt injection detection are performed on the local machine, and no external API token is required. The default model is Warden-Gen-0.6B-GGUF, which has 0.6B parameters and can run on a CPU.
Image versions
|
Image name |
Address |
Information |
|
Ollama |
|
ollama: 0.32.1 |
Suitable scenarios
Use this image as the local inference backend of AgentSecCore so that semantic security checks are performed entirely on the local machine. No inspected content is sent out and no external tokens are consumed. Do not use the image as a standalone model service. Use it only in security scenarios.
The image does not contain a GPU runtime. It is not suitable for scenarios that require GPU acceleration or that run models with a large number of parameters. The default model is designed for security check tasks and is not a general-purpose conversational model.
Prerequisites
|
Item |
Requirement |
|
CPU and memory |
We recommend at least 4 vCPUs and 8 GB of memory. If the memory is insufficient, the container is OOMKilled when the model is loaded, which appears as repeated container restarts. Even if the container starts successfully, inference may take a long time and cause scan requests to time out |
|
Disk |
The model size varies with the selected model. The current default model |
|
Network |
Access to ModelScope is required to pull the model on the first startup. After the model is cached, the image can run offline |
Quick start
The owner of the model directory must be 10001 because the container runs as this UID:
sudo mkdir -p /srv/ollama
sudo chown -R 10001:10001 /srv/ollama
docker run -d --name ollama \
-v /srv/ollama:/home/agent-sec/.ollama \
-e OLLAMA_STARTUP_TIMEOUT_SECONDS=600 \
ac2-registry.cn-hangzhou.cr.aliyuncs.com/ac2/agentic-os:1.3-ollama0.32.1-alinux4
# The model is pulled on the first startup. Track the progress until [entrypoint] Ollama model is ready appears
docker logs -f ollama
Interface exposure and access control
The Ollama interface does not provide authentication. Any party that can access the port can call the model. Therefore, this image usesOLLAMA_HOST=127.0.0.1:11434by default and binds only to the loopback address of the container. In this case, the interface remains inaccessible even if you specify-p 11434:11434.
The recommended topology is to not expose the port externally. Let the caller share the network namespace with this container (by using --network container:<name> in Docker or the same pod in Kubernetes) and make calls over http://localhost:11434. In this way, the port is invisible externally.
Change the binding to 0.0.0.0 only when calls across nodes or pods are required, and restrict access to the internal network:
docker run -d --name ollama \
-v /srv/ollama:/home/agent-sec/.ollama \
-e OLLAMA_HOST=0.0.0.0:11434 \
-p 127.0.0.1:11434:11434 \
ac2-registry.cn-hangzhou.cr.aliyuncs.com/ac2/agentic-os:1.3-ollama0.32.1-alinux4
curl http://127.0.0.1:11434/api/tags
-p 127.0.0.1:11434:11434 restricts the port to the host itself. Remove the address prefix only when other machines in the same network segment need to access the port, and configure firewall or security group restrictions on your own. In Kubernetes, use a ClusterIP Service together with a NetworkPolicy to restrict the request sources. Do not use LoadBalancer or NodePort.
Image information
|
Item |
Value |
|
Image address |
|
|
Ollama version |
|
|
Base image |
Alibaba Cloud Linux 4.0.5 |
|
Architecture |
|
|
Runtime user |
|
|
Listening port |
|
|
ENTRYPOINT / working directory |
|
|
Privilege requirements |
None |
Environment variables
|
Variable |
Default value |
Description |
|
|
|
The listening address. To provide services externally, change the value to |
|
|
|
The model that is ensured to exist and is warmed up at startup |
|
|
|
The storage directory of model layers |
|
|
|
The context length. It overrides the value that comes with the model at startup and must be a positive integer |
|
|
|
The number of concurrent requests. The value must be a positive integer |
|
|
|
The quantization type of the KV cache, which reduces memory usage |
|
|
|
The value |
|
|
|
The timeout period for waiting until |
|
|
|
The home directory of the runtime user |
If you switch to a larger model or increase the value of OLLAMA_NUM_CTX or OLLAMA_NUM_PARALLEL, memory usage increases significantly. Increase the resource quota accordingly.
Image update policy
This image is released in line with the release cadence of Agentic OS, and the interval between releases does not exceed one month. After a new version is released, the previous version is no longer maintained. Issue fixes and component upgrades are applied only to the latest version. We recommend that you upgrade at the earliest opportunity.
For deployment, use a tag that contains the complete version number, such as 1.3-ollama0.32.1-alinux4, to ensure reproducibility, and schedule regular upgrade windows. If you pin the tag but never upgrade, you remain on a version that is no longer maintained.