php Curl confilict CURLOPT_FILE and CURLOPT_RETURNTRANSFER in docker

When I using curl with CURLOPT_FILE and CURLOPT_RETURNTRANSFER option, file is empty, without any curl error:

$fp = fopen($saveTo, 'w+');
$ch = curl_init($fileUrl);
curl_setopt($ch, CURLOPT_FILE, $fp);

curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt ($ch, CURLOPT_COOKIEJAR, 'ccc.text');

curl_exec($ch);

Curl error: No error

echo curl_strerror(curl_errno($ch)); //No error

By remove CURLOPT_RETURNTRANSFER result is true.

I test it in php 5.6 & 7.2 with apache and php-fpm 7.2 with nginx in docker.

Source: StackOverflow