Install with Dockerfile
To use NCache from the pulled image, you need to create containers which host NCache. Before proceeding to that, you need to ensure that transparent network has been configured.
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.
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
Create Container from Image
Once the NCache image is pulled, you can create containers which host NCache and use them as cache servers or clients (according to the image).
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.
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.
The following commands create the containers named ncache-oss-server-01
and
ncache-oss-server-02
in the shipped image
(alachisoft/ncache:opensource-server-4.9) in detached mode using the configured
transparent network:
docker run -d --name=ncache-oss-server-01 --net=transNet --ip=20.200.20.201 alachisoft/ncache:opensource-server-4.9
docker run -d --name=ncache—oss-server-02 --net=transNet --ip=20.200.20.202 alachisoft/ncache:opensource-server-4.9
See Also
Pull Docker Image
Install NCache with Dockerfile
Edit Dockerfile for Your Environment