Agentic OS Ollama container image

Updated at:

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

ac2-registry.cn-hangzhou.cr.aliyuncs.com/ac2/agentic-os:1.3-ollama0.32.1-alinux4

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 Warden-Gen-0.6B-GGUF is about 379 MB. We recommend that you mount a persistent volume for the model directory to prevent the model from being pulled again after the container is recreated

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 uses OLLAMA_HOST=127.0.0.1:11434 by 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

ac2-registry.cn-hangzhou.cr.aliyuncs.com/ac2/agentic-os:1.3-ollama0.32.1-alinux4

Ollama version

0.32.1

Base image

Alibaba Cloud Linux 4.0.5

Architecture

linux/amd64, CPU-only (no GPU runtime included)

Runtime user

10001:10001 (non-root)

Listening port

11434. By default, it is bound only to 127.0.0.1. For more information, see the "Interface exposure and access control" section of this topic

ENTRYPOINT / working directory

/usr/local/bin/entrypoint-ollama.sh / /tmp

Privilege requirements

None

Environment variables

Variable

Default value

Description

OLLAMA_HOST

127.0.0.1:11434

The listening address. To provide services externally, change the value to 0.0.0.0:11434

OLLAMA_MODEL

modelscope.cn/ANOLISA/Warden-Gen-0.6B-GGUF

The model that is ensured to exist and is warmed up at startup

OLLAMA_MODELS

/home/agent-sec/.ollama/models

The storage directory of model layers

OLLAMA_NUM_CTX

4096

The context length. It overrides the value that comes with the model at startup and must be a positive integer

OLLAMA_NUM_PARALLEL

1

The number of concurrent requests. The value must be a positive integer

OLLAMA_KV_CACHE_TYPE

q8_0

The quantization type of the KV cache, which reduces memory usage

OLLAMA_KEEP_ALIVE

-1

The value -1 indicates that the model resides in memory and is not unloaded, which prevents the model from being reloaded for each detection

OLLAMA_STARTUP_TIMEOUT_SECONDS

60

The timeout period for waiting until ollama serve is ready. We recommend that you set the value to 600 in environments where the model is pulled for the first time

HOME

/home/agent-sec

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.