2

I'm trying to run xinetd in a Docker container.

My Docker file is very basic:

# voip-monitor
#
# VERSION               0.0.1
FROM ubuntu:14.04

RUN apt-get update && apt-get install -y xinetd python 

EXPOSE 9090 
CMD ["/usr/sbin/xinetd", "-d -dontfork"]

When I start my container with:

docker run -d -p 9090:9090 --name voip-monitor voip-monitor

It starts but exists after 2 seconds.

When I start my container with:

docker run -d -p 9090:9090 --name voip-monitor voip-monitor /usr/sbin/xinetd -d -dontfork

It works as expected. What am I missing here?

peterh
  • 4,914
  • 13
  • 29
  • 44
Jeroen Moors
  • 123
  • 1
  • 4

3 Answers3

2

I think the problem is that the -d and -dontfork options are put into the same array element/string in the Dockerfile above:

CMD ["/usr/sbin/xinetd", "-d -dontfork"]

Correcting the CMD instruction to

CMD ["/usr/sbin/xinetd", "-d", "-dontfork"]

should solve the problem.

VolkerM
  • 21
  • 2
1

Do you need the "-d" parameter?

I tried to launch a container based on your image and here's what I got:

root@r2d2:/tmp/tmp# docker run -d -p 9090:9090 --name voip-monitor voip-monitor
e482c8d486134749c6f2747c252eed96f628924c4158c05ca09ac487ff87db24
root@r2d2:/tmp/tmp# docker logs voip-monitor 
xinetd: msg_init failed: can't open log file

Checking the source code I think this line could be the problem, probably related to /dev/tty access.

Removing the "-d" parameter solved the problem for me.

denaitre
  • 88
  • 5
0

While, the -d is possibly not needed, many of us love the verbose option. To emulate a tty and make xinetd happy, try using the script command.

script -c "xinetd -d -dontfork"

Which becomes

CMD ["script", "-c", "xinetd -d -dontfork"]
or
CMD script -c "xinet -d -dontfork"

Works with the debian:8 image using docker 1.13.0

Andy
  • 130
  • 4