I’m using the resin/raspberrypi3-node
image on a Resin application, and the container fails to output terminal logs to the main Resin dashboard.
After doing a little hunting as to how the output from the container would be suppressed, I came across this github issue that states at some point that only the process with PID 1 will output from the container. I believe this is happening in the node container I’m trying to use - when I run ps aux
, PID 1 is root 1 ... /sbin/init quiet systemd.show_status=0
, the systemd init process. This process is initiated from this line in my Dockerfile, ENV INITSYSTEM on
. The process that I would like to output to the terminal is the main /bin/bash
process that just invokes npm start
.
My questions:
- Do I need the systemd step if all I’m doing is running
npm start
in this container? Is something happening in the underlying resin/raspberrypi3-node
container that needs this?
- Can I switch the process that I want into place to get its output instead?
My question may have been misleading, I’m running this node container inside a Docker instance in the top-level container that Resin gives me (the docker-in-docker hack). I realized that the top-level container in Resin outputs all of its logs, but when running Docker inside this container it only gets the logs from PID 1 of each of its containers.
So what I really need is a way to get the output of a different process other than PID 1, or pick up all stdout from the docker-in-docker instance, since it still sounds beneficial to run init-system as PID 1.
Ah I see, you should be able to pipe the output from the child process into the main process, similar to what @justin8 did with his docker-in-docker approach: https://github.com/justin8/resin-multi-container/blob/master/start#L5.
If you’re looking to run multiple things inside the container, I’d recommend checking out the S6 overlay, which linuxserver.io use here: https://github.com/linuxserver/docker-baseimage-alpine
It’s pretty good if you have an app that also needs something like cron running or a secondary process or whatever, and provides simple ways to output logs from processes to stdout of PID 1.
Thanks guys, great resources - I’ll try to get something working with this info.
Did the resources provided by the community end up helping?
If things worked I don’t suppose you’d mind a quick summary for those who land here after a web search would you?
resin.io
Sorry for the lack of follow-up; as you know, other features get in the way, and playing around with the core functionality gets put on the back burner. I ended up disabling init-system
so that I can see my output while I develop, but eventually I’ll get around to re-enabling it and get everything playing nicely together.
Thanks again!