Establish PSSession to Windows docker container from remote machine (not container host) Establish PSSession to Windows docker container from remote machine (not container host) powershell powershell

Establish PSSession to Windows docker container from remote machine (not container host)


Not sure how to create an interactive PSSession, but you can access and execute commands on docker containers remotely.

On powershell in local computer enter the following:

$credential = Get-Credential    $remoteComputerName = "10.20.30.40" # your remote machine$Session = New-PSSession -ComputerName $remoteComputerName -Credential $credentialInvoke-Command -Session $Session -ScriptBlock { docker exec -t my_container_1 redis-cli info replication }

The above, for example, will give redis replication info on your docker container.

Basically use the following pattern:

Invoke-Command -Session $Session -ScriptBlock { docker exec -t <your container> [your commands] }