Docker Community Forums

Share and learn in the Docker community.

Where does stdout of /sbin/init go?


(Liuyb) #1

I’m trying sysvinit-core in debian:jessie image with latest boot2docker-1.3.1 on Mac OS X.

FROM        debian:jessie
RUN         apt-get update && apt-get install -y sysvinit-core
CMD         [ "/sbin/init" ]

$ docker build -t test .
$ docker run -d -t test
…add two lines into /etc/rc.local:
…date >> /tmp/a.log
…date
$ docker restart THE-CONTAINER-ID
$ docker exec -i -t THE-CONTAINER-ID /bin/bash

then I can see the log file /tmp/a.log, but there is no output from “docker logs THE-CONTAINER-ID”, I also grep-ed /var/log/*, didn’t find it, where does the stdout of /sbin/init go?

I tried “docker run -d test” without the option “-t” or even without “-d”, still can’t see any output on my terminal emulator.


(Liuyb) #2

I got a workaround: https://github.com/docker/docker/issues/9212


(Sven Dowideit) #3

and for history, that would be:

$ docker run -t ubuntu bash -c         'cat </dev/console >/dev/null 2>&1 & exec /sbin/init'
Mount failed for selinuxfs on /sys/fs/selinux:  No such file or directory
 * Starting Mount filesystems on boot                                                                                          [ OK ]
 * Starting Signal sysvinit that the rootfs is mounted                                                                         [ OK ]
 * Starting Populate /dev filesystem                                                                                           [ OK ]
 * Stopping Read required files in advance (for other mountpoints)                                                             [ OK ]
 * Starting Clean /tmp directory                                                                                               [ OK ]
 * Stopping Clean /tmp directory                                                                                               [ OK ]
 * Stopping Populate /dev filesystem                                                                                           [ OK ]

and then you can use docker exec to enter.