Use NCache on Docker for Linux
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 Containers
To connect to the container to perform operations from within it, use the docker attach command. The following command connects to the container
ncache-ent-server-01 created in the previous step:
sudo docker attach ncache-ent-server-01
Use NCache in Docker
Once connected to the container, you can perform administrative tasks through NCache PowerShell commands remotely. This includes managing caches, clusters, security and deploying providers and much more.
NCache Docker image for Linux contains PowerShell tools which run on PowerShell Core 6.2 and above. Hence, to execute these tools, you need to install PowerShell Core 6.2 or above within your container. Please refer to Microsoft documentation for installing PowerShell Core for Linux Debian.
For starters, you need to install NCache PowerShell module
ncacheps. You can verify NCache installation through
Get-NCacheVersion cmdlet. This lists the NCache version detail along with licensing information. You can proceed to using NCache within Docker now.
For example, the following commands perform the following tasks:
- Import NCache PowerShell module.
- Create a new partitioned cache and add a new node to it.
- Start the cache and add test data of 50 items to it.
- Verify the cache count.
Import-Module ncacheps New-Cache -Name demoCache -Topology Partitioned -Server 220.127.116.11 -Size 1024 Add-Node -CacheName demoCache -ExistingServer 18.104.22.168 -NewServer 22.214.171.124 Start-Cache -Name demoCache Add-TestData -CacheName demoCache –ItemCount 50 Get-CacheCount -CacheName demoCache