Windows server core container+ python + wmi unable to connect to remote system cim class

  docker, python, windows-container, wmi

In "python:2-windowsservercore" python windows container image, python wmi not able to connect to remote server, however same works for localhost

As it gives as "access denied", i have tried access same wmi from other windows server there it works without any issue

I have tried on windows server core OS on a server, even there it works.

Look like issue specify to the windows core os container image, Firewall service not running & no anit-virus block. remote node reachable

Windows core server container running on Host VM OS windows 2019. Firewall disabled in host OS
C:>python Python 2.7.18 (v2.7.18:8d21aa21f2, Apr 20 2020, 13:25:05) [MSC v.1500 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. import wmi wmispace = wmi.WMI("x.x.x.x", user="administrator", password="xxxxxx") Traceback (most recent call last): File "", line 1, in File "", line 1354, in connect handle_com_error() File "", line 258, in handle_com_error raise klass(com_error=err) wmi.x_access_denied: <x_wmi: Unexpected COM Error (-2147352567, ‘Exception occurred.’, (0, u’SWbemLocator’, u’Access is denied. ‘, None, 0, -2147024891), None)>

Steps reproduce the issue

installed docker on windows 2019

docker pull python:2-windowsservercore

docker run -dit –network publicNetwork –dns cmd.exe

docker attach

in the container cmd,

import wmi
wmispace = wmi.WMI("x.x.x.x", user="administrator", password="xxxxxx")

you will see the above error and error comes in less than 1 sec

Something is block wmi class access from windows container, but same works good on any windows without any issue

Source: Docker Questions