New-PSSession from docker image returns Access is denied

I am trying to write a docker for running powershell script remotely. In the docker I am trying create a new session using New-PSSession command. Following is the command I am using.

New-PSSession -ComputerName $serverName -Credential $cred -UseSSL -SessionOption $so

I am getting following error, any one have a solution?

STDERR: New-PSSession : [hostname.abc.azure.com] Connecting to remote server hostname.abc.azure.com failed with the following error message : The WinRM client cannot process the request because the server name cannot be resolved. For more information, see the about_Remote_Troubleshooting Help topic.

I tried the same command from powershell prompt inside the docker. Still am getting an error.

docker run -it containername powershell.exe

I am getting following error at this time,

New-PSSession : [IP.1.1.1.] Connecting to remote server[IP.1.1.1.] failed with the following error message : Access is denied. For more information, see the about_Remote_Troubleshooting Help topic.

I am trying from a windows docker image (FROM python:3.7.9-windowsservercore-1809) and my host machine is also windows.