Ruby in docker container, I have a problem executing script by crontab

Hi!
I made docker:
Dockerfile:
FROM ruby:2.7

RUN mkdir /usr/src/app
WORKDIR /usr/src/app

COPY Gemfile Gemfile.lock ./
RUN gem install bundler
RUN bundle install

COPY ./ ./
RUN chmod +x docker-entrypoint.sh

CMD ["./docker-entrypoint.sh"]

docker-entrypoint.sh

#!/bin/sh

echo 'date.local upload script started at: ’ ( date ‘+%F %H:%M:%S’ ) ruby /usr/local/bundle/gems/ckan_cli-1.0.2/exe/cli.rb upload -d http://date.local/register.csv -c conf.json -r res.json -w echo 'date.local upload script ended at: ’ ( date ‘+%F %H:%M:%S’ )
exit 0;

If I start ./docker-entrypoint.sh to do manually in docher bash or from dockerd docker exec -it date.local ./docker-entrypoint.sh script work well. But I need to made crontab job, and one time in day execute this script. I install cron. I made crontab job:
20 22 * * * /usr/src/app/docker-entrypoint.sh >> /var/log/date.local/ date +\%Y\%m\%d -date.local.log 2>&1

But I get the error:
/usr/src/app/docker-entrypoint.sh: 4: /usr/src/app/docker-entrypoint.sh: ruby: not found

I finded more advice internet, But they not work :frowning:
How resolve it?

docker-entrypoint.sh's formatting is broken so it’s a little hard to read - but in cron, the full path of the executable needs to be used.

I redoing docker to docker-compose. And vualla, it worked good.
As next I redoind to K8s.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs