NCache Dockerfile for Windows
NCache also provides Dockerfiles and supporting resources on GitHub to allow more flexibility while using the NCache Docker image. You can use these Dockerfiles to make a customized image with your customized dependencies to cater to your specific needs. For example, you want to change the version of Windows from Windows Server 2019 to 2016, you can make this change in the NCache Dockerfile and build a customized image.
What does NCache Dockerfile contain?
The Dockerfiles provided by NCache at GitHub contain commands to build images for NCache. Before you proceed any further, you need to clone this repo to your local machine and download the NCache setup and place it under the resource folder. Note that to create the image using this Dockerfile, the following resources are required:
Dockerfile: Dockerfiles can be customized to perform additional tasks. NCache Dockerfiles for Windows Server are placed at GitHub for the following:
NCache Enterprise setup file: This is an .msi file that can be downloaded from Alachisoft.com.
IPBinding.ps1: The IPBinding.ps1 script extracts the IP address of the container on the very first usage of the container and updates that IP in the NCache configuration files accordingly.
You can get the IPBinding.ps1 scripts from GitHub for the following:
In case dynamic IPs have been assigned, the container might be assigned a new IP address (on container or host restart) instead of the one stored in the configuration during container creation. This results in NCache service not starting.
These resources must be placed in the following file structure (as also arranged on GitHub):
- ncache setup file in the setup folder.
- IPBinding.ps1 in the resource folder.
You can customize the NCache Dockerfile as per your requirement to perform any additional tasks after or before installation. You can then create your customized images using this Dockerfile and push them to Docker Hub or your local repository. All of this is explained below:
Create Images using Customized Dockerfile
Using your customized Dockerfile, you can now create Docker images which will host NCache as specified in Dockerfile.
Go to the relative path where the Dockerfile is placed. In the following examples, it is assumed it is placed in location C:/Docker.
The following docker build command creates image
ncachewith optional tag enterprise-server-latest in the format <image_name>:<optional_tag>:
PS C:/Docker> docker build . –t ncache:enterprise-server-latest
To verify that the image has been created, run the command
docker images that lists all images and their details.
Once your customized Docker Image(s) has been created, you can push it to a public or local registry using the docker push command. The following command pushes the image ncache with the tag enterprise-server-latest to Docker Hub public repository:
docker push ncache:enterprise-server-latest