Skip to content

Making use of OpenRC #42

Description

@iby

Please stop me if I'm talking nonsense. I'm trying to figure out if OpenRC can be used as an alternative to supervisord. It comes already shipped with Alpine, it allows to start services and respawn them, and I saw a few notes that it also allows to send logs to stdout. That's kind of everything supervisord is doing in a simple case, right? But OpenRC doesn't require python and other dependencies that quadruple the final image size.

I've tried this:

$ docker run -ti alpine sh
/ # /sbin/init
init: must be run as PID 1
/ # /sbin/openrc
 * Caching service dependencies ...                                                                                                                                                               [ ok ]
/ # apk --update add nginx
…
/ # rc-service nginx start
 * Caching service dependencies ...                                                                                                                                                               [ ok ]
 * You are attempting to run an openrc service on a
 * system which openrc did not boot.
 * You may be inside a chroot or you may have used
 * another initialization system to boot this system.
 * In this situation, you will get unpredictable results!
 * If you really want to do this, issue the following command:
 * touch /run/openrc/softlevel
 * ERROR: fsck failed to start
 * ERROR: cannot start root as fsck would not start
 * ERROR: cannot start localmount as fsck would not start
 * ERROR: cannot start networking as fsck would not start
 * ERROR: cannot start nginx as fsck would not start
/ # touch /run/openrc/softlevel
/ # rc-service nginx start
 * Checking local filesystems  ... [ ok ]
 * Remounting filesystems ... [ ok ]
 * Mounting local filesystems ... [ ok ]
 * Starting networking ...
awk: /etc/network/interfaces: No such file or directory
 * ERROR: networking failed to start
 * ERROR: cannot start nginx as networking would not start

Then I tried to do it this, and it just goes into infinite loop:

$ docker run -ti alpine /sbin/init

   OpenRC 0.15.1.c4bc9ea is starting up Linux 4.0.3-boot2docker (x86_64)

 * /proc is already mounted
 * Mounting /run ...
mount: permission denied (are you root?)
 * Unable to mount tmpfs on /run.
 * Can't continue.
 * Caching service dependencies ...                                                                                                                                                               [ ok ]
can't open /dev/tty1: No such file or directory
can't open /dev/tty2: No such file or directory
can't open /dev/tty3: No such file or directory
can't open /dev/tty4: No such file or directory
can't open /dev/tty5: No such file or directory
can't open /dev/tty6: No such file or directory
can't open /dev/tty1: No such file or directory
can't open /dev/tty2: No such file or directory
can't open /dev/tty3: No such file or directory
can't open /dev/tty4: No such file or directory
can't open /dev/tty5: No such file or directory
can't open /dev/tty6: No such file or directory

Is there a way to use OpenRC instead of supervisord inside the container?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions