colima: PHP code has problem reading files from host-mounted volume
PHP code running inside a container in some cases fails to access files from outside the container.
This is a local development setup with a volume mounted to the php container from outside (ie. it is shared between the container and host).
Steps to reproduce
Save the following as test.php
:
<?php
$dir = new RecursiveDirectoryIterator(__DIR__);
$iterator = new RecursiveIteratorIterator($dir);
$iterator->setMaxDepth(0);
$files = iterator_to_array($iterator);
echo "Number of files: ".count($files).PHP_EOL;
Running php test.php
outside Docker correctly prints out the number of files in the directory: e.g. Number of files: 12
Running it inside a container (ie. with docker exec) prints out Number of files: 0
Here is a one-liner to test it with (after creating test.php)
docker run -it --rm --name my-running-script -v "$PWD":/usr/src/myapp -w /usr/src/myapp php:7.4-cli php test.php
(Should never print Number of files: 0 because the directory contains at least the test.php file itself)
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 1
- Comments: 23 (6 by maintainers)
In lima 0.8.2 everything works fine 🎉
Is there any place I can find some documentation on how to setup mutagen with colima?
Would it make sense for colima to officially support mutagen and make is easy to setup?