Create NCache Containers for Nano Server
Once you have set your Docker environment, you can now proceed to create containers for NCache Cache Server images hosted on Docker Hub for Enterprise edition.
Pull Docker Image
Execute the following command in a terminal of your choice to pull NCache Enterprise Server for Nano Server from Docker Hub.
docker pull alachisoft/ncache:enterprise-server-nano-4.9.1
Configure NCache Containers
Before proceeding to create containers for NCache in Nano Server, you need to configure transparent network and DNS Servers (in case you want to activate NCache license).
Note
NCache Enterprise container is created in Evaluation trial mode for 60 days. You can activate NCache license once you purchase it.
Configure Transparent Network
Transparent network uses IPs from host network and each container is assigned a separate virtual NIC. This network best suits network configuration needed for NCache. Each container acts as a separate node and can communicate across hosts on the same network, meaning that the NCache cluster can be managed anywhere from that network. Containers attached to a network created with the transparent driver will be directly connected to the physical network. IPs from physical network can be assigned statically or dynamically.
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 transparent network created.
The following docker network create command creates a transparent network called transNet which contains subnet 20.200.20.0/24 and specifies the gateway as 20.200.20.1. You can change the values according to your own environment.
docker network create -d transparent --subnet=20.200.20.0/24 --gateway=20.200.20.1 transNet
Configure DNS Servers in Docker
When a container is created, it inherits certain configurations from the docker daemon (i.e. the docker engine service). The docker daemon can be configured to have custom configurations. One of these configurations is DNS servers which is required in case license activation is required. By default, the Docker daemon does not run with any configurations. To configure DNS servers to be inherited by default by containers, simply follow the given steps:
- Go to [Docker_path]\config location on your machine.
- Create a file by the name daemon.json if it does not already exist.
- Add the following key-value pair in this file:
"dns": [
"20.200.20.10",
"20.200.20.2"
]
Note
These addresses correspond to the DNS servers and can have different values in your case.
If the key dns
already exists, append your addresses to it if there is a need.
Create Containers
The container can be created with either docker run or docker create command,
the difference being docker run
starts the container when it is created, and attaches your shell to the container's shell.
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 transparent network created.
Note that 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.
Important
mac-address
is a compulsory parameter. Failing to provide it will return in license activation being lost in case of container restart. This is a Docker limitation.
Using docker run
The following commands create and start the containers named ncache-ent-server-01
and
ncache-ent-server-02
in the shipped image
(alachisoft/ncache:enterprise-server-nano-4.9.1) using the configured
transparent network. This will also bind your shell to the container's shell.
docker run --name=ncache-ent-server-nano-01 --net=transNet --ip=20.200.20.201 --interactive --mac-address="xx:xx:xx:xx:xx:xx" ncache:enterprise-server-nano-4.9.1
docker run --name=ncache-ent-server-nano-02 --net=transNet --ip=20.200.20.202 --interactive --mac-address="xx:xx:xx:xx:xx:xx" ncache:enterprise-server-nano-4.9.1
Using docker create
The following commands create the containers named ncache-ent-server-01
and
ncache-ent-server-02
in the shipped image
(alachisoft/ncache:enterprise-server-nano-4.9.1) using the configured
transparent network. You can then use docker start to start the containers, which can later be bound to your shell if needed. This is explained in the next chapter.
docker create --name=ncache-ent-server-nano-01 --net=transNet --ip=20.200.20.201 --interactive --mac-address="xx:xx:xx:xx:xx:xx" ncache:enterprise-server-nano-4.9.1
docker start ncache-ent-server-nano-01
docker create --name=ncache-ent-server-nano-02 --net=transNet --ip=20.200.20.202 --interactive --mac-address="xx:xx:xx:xx:xx:xx" ncache:enterprise-server-nano-4.9.1
docker start ncache-ent-server-nano-02
Activate NCache License
NCache Enterprise is installed in Evaluation mode for 60 days. Once that period is up, you can purchase NCache licenses. To activate the license for NCache Docker on Windows Server, you need to do the following:
Important
It is assumed you have obtained the license key from Alachisoft. Before proceeding, ensure that the network inside your container is able to ping the Internet.
To activate the license for NCache Docker on Nano Server, you need to do the following:
Change directory to %NCHOME%\bin\NActivate while in the container’s command line.
Execute the following command:
dotnet Alachisoft.NCache.Activate.NetCore.dll /f John /l Smith /e john@alachisoft.com /k XXXXXXXXX-XXXXXX-XXXXXXXX
This activates the license for John Smith.
For more details, you can refer to documentation on command line license activation here.
See Also
Use NCache on Docker
NCache Docker on Windows Server
NCache Docker on Linux