NCache for Docker
Run high-performance distributed caching in Linux Docker Containers for modern containerized applications and deployment environments. NCache provides a Linux-based Docker deployment model for applications that need distributed caching, scalability, and high availability in containerized environments. Organizations can deploy NCache directly on Linux VMs using Docker, run application and client-side components in containers, or use Docker Compose to create a complete multi-node NCache cluster on a single Linux VM.
NCache Docker support fits naturally into modern DevOps environments through standard Docker networking, environment-based configuration, automated registration, container health monitoring, Prometheus metrics, OpenTelemetry integration, structured logging, and repeatable deployment across on-premises infrastructure and the major public clouds.
Docker-Native Deployment
NCache uses standard Docker deployment practices so it can fit naturally into existing container automation and DevOps workflows. This allows NCache to become part of an organization's existing Docker-based deployment model instead of requiring a separate infrastructure process.
-
Deploy NCache Server
# Do this on each NCache server Linux VM. Run one container per VM.
docker run -d --name ncache --network host -e KEY="XXXXXX" alachisoft/ncache:latest
-
Deploy NCache Cluster with Docker Compose
# Create a 2-node cluster on a single VM. Use port 9800 for clients and 9801 for NCache Management Center
docker compose -f oci://docker.io/alachisoft/ncache-cluster:latest up -d --wait --scale ncache=2
-
Deploy App and NCache Client
# Deploy your application client and NCache Client containers on the same VM for client monitoring and OutProc Client Cache.
# NCACHE_CLIENT_HOST tells NCache client SDK where to find the NCache Client container
docker network create ncache-net
docker run -d --name ncache-client --network ncache-net -e KEY="XXXXXX" -e REGISTER_AS=Client alachisoft/ncache:latest
docker run -d --name myapp --network ncache-net -e NCACHE_CLIENT_HOST=ncache-client customer/myapp:latest
-
Deploy NCache Developer
# Create a stand-alone local cache with 2GB size and performance limits
docker run -d --name ncache-dev --network host -e KEY="XXXXXX" -e REGISTER_AS=Developer alachisoft/ncache:latest
NCache Server Container
NCache Server can run as a Linux Docker Container on dedicated Linux VMs, allowing organizations to create distributed cache clusters while retaining the isolation and repeatability of container-based deployment.
- One Container per Linux VM: Deploy one NCache Server container on each Linux VM so the cache server can use the CPU, memory, and network resources allocated to that VM.
- Multi-VM Cache Clusters: Deploy NCache Server containers across multiple Linux VMs and combine them into a distributed cache cluster for scalability and high availability.
- Host Networking: NCache Server containers use Docker host networking so each cache server communicates through the Linux VM's network identity without requiring Docker port mapping.
- Automatic Container Recovery: Use Docker restart policies to automatically restart the NCache Server container if it stops unexpectedly.
docker run -d --name ncache --network host --restart=unless-stopped -e KEY="<registration-key>" alachisoft/ncache:5.3.800
This provides a simple container-based architecture while allowing NCache clusters to span multiple Linux VMs in on-premises or cloud environments.
Application Client Container
Applications using NCache can themselves run inside Linux Docker Containers while using the NCache Client SDK to communicate with the distributed cache.
- Embedded NCache Client SDK: The NCache Client SDK runs inside the application container and communicates directly with NCache Server containers.
- InProc Client Cache: Applications can use an InProc Client Cache that runs within the application process for faster access to frequently used cached data.
- NCache Client Container Integration: Applications that require OutProc client-side services can communicate with a separate NCache Client container.
- NCACHE_CLIENT_HOST: This Docker environment variable identifies the NCache Client service that the application should use for client monitoring and OutProc Client Cache functionality.
This allows containerized applications to use the same NCache client capabilities available to applications running directly on traditional servers.
NCache Client Container
NCache provides an NCache Client container that performs the client-side functions normally provided by the NCache Service on a traditional application server.
- OutProc Client Cache: Multiple application processes can use a separate OutProc Client Cache hosted by the NCache Client container.
- Client Monitoring: NCache Client SDKs publish client-side performance information to the NCache Client container for centralized monitoring.
- NCache Monitor Integration: NCache monitoring tools can obtain client performance information through the NCache Client service.
- Prometheus Metrics: The NCache Client container can expose client-side metrics through a Prometheus-compatible HTTP endpoint for collection by Prometheus and other monitoring systems.
docker run -d --name ncacheclient --network bridge --restart=unless-stopped -e INSTALL=Client KEY="<registration-key>" alachisoft/ncache:5.3.800
The application identifies the client-side NCache service through NCACHE_CLIENT_HOST, using either localhost with host networking or the NCache Client container name with bridge networking.
NCache Developer Container
NCache provides a Developer container for development, testing, and smaller standalone environments where a full distributed cache cluster is not required.
- Standalone OutProc Local Cache: Run a standalone NCache cache in a Linux Docker Container for local application development and testing.
- NCache Management Center: Use the browser-based NCache Management Center to configure, manage, and monitor the Developer container.
- Developer Limits: The Developer container is limited to 2 GB of cache size and includes performance limits suitable for development and evaluation rather than production workloads.
- Host or Bridge Networking: Run the Developer container with host networking or use bridge networking with port forwarding for client and browser access.
docker run -d --name ncachedev --network bridge --restart=unless-stopped -e INSTALL=Developer KEY="<registration-key>" alachisoft/ncache:5.3.800
With bridge networking, port 9800 can be exposed for NCache clients and port 9801 for NCache Management Center.
Docker Compose Cluster Deployment
NCache provides a Docker Compose deployment for quickly creating a complete multi-node NCache cluster on a single Linux VM.
This provides a simple way to evaluate or deploy a multi-node NCache environment without manually creating and configuring each individual container.
Docker Monitoring
NCache provides container-friendly monitoring capabilities for both cache servers and clients.
- Server and Client Metrics: Published to OpenTelemetry, Prometheus, and NCache Monitor.
- Server Event Logs: Important operational events logged to OpenTelemetry and Docker stdout/stderr.
- Server Error Logs: Important activities and all errors logged to Docker stdout/stderr.
- OpenTelemetry, Prometheus, Docker stdout/stderr, NCache Monitor
Container Health and Recovery
NCache works with standard Docker recovery mechanisms while providing its own server health information.
- Automatic Restart: Use Docker restart policies such as --restart=unless-stopped to restart NCache containers after unexpected process or container failures automatically.
- NCache Health Check: NCache provides health information that can be used to determine whether the NCache Server process is initialized and functioning properly.
- Cache Cluster Recovery: A restarted NCache Server container can reconnect to the other cache servers and rejoin the running cluster.
- Docker Compose Recovery: Docker Compose can restart failed containers while preserving the overall deployment definition and cluster configuration.
Together, these capabilities help NCache remain available even when individual container processes or Linux hosts experience failures.
What to Do Next?
Frequently Asked Questions (FAQ)
Yes. NCache can run in Linux-based Docker Containers for development, evaluation, testing, and production environments. NCache supports direct Docker deployment as well as multi-node Docker Compose deployments.
The Docker support described on this page is for Linux-based Docker Containers. Windows-based NCache deployment is covered separately under NCache for Windows.
For a multi-VM production deployment, one NCache Server container runs on each Linux VM using host networking. Multiple NCache Server containers on separate VMs can then form a distributed cache cluster.
Yes. The NCache Client SDK can run directly inside an application container and communicate with NCache Server containers. Applications can also use a separate NCache Client container for OutProc Client Cache and client-side monitoring.
The NCache Client container provides client-side services that would normally be provided by the NCache Service on a traditional application server. It can host an OutProc Client Cache, collect client metrics, and expose those metrics for monitoring.
NCACHE_CLIENT_HOST is an environment variable used by the NCache Client SDK to locate the NCache Client service. It can point to localhost with host networking or to a Docker service name such as ncache-client when bridge networking is used.
The NCache Developer container provides a standalone NCache environment for application development and testing. It includes an OutProc Local Cache and NCache Management Center and is subject to Developer edition size and performance limits.
Yes. NCache provides a Docker Compose deployment that can create a multi-node NCache cluster on a single Linux VM using private NCache Server containers and a built-in Nginx gateway.
Applications connect through a single Nginx client endpoint. Nginx routes initial connections to NCache Server containers, while the NCache client provides its normal cluster-aware communication and failover behavior.
Yes. Docker Compose can add or remove NCache Server containers at runtime. New containers automatically register and join configured caches, while containers being removed leave the cache cluster cleanly.
NCache provides NCache Management Center, client-side monitoring, Prometheus/OpenMetrics-compatible GET /metrics, JSON-formatted GET /metrics/json, structured container logging, and OpenTelemetry integration in NCache Enterprise.
Yes. NCache Server and NCache Client services can expose Prometheus/OpenMetrics-compatible runtime metrics through an HTTP GET /metrics endpoint. A JSON version is also available through GET /metrics/json.
Yes. NCache Enterprise can publish metrics and important operational events through OpenTelemetry. NCache clients can also publish metrics to a configured remote OpenTelemetry Collector.
NCache can publish structured JSON logs and traces to container stdout and stderr, making them available through Docker logging and centralized log collection systems. Detailed NCache diagnostic log files remain available separately.
Docker restart policies can automatically restart failed NCache containers. Once restarted, an NCache Server container can reconnect to the other servers and rejoin the running cache cluster.
Yes. NCache Docker Containers can run on Linux VMs in Microsoft Azure, Amazon Web Services, and Google Cloud, as well as on Linux physical servers and VMs in on-premises environments.
Yes. Organizations can begin with Docker or Docker Compose and later move to Kubernetes when they need broader container orchestration, automated scheduling, health management, and rolling deployment capabilities.