2

I have a docker setup using 2 containers one running mysql and another one apache and php on ubuntu image. I am using docker-compose to orchestrate the setup. I have few env variables setup on the apache-php container on which I am running a cron job. The cron job does a http request to itself and having issues accessing my env variable.

The cron job is using codeigniter's CLI. Once the docker container is built up my crontab file looks like below

MYSQL_USER=something
MYSQL_DB=something
MYSQL_PASS=something
_=/usr/bin/env
# Start the cron
* * * * * php /app/index.php printhello >> /var/log/cron.log 2>&1
# An empty line is required at the end of this file for a valid cron file.

The cron runs but env variables are not getting used inside my application. If I run the command on cron manually it works.

Any help would be appreciated. Let me know if you need to see any other part of my code.

Deepak
  • 121

0 Answers0