0

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?

6
  • See following : stackoverflow.com/questions/49413443/… Commented Mar 9, 2023 at 9:44
  • Thank you! The thing is it works for other customers. I would prefer not to create a special image just for one time. Do you know any reason why it wouldn't work for this server? Commented Mar 9, 2023 at 9:50
  • The library isn't installed. Commented Mar 9, 2023 at 10:41
  • Installing VC++ redistributables on the host made no difference Commented Mar 9, 2023 at 10:42
  • Are dlls in same location on working and non working? Is anything different with installation? Maybe a PATH? Commented Mar 9, 2023 at 11:47

3 Answers 3

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

#WORKDIR /
#WORKDIR /config
WORKDIR c:\config
ADD run.ps1 c:\config\run.ps1


ENTRYPOINT ["powershell", "-ExecutionPolicy", "Bypass", "-NoProfile", "-File", "run.ps1"]

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

Sign up to request clarification or add additional context in comments.

Comments

0

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"]

Comments

0

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..

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.