You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Unable to run mcr.microsoft.com/windows/nanoserver:ltsc2025 based containers with custom users #640
Describe the bug
Unable to run mcr.microsoft.com/windows/nanoserver:ltsc2025 based containers with custom users.
To Reproduce
Steps to reproduce the behavior:
Create the following dockerfile:
FROM mcr.microsoft.com/windows/nanoserver:ltsc2025
USER ContainerAdministrator
RUN net accounts /MaxPWAge:unlimited && \
net user /add "MyCustomUser" /expires:never && \
net localgroup "Network Configuration Operators" "MyCustomUser" /add
USER MyCustomUser
ENTRYPOINT ["CMD"]
Build an image using the above dockerfile: docker build -f Dockerfile -t my-test-image .
Run the container: docker run my-test-image
Output:
$ docker run my-test-image
b8a23122bd391ac7db803793a98b55752372d44e06af5b8a5ddf1fa74f614b62
docker: Error response from daemon: container b8a23122bd391ac7db803793a98b55752372d44e06af5b8a5ddf1fa74f614b62 encountered an error during hcs::System::CreateProcess: CMD: failure in a Windows system call: The specified domain either does not exist or could not be contacted. (0x54b)
Run 'docker run --help' for more information
Expected behavior
The container should run successfully like it does for mcr.microsoft.com/windows/servercore:ltsc2022.
Configuration:
Edition: Windows Server 2025
Base Image being used: mcr.microsoft.com/windows/nanoserver:ltsc2025
Container engine: Docker
Container Engine version:
PS C:\Users\Administrator> docker version
Client:
Version: 29.1.5
API version: 1.52
Go version: go1.25.6
Git commit: 0e6fee6
Built: Fri Jan 16 12:51:08 2026
OS/Arch: windows/amd64
Context: default
Server: Docker Engine - Community
Engine:
Version: 29.1.5
API version: 1.52 (minimum version 1.44)
Go version: go1.25.6
Git commit: 3b01d641
Built: Fri Jan 16 12:48:28 2026
OS/Arch: windows/amd64
Experimental: false
Additional context
The same dockerfile but with the default ContainerUser works fine. Also, the exact same dockerfile but with the mcr.microsoft.com/windows/nanoserver:ltsc2022 image works fine as well.
Thank you for creating an Issue. Please note that GitHub is not an official channel for Microsoft support requests. To create an official support request, please open a ticket here. Microsoft and the GitHub Community strive to provide a best effort in answering questions and supporting Issues on GitHub.
Root cause:nanoserver:ltsc2025 ships with an empty LSA "Primary Domain" name. A custom local user (net user) does a real local logon that requires this value to be non-empty, so it fails with ERROR_NO_SUCH_DOMAIN (0x54b). Built-in ContainerUser/ContainerAdministrator are virtual accounts that skip that path (so they work), and ltsc2022 sets the value to WORKGROUP (so it works there).
Workarounds: use ContainerUser, or ltsc2022, or set a non-empty Primary Domain name at build time (before the USER switch) with a tiny helper.
FROM mcr.microsoft.com/windows/nanoserver:ltsc2025
USER ContainerAdministrator
RUN net accounts /MaxPWAge:unlimited && \
net user /add "MyCustomUser" /expires:never && \
net localgroup "Network Configuration Operators""MyCustomUser" /add
COPY setpd.exe C:\setpd.exe
RUN C:\setpd.exe WORKGROUP
USER MyCustomUser
ENTRYPOINT ["CMD"]
Activity
github-actions commentedon Jul 14, 2026
Thank you for creating an Issue. Please note that GitHub is not an official channel for Microsoft support requests. To create an official support request, please open a ticket here. Microsoft and the GitHub Community strive to provide a best effort in answering questions and supporting Issues on GitHub.
rawahars commentedon Jul 15, 2026
Root cause:
nanoserver:ltsc2025ships with an empty LSA "Primary Domain" name. A custom local user (net user) does a real local logon that requires this value to be non-empty, so it fails withERROR_NO_SUCH_DOMAIN(0x54b). Built-inContainerUser/ContainerAdministratorare virtual accounts that skip that path (so they work), andltsc2022sets the value toWORKGROUP(so it works there).Workarounds: use
ContainerUser, orltsc2022, or set a non-empty Primary Domain name at build time (before theUSERswitch) with a tiny helper.setpd.c(~15 lines):Build a static exe (runs on Nano Server, no CRT deps):
Fixed Dockerfile:
qasim-sajid-snkeos commentedon Jul 16, 2026
Harsh Rawat (@rawahars) thanks for the quick and detailed response.
I tried your solution and it worked, so closing the issue.