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
Important
This section is applicable only if you created containers with docker create
.
Once the containers are created, you can access these containers remotely, by using
Enter-PSSession
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 20.200.20.201 -Size 1024
Add-Node -CacheName demoCache -ExistingServer 20.200.20.201 -NewServer 20.200.20.202
Start-Cache -Name demoCache
Add-ClientNode -CacheName demoCache -Server 20.200.20.201 -ClientNode 20.200.21.12
Add-TestData -CacheName democache –ItemCount 50
Get-CacheCount -CacheName democache
See Also
Create NCache Containers on Nano Server
NCache Docker on Windows Server
NCache Docker on Linux