Create NCache Containers for Linux
Once you have set your Docker environment, you can now proceed to create containers for NCache Server images hosted on Docker Hub for Enterprise.
Pull NCache Docker Image
Execute the following command to pull the NCache Enterprise Server Docker Image for Linux.
docker pull alachisoft/ncache:enterprise-server-linux-latest
Refer to our Docker Hub repository to check out which other Docker images we provide.
Configure Custom Network
Before proceeding to create containers for NCache in Linux, you need to configure a custom network. By default, without the usage of a custom network, Docker assigns containers dynamic IP addresses on a container or host restart. A custom network will help assign your NCache containers static IP addresses.
It is highly recommended to use static IPs for each container as all future connections will take place using this IP. These IPs should exist in the IP range specified in the custom network created.
NCache client-server connections are IP-based, and if this IP keeps on changing, the connection will break. So, we need to assign static IP addresses to our NCache containers. The following docker network create command creates a custom network called nbrg that contains subnet 10.2.0.4/16 and specifies the gateway as 10.2.0.1. You can change the values according to your environment.
docker network create --subnet=10.2.0.4/16 --gateway=10.2.0.1 --driver nat nbrg
Create Container from Image
Once you have pulled the NCache Docker image and created your custom network, you can create containers that host NCache and use them as cache servers. The container can be created with either the docker run or docker create command, the difference being
docker run starts the container when it is created.
While creating containers, the image specified should exist locally. If not, the image is then fetched from Docker Hub if the name of the repository is specified.
The following commands create the containers named ncache-ent-server-01 and ncache-ent-server-02 using the custom network nbrg and shipped image alachisoft/ncache:enterprise-server-linux-latest.
sudo docker run --name=ncache-ent-server-01 --net=nbrg --ip=10.2.0.4 -itd alachisoft/ncache:enterprise-server-linux-latest
sudo docker run --name=ncache-ent-server-02 --net=nbrg --ip=10.2.0.5 -itd alachisoft/ncache:enterprise-server-linux-latest
Your next step is to use the NCache containers that you just created, which is explained in the next chapter.
NCache Docker on Linux
NCache Docker on Windows
NCache Docker Deployment Scenarios