beewest
beewest

Reputation: 4856

docker windows image hang when running without tty parameter

We are containerize a inhouse .NET 4.7 console app using Windows docker image mcr.microsoft.com/windows/servercore:ltsc2019.

docker run my-image is hang when running however docker run -t my-image is working fine.

dockerfile:
    FROM mcr.microsoft.com/windows/servercore:ltsc2019
    COPY c:/myapp/ ./myapp/
    RUN c:\windows\system32\regsvr32.exe /s c:\myapp\somedll.dll
    RUN "c:\myapp\myapp.exe" mydata.csv

Any idea please?

Upvotes: -1

Views: 280

Answers (1)

9dan
9dan

Reputation: 4282

docker run [image name] command run the container and wait for it until the process ends.

with -t option, we can connect the current console(tty) to the container, so we can see the output.

with -i option, we can also use input (interactive mode).

with -d option, we can detach the container so it could run like a server.

Typically, use run -d option for server start and run -ti option for debugging.

I think a docker container not much different from a local process. We could run it foreground (-ti) or background (-d).

Upvotes: 0

Related Questions