Good day. I would like to use the whenever gem for my ruby on rails project. However, I discovered that crontab command is not found on my container. I used apt-get install cron but it returns Unable to locate package cron
Below is my Dockerfile and docker-compose file.
Dockerfile
FROM ruby:2.4
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
postgresql-client build-essential libpq-dev nodejs \
&& rm -rf /var/lib/apt/lists/*
RUN touch /var/log/cron.log
RUN apt-get -y install cron
WORKDIR /src/tmp
COPY Gemfile* ./
RUN gem install bundler
RUN bundle install
VOLUME /source
EXPOSE 3000
CMD ["bash"]
docker_compose.yml
version: '2.1'
services:
legacy:
image: mysql
env_file: ./docker.env
volumes:
- ../mydump:/docker-entrypoint-initdb.d
- ../mycache:/var/lib/mysql
db:
image: postgres
env_file: ./docker.env
web:
build: .
command: bash
volumes:
- .:/source
ports:
- "3000:3000"
depends_on:
- db
- legacy
links:
- db
- legacy
tty: true
env_file: ./docker.env
I also tried including the installation in the Dockerfile but the build process halted because of the error in installing cron. Any suggestions on how to fix this? Thank you very much.
P.S. I execute the installation after running bash for the container.