Create NCache Containers for Linux
Once you have set your Docker environment, you can now proceed to create containers for NCache Cache Server images hosted on Docker Hub for edition.
Pull/Load NCache Docker Image
You can either pull the NCache image from Docker Hub or load the image if you have the image saved to your disk.
Execute the following command in a command line terminal to pull NCache Open Source Server for Linux.
docker pull alachisoft/ncache:opensource-server-linux-5.0
Follow this step if your image is saved on disk.
The Docker image needs to be imported before creating a container, if your image is saved on the disk. This is a one-time step.
docker load --input [path_to_tar_file]
Configure NCache Container
Before proceeding to create containers for NCache in Linux, you need to configure Macvlan network.
Configure Macvlan Network
A Macvlan network driver assigns MAC address to each container’s virtual network interface, making it appear to be a physical network interface directly connected to the physical network.
Do make sure you have MAC address spoofing on, in case your host is a VM. To do this, run the command in PowerShell terminal on Hyper-V base:
Set-VMNetworkAdapter -VMName <hostVMName> -MacAddressSpoofing On
We will setup a Macvlan in Bridge mode. To set this up you can use the following command in Linux terminal:
sudo docker network create -d macvlan --subnet=18.104.22.168/24 --gateway=22.214.171.124 -o parent=eth0 McvlanNet
Create Container from Image
Once the NCache image is pulled and the Macvlan network is configured, you can create containers which host NCache and use them as cache servers.
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.
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 macvlan network created.
The following commands create the containers named
ncache-ent-server-02 in the shipped image
(alachisoft/ncache:opensource-server-linux-5.0) using the default network. Note that the
dns value provided is the one in the subnet.
Make sure that the sequence of parameters provided is as follows.
sudo docker run --name=ncache-ent-server-01 --net=McvlanNet --ip=126.96.36.199 --dns=188.8.131.52 -itd alachisoft/ncache:opensource-server-linux-5.0
sudo docker run --name=ncache-ent-server-02 --net=McvlanNet --ip=184.108.40.206 --dns=220.127.116.11 -itd alachisoft/ncache:opensource-server-linux-5.0