How to run a windows docker container with current host user? – Docker Windows

When I’m running a windows docker container, I want that this container use the same host current user. I want that when I do whoami or echo %username% in the container, I get the same user then in the host.

I’m try to do like this; docker run -it --user castcorplam myImage_8.3.14:2033

but it return error docker: Error response from daemon: container 8ba8ad2f1215171daa70353185fcb47b387966c439de8bd50933451a99de1779 encountered an error during CreateProcess: failure in a Windows system call: The user name or password is incorrect. (0x52e)

I have seen by there https://github.com/moby/moby/issues/28585 but still no solution.

I’m using Docker for Windows, and the image of my containers is
FROM Windowsservercore2016lts

docker run -it --user castcorplam myImage_8.3.14:2033

docker: Error response from daemon: container 8ba8ad2f1215171daa70353185fcb47b387966c439de8bd50933451a99de1779 encountered an error during CreateProcess: failure in a Windows system call: The user name or password is incorrect. (0x52e)
[Event Detail:  Provider: 00000000-0000-0000-0000-000000000000] extra info: {"CommandLine":"c:windowssystem32cmd.exe","User":"castcorplam","WorkingDirectory":"C:","Environment":{"COMPLUS_NGenProtectedProcess_FeatureEnabled":"0"},"EmulateConsole":true,"CreateStdInPipe":true,"CreateStdOutPipe":true,"ConsoleSize":[63,237]}.

I want to connect to my container and resolve this Error response from daemon.

Source: StackOverflow