Using: Ubuntu Server 14.04 x64 LXD 2.0.0

I have several containers (all of them running "alpine-edge") in which I'm running lighttpd + mysql.

The problem is that each time I restart the containers I have to restart manually those services as they don't start automatically.

What do I need to do to fix that?


The temporally work-around that I'm using is to:

lxc exec alpine-edge service lighttpd start

from the parent OS (inside an init script). But I believe there should be a way to do it automatically inside the container, so if I manually reboot it (the container), I don't have to execute that command each time.

  • Have you enabled these services on the containers (as in service enable <service-name>)? – Jonathan Y. May 24 '16 at 20:58
  • No, I haven't. This is what it returns: service enable lighttpd : service: service 'enable' does not exist. – lepe May 25 '16 at 0:36
  • That should've been service lighttpd enable; sorry. – Jonathan Y. May 25 '16 at 8:05
  • Tried that too, but it reports: "enable" unknown function. I think is because alpine has no such function. – lepe May 25 '16 at 8:15
  • 1
    Ah, yes, sorry, I'm learning this as I go along. So Alpine uses OpenRC instead of systemd. From this cheatsheet that I found, does rc-update add lighttpd default work? – Jonathan Y. May 25 '16 at 8:28

Alpine Linux uses OpenRC for its init system. The basic commands to interact with it are

rc-update add <service> [runlevel]

adds service to the init sequence (similarly to systemd's systemctl enable <service> in Ubuntu 15.04 and forward);

rc-update del <service> [runlevel]

stops service from starting during system init (similarly to systemd's systemctl disable <service>);

rc-service <service> [start stop restart]

manages currently running services (similarly to systemd's systemctl [start stop restart] <service>, or equivalently /etc/init.d/service [start stop restart] which works in both systemd and OpenRC).

More information can be found on the Alpine Wiki page I linked to above, and a cheatsheet for OpenRC-systemd translation is available here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.