Docker container is terminating immediately - How to find out why?

116 Views Asked by At

I want to run a VoIP client (linphone) in Docker.

The only one that I was able to build is: https://github.com/develpudu/docker-linphone

Here is the output of the build command:

PS C:\dev\git> docker build -t docker-linphone docker-linphone/develpudu
[+] Building 3.6s (11/11) FINISHED
 => [internal] load build definition from Dockerfile                                                               0.1s
 => => transferring dockerfile: 1.46kB                                                                             0.0s
 => [internal] load .dockerignore                                                                                  0.0s
 => => transferring context: 2B                                                                                    0.0s
 => [internal] load metadata for docker.io/library/ubuntu:bionic                                                   3.4s
 => [1/6] FROM docker.io/library/ubuntu:bionic@sha256:14f1045816502e16fcbfc0b2a76747e9f5e40bc3899f8cfe20745abaafe  0.0s
 => [internal] load build context                                                                                  0.0s
 => => transferring context: 95B                                                                                   0.0s
 => CACHED [2/6] RUN apt-get update && apt-get install -y     linphone     doxygen     pkg-config     pulseaudio   0.0s
 => CACHED [3/6] COPY DockerMain.sh /                                                                              0.0s
 => CACHED [4/6] COPY pulse-client.conf /etc/pulse/client.conf                                                     0.0s
 => CACHED [5/6] COPY hosts /etc/hosts                                                                             0.0s
 => CACHED [6/6] RUN export PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin"          0.0s
 => exporting to image                                                                                             0.0s
 => => exporting layers                                                                                            0.0s
 => => writing image sha256:ce3a667dd1c727019f7c53803b2a59345bd63d388e34d33e7380f5a9350e9f0a                       0.0s
 => => naming to docker.io/library/docker-linphone                                                                 0.0s

After that I ran the image with: docker run -it --rm docker-linphone

The container than appears in Docker Desktop, but when I press the Start button, the Status goes to Running and after one or two seconds to Exited(255). In the logs tab there is nothing shown.

Is there another way to find out what the problem is?

1

There are 1 best solutions below

2
vitalstatistix On

When Docker images terminate like that, your debugging strategy is to override its default commands and then run them manually from the inside.

You can use docker inspect <image> to find the Cmd and the Entrypoint for your image. This tells you what your container executes as it starts. Then, you can start your image with something like docker run -it --rm docker-linphone /bin/bash to override the Cmd with a shell (if there's an entrypoint, then you need to override that too with --entrypoint).

Then in the shell, you can run the regular command the image executes on startup and monitor what happens.