11. Running Commands in Containers

To run commands inside containers, use the supplied script:

$ /usr/share/winrm-docker-deploy/run-win-cmd <node> <ct> cmd /c <command>
$ /usr/share/winrm-docker-deploy/run-win-cmd <node> <ct> powershell -Command <command>

Note

PowerShell is not available in containers based on the Nano Server image.

For example:

$ /usr/share/winrm-docker-deploy/run-win-cmd node3.winctpreview.com vpnclient<N>_winct03nano cmd /c ipconfig /all
node3.winctpreview.com: cmd /c ipconfig /all

Windows IP Configuration

   Host Name . . . . . . . . . . . . : 19179765f18c
   Primary Dns Suffix  . . . . . . . :
   Node Type . . . . . . . . . . . . : Hybrid
   IP Routing Enabled. . . . . . . . : No
   WINS Proxy Enabled. . . . . . . . : No

Ethernet adapter vEthernet (Ethernet) 2:

   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Hyper-V Virtual Ethernet Adapter #5
   Physical Address. . . . . . . . . : C4-37-72-75-16-33
   DHCP Enabled. . . . . . . . . . . : No
   Autoconfiguration Enabled . . . . : Yes
   Link-local IPv6 Address . . . . . : fe80::8d9:a9eb:71a7:467e%56(Preferred)
   IPv4 Address. . . . . . . . . . . : 10.37.130.8(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . : 10.37.130.3
   DNS Servers . . . . . . . . . . . : fec0:0:0:ffff::1%1
                                       fec0:0:0:ffff::2%1
                                       fec0:0:0:ffff::3%1
   NetBIOS over Tcpip. . . . . . . . : Disabled
$ /usr/share/winrm-docker-deploy/run-win-cmd node2.winctpreview.com vpnclient<N>_winct02dnn powershell -Command dir c:
node3.winctpreview.com: powershell -Command dir c:

    Directory: C:\

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----        1/16/2021   5:12 PM                Data
d-----        12/2/2020  11:25 PM                inetpub
d-r---       11/23/2020  11:33 PM                Program Files
d-----       11/23/2020  11:32 PM                Program Files (x86)
d-----       11/23/2020  11:26 PM                RoslynCompilers
d-r---       11/23/2020  11:25 PM                Users
d-----       11/23/2020  11:31 PM                Windows
-a----        1/12/2021   7:56 PM           3558 exec.ps1
-a----         5/7/2020   7:48 AM           5510 License.txt
-a----       11/25/2020  12:55 PM             86 secpol.cfg
-a----       11/23/2020  11:25 PM         168344 ServiceMonitor.exe