0

In windows 2019 server, I have successfully installed Docker (Server Version: 19.03.14) and the windows service is up and running. I am working with windows containers, I have written very basic dockerfile as below to display echo message.

FROM mcr.microsoft.com/windows/nanoserver:1809 
CMD ["echo", "Hello World !!"]

I am able to build my image successfully with out any issues (image name hello:v1)

In C:\Users\******>docker images
REPOSITORY                             TAG                 IMAGE ID            CREATED             SIZE
hello                                  v1                  2b1523c901c9        7 days ago          252MB
mcr.microsoft.com/windows/servercore   ltsc2019            152749f71f8f        5 weeks ago         5.27GB
mcr.microsoft.com/windows/nanoserver   1809                5513a3d12ed6        5 weeks ago         252MB

The issue comes, when i try to run the container. By the time when i run below command to start\run the container the session is getting log off automatically. I have to again log in to new session.

C:\Users\*******>docker run hello:v1

Server details:

  • Edition : Windows Server 2019 Standard
  • Version : 1809
  • OS Build: 17763.1879
James Z
  • 12,209
  • 10
  • 24
  • 44
Pavan
  • 1
  • Because the container will stop running when the main process stopped, in your case, the process is `echo`, so the container stopped after `echo "Hello World !!"` – frank_lee May 19 '21 at 08:02
  • Hi @frank_lee, I understand, if that is the reason i should see the message "Hello World !!" printed by the container. But, it is not happening there is no any response in docker run command instead of that my session is getting logged off. – Pavan May 20 '21 at 04:33
  • Here session in the sense not container session, windows server remote login session (RDP) – Pavan May 20 '21 at 05:25

1 Answers1

-1

try this

FROM mcr.microsoft.com/windows/nanoserver:1809 
CMD echo Hello World!
frank_lee
  • 346
  • 1
  • 9
  • Now it displayed the message 0n docker run command, C:\Users\******>docker run image Hello World! – Pavan May 21 '21 at 06:39
  • But, I would like to understand 2 questions here 1) why my server session is still getting logged off after container process done ? It is asking me to re login to the new session to access the server ? 2) once log into new session, not able to see any container, I agree there shouldn't be any running container but atleast the previous container should be list in stopped state which is not happening. C:\Users\****>docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES – Pavan May 21 '21 at 06:39
  • can you try `docker run -d IMAGE_NAME` to check the problem still exist – frank_lee May 21 '21 at 08:27
  • Yes, it is still exist (session log off). But, this time it didn't display the message instead it showed some id as e177de856jkl34tw32n.......... and session logged off. – Pavan May 24 '21 at 06:20
  • Hi @frank_lee, Any thoughts over here ? – Pavan May 31 '21 at 13:47
  • This works fine for me. Since I cannot reproduce the bug, I cannot provide other advice, I'm sorry – frank_lee Jun 01 '21 at 03:59
  • That is ok. Which means are you not facing any session log off issues on 2019 server ? – Pavan Jun 01 '21 at 15:54
  • frank_lee Server details: Edition : Windows Server 2019 Standard Version : 1809 OS Build: 17763.1879 The above are my server configuration, any other configuration that i need check from end to run docker container ? – Pavan Jun 08 '21 at 04:04