2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

runitを使って1コンテナで複数プロセスを動かす

2
Posted at
  • 以下例では、apacheとcronを同時に動かす。
FROM debian

RUN apt update
RUN apt install -y runit
# cronの編集のためviを入れておく。
RUN apt install -y cron vim-tiny
RUN apt install -y apache2

# httpd
RUN mkdir /etc/service/apache2 \
 && echo '#!/bin/sh\n apachectl -D FOREGROUND' > /etc/service/apache2/run

# crond
RUN mkdir /etc/service/cron \
 && echo '#!/bin/sh\n cron -f' > /etc/service/cron/run

EXPOSE 80

ENTRYPOINT ["runit"]
run.sh
docker run -it --rm \
 -p 8080:80 \
 fce20496366a
  • cronは /var/spool/cron/crontabs/ が使われるため永続化は以下でよいかと。
run.sh
-v $(pwd)/crontabs/:/var/spool/cron/crontabs/
2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?