8000 [Bug]: Bind source path does not exist (development) · Issue #3918 · coollabsio/coolify · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
[Bug]: Bind source path does not exist (development) #3918
Open
@peaklabs-dev

Description

@peaklabs-dev

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

  1. Create a MongoDB on MacOS
  2. 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:

$docker_compose['services'][$container_name]['volumes'][] = [
'type' => 'bind',
'source' => $this->configuration_dir.'/docker-entrypoint-initdb.d',
'target' => '/docker-entrypoint-initdb.d',
'read_only' => true,
];

  • 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:

$this->commands = [
"echo 'Starting {$database->name}.'",
"mkdir -p $this->configuration_dir",
];

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:
    $docker_compose['services'][$container_name]['volumes'][] = [
    'type' => 'bind',
    'source' => $this->configuration_dir.'/custom-postgres.conf',
    'target' => '/etc/postgresql/postgresql.conf',
    'read_only' => true,
    ];
  • 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.

EDIT:
-> It seems that the issue is docker bind mounts itself -> with the paths above it wants to bind mount the path on the host system but on dev we have a docker volume that needs to be mounted so bind mounts to the host do not work. We bind mount a path inside a docker volume inside a container - not sure why docker does not get that :). A dev fix (not pretty but works) was added here:

if (isDev()) {
$this->configuration_dir = '/var/lib/docker/volumes/coolify_dev_coolify_data/_data/databases/'.$container_name;
}

Metadata

Metadata

Assignees

Labels

🐛 BugReported issues that need to be reproduced by the team.🐞 Confirmed BugVerified issues that have been reproduced by the team.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0