Cannot run the script by crontab inside docker container

I encounter a problem that I can run successfully the script (full path: /usr/local/bin/ by a manual way (by accessing into musicbrainz docker container, and execute it). But when I set crontab for this script, it throws this error when executing (I get this error from file slave.log):

Can’t locate in @INC (you may need to install the aliased module) (@INC contains: /musicbrainz-server/admin/replication/…/…/lib /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.30.0 /usr/local/share/perl/5.30.0 /usr/lib/x86_64-linux-gnu/perl5/5.30 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.30 /usr/share/perl/5.30 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base) at /musicbrainz-server/admin/replication/…/…/lib/MusicBrainz/Server/ line 6.
BEGIN failed–compilation aborted at /musicbrainz-server/admin/replication/…/…/lib/MusicBrainz/Server/ line 6.
Compilation failed in require at /musicbrainz-server/admin/replication/…/…/lib/ line 31.
BEGIN failed–compilation aborted at /musicbrainz-server/admin/replication/…/…/lib/ line 31.
Compilation failed in require at ./admin/replication/LoadReplicationChanges line 32.
BEGIN failed–compilation aborted at ./admin/replication/LoadReplicationChanges line 32.

based on the error message, I tried to install JSON by command: cpan JSON, but the error is still throwed

Anyone can help me?

I found an alter way to re-implement the script.
Maybe the latest script has a problem that cannot run properly, including the command “set -e” which imports all environment variables before running doesn’t work. I have to implement the script based on the old version of script. This is my current script (I named it as


eval $( /usr/bin/perl -Mlocal::lib )
/bin/bash /musicbrainz-server/admin/cron/

you can change all above necessary environment variables to a correct value in your system
Finally, re-define a current crontab job by using command: crontab -e , then change the cron job expression:

0 3 * * * /usr/local/bin/

Close the crontab window by press: Esc → type :wq to close
That’s it. Hopes it help all you who are facing the same problem