Cache 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.
Startup.ps1: The Startup.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 Startup.ps1 scripts from GitHub for the following:
Important
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 the NCache Service not starting.
These resources must be placed in the following file structure (as also arranged on GitHub):
- Dockerfile
- ncache setup file in the resource folder.
- Startup.ps1 in the resource folder.
Customize Dockerfile
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
ncache
with optional tag alachisoft/ncache:latest in the format <image_name>:<optional_tag>:
PS C:/Docker> docker build . –t alachisoft/ncache:latest
Important
Similarly, if you want to use the OutProc cache on the client container or you want to monitor NCache Client Counters, you can build the NCache Enterprise Client image using the same process.
Note
To verify that the image has been created, run the command docker images
that lists all images and their details.
Push Image
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 latest to Docker Hub public repository:
docker push alachisoft/ncache:latest
See Also
Create Containers in Windows
NCache Docker on Windows
NCache Docker on Linux