I’m running on a windows host different server core VMs (hyper-v) and in each one docker service. The containers I try to run, using docker run nanoserver/iis-php
command, are created but immediately disappear, exited with exit code 0, no error messages. Since it happens in different VMs, I believe it is something in the VMs host. Any idea?
2
Answers
according to https://hub.docker.com/r/nanoserver/iis-php
use
docker run --name nanoiis -d -it -p 80:80 nanoserver/iis-php
so that the container is started in daemon mode, interactive mode and with tty
I do not know iis-php, but from the dockerfile of the image below, the last command is just to make webrequet, do not see any server process started.
https://github.com/nanoserver/IIS-PHP/blob/master/Dockerfile/Dockerfile
So as I understand they don’t disappear but simply exit immediately with an exit code of 0 which you still can see with
docker ps -a
?The exit code
0
indicates "success". So it looks like the containers were created and started successfully and the processes started in them executed "successfully". But what this means depends an the actual command started in the containers.But neither the
Dockerfile
of thenanoserver/iis-php
image nor theDockerfile
of its base imagenanoserver/iis
specify aCMD
. Also no command is specified in yourdocker run
command.This looks like an interactive command prompt expecting user input. So what most probably is happening here is that the containers start a simple interactive shell since no other command to execute is explicitly specified. But since no
stdin
is attached to the container it can not read any input and will exit again.You can test that the containers / your
docker
setup is working correctly withThis should drop you into the interactive shell inside the container. You could then interactively execute commands in the container.
In order to have it run in the background you have to pass and command to execute to
docker run