Create Cache Containers for Windows Server Using Docker
Once you have set your Docker environment, you can create containers for NCache Cache Server images hosted on Docker Hub for Enterprise and Professional.
Pull NCache Docker Image
Execute the following command to pull the NCache Enterprise Server Docker Image for Windows.
docker pull alachisoft/ncache:latest
Refer to our Docker Hub repository to check out which other Docker images NCache 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. Such a custom network will assign each of your NCache containers specific 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 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.
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:latest.
docker run --name=ncache-ent-server-01 --net=nbrg --ip=10.2.0.4 -itd alachisoft/ncache:latest
docker run --name=ncache-ent-server-02 --net=nbrg --ip=10.2.0.5 -itd alachisoft/ncache: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