There are a few questions covering this issue but none of them are solving my problem. This is a Symfony 2.8 application running in a PHP 7.1 docker container.
When the command is run as cron, the absolute URLs are using localhost in emails. I've tried both suggestions in the documentation here - configuring on the command itself and globally in parameters.
Everything works until the command is run by cron - even if I run the same manually. For example, running the following on the host into the container correctly generates the absolute URLs:
docker-compose exec --user www-data application sh -c "cd /var/www/html && /usr/local/bin/php app/console my:command -e=stage"
But my cron is reverting to localhost:
1-59/3 * * * * www-data cd /var/www/html && /usr/local/bin/php app/console my:command -e=stage
Cron is running inside the container. If I bash into the container as www-data and run: /usr/local/bin/php app/console my:command -e=stage it also works correctly so I'm at a loss as to why it's not playing ball as a crontab.