skip to Main Content

After starting a Windows docker container (base image mcr.microsoft.com/windows/servercore:ltsc2019) on a Windows Server 2019 Datacenter host i cannot start a powershell inside it.

If i create an image from a Dockerfile like this:

FROM mcr.microsoft.com/windows/servercore:ltsc2019

WORKDIR /
WORKDIR /config

ADD /config/run.ps1 /config/run.ps1

CMD ["powershell", "./run.ps1"]

And try to run with docker run -d -it my-image-name i can see the error code 3221225781 in event log.

If i run docker run -it my-image-name powershell i get the error failed to resize tty, using default size and then nothing happens.

If i run docker run -it my-image-name cmd.exe i can enter the container but running powershell inside does nothing (no error message or any output).

I tried disabling antivirus and installing VC++ redistributables on the host but no change.

The same image is working fine for other customers on Windows Server 2019 hosts (not datacenter).

Is there any solution or any additional way for me to try and debug the problem? Could the datacenter edition be a problem?

3

Answers


  1. Chosen as BEST ANSWER

    Finally figured out the problem: Kaspersky.

    As stated in the question i tried deactivating it but that didn't make a difference. What worked was completely uninstalling Kaspersky..


  2. FROM mcr.microsoft.com/windows/servercore:ltsc2019
    
    #WORKDIR /
    #WORKDIR /config
    WORKDIR c:config
    ADD run.ps1 c:configrun.ps1
    
    
    ENTRYPOINT ["powershell", "-ExecutionPolicy", "Bypass", "-NoProfile", "-File", "run.ps1"]
    

    If I understood docker correctly on windows, the paths should also be windows

    Login or Signup to reply.
  3. I’m assuming that run.ps1 is in your /config folder in your build context? If so, you’re defining /config as your working directory. If you want to copy the script into there just use the current directory. is relative to your working directory if you use a relative path. All subsequent commands will use the working directory as your base path.

    FROM mcr.microsoft.com/windows/servercore:ltsc2019
    WORKDIR /config
    COPY /config/run.ps1 .
    
    ENTRYPOINT ["powershell", "-File","run.ps1"]
    CMD ["powershell"]
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search