Use NCache on Docker for Nano Server
Once the containers for NCache are created and started, you need to connect to the container and can use NCache using PowerShell cmdlets.
Connect to Container
This section is applicable only if you created containers with
Once the containers are created, you can access these containers remotely, by using
command and specifying the container ID of the newly created container (
ncache-ent-server-nano-01 in this example).
You can get the containerID of a container using the docker ps -a command, which lists all containers and its additional information.
Enter-PSSession -ContainerId <ContainerID> –RunAsAdministrator
You will be directed to the container instance and can seamlessly perform NCache tasks through this container.
Use NCache in Container
Once connected to the container, you can perform administrative tasks through NCache PowerShell commands remotely. NCache provides PowerShell tools which can be used from a remote source that is external to the container and has sufficient access to run NCache’s management commands. Since Nano Server does not yet support NCache's PowerShell cmdlets, you can use the cache servers hosted in the container as a remote cache for the cmdlets being used outside of the container.
For these commands, you can specify the IP of the server hosted in the container.
For example, the following PowerShell commands perform the following tasks:
- Import NCache PowerShell module.
- Creates a new partitioned cache and adds a new node (from container ncache-ent-server-nano-02) to it.
- Starts the cache.
Add Client node to the cache and add test data of 50 items to it.
Verifies the cache count.
Import-Module ncacheps New-Cache -Name democache -Topology Partitioned -Server 188.8.131.52 -Size 1024 Add-Node -CacheName demoCache -ExistingServer 184.108.40.206 -NewServer 220.127.116.11 Start-Cache -Name demoCache Add-ClientNode -CacheName demoCache -Server 18.104.22.168 -ClientNode 22.214.171.124 Add-TestData -CacheName democache –ItemCount 50 Get-CacheCount -CacheName democache