How to run container for a long time?

Zsolt Nagy 20 Reputation points
2023-01-31T09:21:28.7266667+00:00

Hi Everybody,

I downloaded an official MS docker image (mcr.microsoft.com/windows/servercore/iis), and made a container from it.

The container runs only for minutes long than stops.

How can run it for hours or days long? Is there any solution for this?

 

Thank you answer in advance.

Zsolt

Azure Container Instances
Azure Container Instances
An Azure service that provides customers with a serverless container experience.
757 questions
0 comments No comments
{count} votes

Accepted answer
  1. Andrei Barbu 2,596 Reputation points Microsoft Employee
    2023-01-31T09:43:07.47+00:00

    Hello Zsolt,

    You may want to add in PowerShell "timeout -1" in command section when creating the container instance. That is the equivalent of "sleep infinity" for bash. "timeout -1" means that the system will wait indefinitely before terminating the process.
    So something like: ["powershell", "timeout -1"]


    I hope this is helpful. If any clarification needed, let me know and I will do my best to answer.

    Please "Accept as Answer" and Upvote if it helped, so that it can help others in the community looking for help on similar topics.

    Thank you!

    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Zsolt Nagy 20 Reputation points
    2023-01-31T11:24:18.9766667+00:00

    Hi Andrei,

    That would be my next question. :)

    Thank you answer in advance.

    Zsolt

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.