Create NCache Containers for Windows Server
Once you have set your Docker environment, you can create containers for NCache Cache Server images hosted on Docker Hub for Enterprise and Professional editions.
Pull NCache Docker Image
Execute the following command to pull the NCache Enterprise Server Docker Image for Windows.
docker pull alachisoft/ncache:enterprise-server-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 Windows, 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.
Important
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 172.19.0.0/16 and specifies the gateway as 172.19.0.1. You can change the values according to your environment.
docker network create --subnet=172.19.0.0/16 --gateway=172.19.0.1 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.
Note
While creating containers, the image specified should exist locally. If not, the image is fetched from Docker Hub, provided that the repository name 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-latest.
docker run --name ncache-ent-server-01 --net nbrg --ip 172.19.0.11 -itd alachisoft/ncache:enterprise-server-latest
docker run --name ncache-ent-server-02 --net nbrg --ip=172.19.0.12 -itd alachisoft/ncache:enterprise-server-latest
Your next step is to use the NCache containers that you just created, which is explained in the next chapter.
See Also
NCache Docker on Windows
NCache Docker on Linux
NCache Docker Deployment Scenarios