coolify
coolify copied to clipboard
[Bug]: Bind source path does not exist (development)
Error Message and Logs
When deploying a MongoDB on MacOS in development, the following error occurs:
Error response from daemon: invalid mount config for type "bind": bind source path does not exist: /data/coolify/databases/zkgg04owwck0kw00800g84cg/docker-entrypoint-initdb.d
-> I think this only happens on MacOS because of the strict filesystem restrictions, but I could be wrong.
Steps to Reproduce
- Create a MongoDB on MacOS
- Start it
-> Discord thread: https://discord.com/channels/459365938081431553/1291781262016774198
Coolify Version
v4.0.0-beta.360
Additional Information
I investigated this Bug for a few hours today and found the following things.
- The following lines are causing the problem:
https://github.com/coollabsio/coolify/blob/5d62a46a16f252e6ece4d25fe56838e99883d91b/app/Actions/Database/StartMongodb.php#L110-L115
- If I replace these lines with the following one it works:
$docker_compose['services'][$container_name]['volumes'][] = "$this->configuration_dir/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d:ro";
-> This approach uses the --volume syntax, which is more lenient in creating directories that don't exist (and it works), the other syntax with --mount is more strict, directory must exist for it to work. But when I check the directory is present in both scenarios.
Note I added one more line in addition to the commands to make sure the directory is present: https://github.com/coollabsio/coolify/blob/5d62a46a16f252e6ece4d25fe56838e99883d91b/app/Actions/Database/StartMongodb.php#L28-L31 I added this line to the commands
"mkdir -p $this->configuration_dir/docker-entrypoint-initdb.d/",
Same thing happens for the Postgres config:
- These lines below do not work: https://github.com/coollabsio/coolify/blob/5d62a46a16f252e6ece4d25fe56838e99883d91b/app/Actions/Database/StartPostgresql.php#L110-L115
- If I replace these lines with the following one it works:
$docker_compose['services'][$container_name]['volumes'][] = "$this->configuration_dir/custom-postgres.conf:/etc/postgresql/postgresql.conf:ro";
Why does the second option work in both cases and not the first? Ofc I could just change it everywhere to the second one which works and call it a day, but I would like to investigate and know why the first option does not seem to work.