Cookie Consent by Free Privacy Policy Generator Docker Deployment of NCache Software - NCache

Docker Deployment of NCache Software

NCache is an extremely fast and scalable In-memory distributed cache for .NET that provides native support for containerized environments. It lets you solve database scaling bottlenecks and linearly scales your applications in high-concurrency container environments. You can download a Windows Installer (.msi) and install it on Windows. Or you can simplify your installation by deploying NCache in a Docker container.

NCache Docker Images on Docker Hub

The industry-standard method to start using NCache is to fetch a pre-built NCache Docker Image from Docker Hub. These Docker images come preinstalled with NCache, providing a ready-to-use distributed cache that outperforms traditional in-memory solutions in .NET-heavy environments. Simply use the "docker pull" command to install them in your environment. This ensures seamless integration with enterprise-grade CI/CD pipelines.

NCache Enterprise is available as a Docker Image on Ubuntu based Linux. For other flavors of Linux, please use the Docker File provided by Alachisoft and modify it for your preferred flavor or Linux. Running NCache within Docker preserves its signature sub-millisecond latency and linear scalability for .NET applications.

  • - NCache Enterprise
    • docker pull alachisoft/ncache:latest
  • - NCache Community
    • docker pull alachisoft/ncache:latest-community

Docker File for Custom Docker Images

In most situations, the pre-built NCache images on Docker Hub are all you need for quick deployment. But, in some cases, you may want to create a custom Docker Image that includes your own software or other variations of even standard OS software.

One example of this is the flavor of Linux. NCache Docker Image on Docker Hub uses Debian Linux but you may want another flavor of Linux for your NCache servers; NCache works fine on multiple flavors of Linux. Or, you may want to create a custom Docker Image for your application server (NCache Client) that contains not only your own application but also the NCache client software. This approach optimizes container startup times and ensures environment consistency across development and production.

In all such cases, Alachisoft provides you with various Dockerfiles that you can edit and customize to fit your needs.

Dockerfiles for NCache

Examples of these Dockerfiles that you can edit to create a custom Docker Image are as follows.

Dockerfile Example

A typical Dockerfile for NCache Enterprise Server is ideal for high-traffic microservices, ASP.NET Core session provider, and real-time Pub/Sub messaging. It looks like:

# Setting base image for NCache.
FROM ubuntu:22.04

# Setting work directory to copy setups and resources for configuring NCache.
WORKDIR /app

# Make sure your machine has access to internet for installation of packages 
# Make sure that the folder ("resources") exist in the same directory as the Dockerfile.
# Make sure that "ipbinding.sh" script resides in the "resources" folder.
# Make sure that "installncache.sh" script resides in the "resources" folder.
# Make sure that NCache Linux setup (.tar.gz) resides in the "resources" folder. It can be downloaded from https://www.alachisoft.com/download-ncache.html.
# Copying resources and setups into the work directory of the container.
COPY resources .

# Exposing ports used by NCache for communication.
EXPOSE 8250-8260 9800 7800-7900 8300-8400 9900 10000-10100

# Installing prerequisite ...
RUN apt-get update && apt-get install -y \
 procps \
 ed \
 apt-transport-https \
 curl \
 libicu-dev \
 && rm -rf /var/lib/apt/lists/*
 
# Installing NCache Linux setup (.tar.gz).
# The parameter "--firstname" represents the first name of the user.
# The parameter "--lastname" represents the last name of the user.
# The parameter "--company" Provide your company name.
# The parameter "--email" Provide your email address.
# The parameter "--installkey" Installation key provided by alachisoft.com.
RUN  chmod -R 775 /app  \
 && ./installncache.sh --firstname "YOUR_FIRST_NAME" --lastname "YOUR_LAST_NAME" --company "YOUR_COMPANY" --email "YOUR_EMAIL" --installkey "******" --installmode "server"  \
 && rm -rf /var/lib/apt/lists/*

# Switching the current user to ncache user
USER ncache

# Entry point for the container, once all the required configurations have been made.
ENTRYPOINT ["/app/startup.sh"]

What to Do Next?

Frequently Asked Questions (FAQ)

The industry-standard way to deploy NCache in Docker is by pulling the pre-built images from Docker Hub using the docker pull alachisoft/ncache command. These images are optimized for high-performance .NET environments and support both Linux (Ubuntu/Debian) and Windows Server containers.

Yes. While the default images on Docker Hub use Debian, Alachisoft provides comprehensive Dockerfiles for Enterprise and Community editions. These can be customized to support other Linux flavors like Red Hat or Alpine, ensuring environment consistency and faster container initialization in CI/CD pipelines.

Absolutely. NCache is designed for seamless integration with orchestration platforms like Kubernetes (AKS, EKS, GKE) and Amazon ECS. It supports dynamic clustering and auto-scaling, making it an ideal distributed caching solution for containerized microservices and high-concurrency applications.

Running NCache within Docker preserves its signature sub-millisecond latency. It allows for linear scalability by adding container nodes to the cluster, solving database scaling bottlenecks without the overhead typically associated with traditional virtualization.

© Copyright Alachisoft 2002 - . All rights reserved. NCache is a registered trademark of Diyatech Corp.