System Info:
- Window Server 2022 image - microsoft/windows-server - Docker Image
- Host - AWS EC2 Instance (Windows_Server-2022-English-Full-Base-2024.08.14)
I’m trying to set up SSH connection inside the container and one of the steps is to configured the firewall rule, but I keep getting the error (see below). Any help/suggestion is much appreciated. Guide that I’m trying to follow from - Get started with OpenSSH Server for Windows | Microsoft Learn
Steps to reproduce the behavior
- From Window Docker container (win server 2022 in my case) run command below using powershell to configure the firewall rule:
if (!(Get-NetFirewallRule -Name "OpenSSH-Server-In-TCP" -ErrorAction SilentlyContinue | Select-Object Name, Enabled)) {
Write-Output "Firewall Rule 'OpenSSH-Server-In-TCP' does not exist, creating it..."
New-NetFirewallRule -Name 'OpenSSH-Server-In-TCP' -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22
} else {
Write-Output "Firewall rule 'OpenSSH-Server-In-TCP' has been created and exists."
}
Error:
PS C:\Users\ContainerAdministrator\.ssh> New-NetFirewallRule -Name 'OpenSSH-Server-In-TCP' -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22
New-NetFirewallRule : There are no more endpoints available from the endpoint mapper.
At line:1 char:1
+ New-NetFirewallRule -Name 'OpenSSH-Server-In-TCP' -DisplayName 'OpenS ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (MSFT_NetFirewallRule:root/standardcimv2/MSFT_NetFirewallRule) [New-Net
FirewallRule], CimException
+ FullyQualifiedErrorId : Windows System Error 1753,New-NetFirewallRule