2
2

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.

Dockerコンテナでcron使おうとしてCannot make/remove an entry for the specified sessionと表示された際

Posted at

Dockerでcronを動作せたい場合がある。

ただ、Dockerイメージのruby:2.2.2を使うとcronが動作しない。
具体的なエラーメッセージは下記

Cannot make/remove an entry for the specified session

そもそもruby:2.2.2を使うのはrailsを使いたいからなので、Dockerイメージとしてはubuntuを指定しapt-getでrubyなど必要なものを入れることにする。

FROM ubuntu:14.04

RUN apt-get update -qq && apt-get install -y git build-essential libpq-dev cron vim

# ruby
RUN apt-get install -y software-properties-common
RUN apt-add-repository ppa:brightbox/ruby-ng
RUN apt-get update
RUN apt-get install -y ruby2.2
RUN apt-get install -y ruby2.2-dev ruby-bundler

# このあとRailsのWebアプリをADDしたりbundle installしたり
  • ubuntu:14.04ではapt-getしてもrubyが1.9系なのでリポジトリを登録してruby2.2.2を入れる
  • ここには書いてないがsupervisorを入れてrailsとcronを動作するようにする
2
2
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
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?