# Docker コンテナ作成時に cron/anacron にジョブを追加する方法

**URL:** <https://meta.discourse.org/t/how-to-add-a-job-to-cron-anacron-when-creating-docker-container/123194>\
**Category:** Self-hosting\
**Created:** [2019 年 7 月 17 日午後 1:20 UTC](https://meta.discourse.org/t/how-to-add-a-job-to-cron-anacron-when-creating-docker-container/123194 "2019-07-17T13:20:29Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)\
**Post date:** [2019 年 7 月 17 日午後 5:53 UTC](https://meta.discourse.org/t/how-to-add-a-job-to-cron-anacron-when-creating-docker-container/123194/8 "2019-07-17T17:53:52Z")

</div>

推奨されているように、適切なプラグインを作成すべきですが、ご質問の対応方法は以下の通りです。

`app.yml` の末尾にある `run` セクションに、以下のような記述を追加してください。

```
  - exec: cp /shared/rr/cron.d.rr /etc/cron.d/rr

```

スクリプトとこのファイルを、discourse ディレクトリではなく `shared` 下にマッピングされているディレクトリに配置してください。

---

_[View the full topic](https://meta.discourse.org/t/how-to-add-a-job-to-cron-anacron-when-creating-docker-container/123194)._
