skip to Main Content

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


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

    Login or Signup to reply.
  2. the containers […] are created but immediately disappear, exited with exit code 0, no error messages.

    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 the nanoserver/iis-php image nor the Dockerfile of its base image nanoserver/iis specify a CMD. Also no command is specified in your docker run command.

    docker logs gives me nothing just: Microsoft Windows [Version 10.0.14393] (c) 2016 Microsoft Corporation. All rights reserved. C:>

    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 with

    docker run -ti nanoserver/iis-php
    

    This 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

    # this is just an example! The exact command you need
    # depends on what you actually want to run inside the container
    docker run -d nanoserver/iis-php php index.php
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search