Skip to content

[Bug]: docker compose volumes, bind a file is always considered as directory #6056

Open
@Arnaud-IFEA

Description

@Arnaud-IFEA

Error Message and Logs

from /data/coolify/applications/<project uuid>:

drwxr-x--- 2 debian debian 4096 Jun 24 10:44 grafana.ini

Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error mounting "/data/coolify/applications/ds08wo0gksg08oo4o0cokg4s/grafana.ini" to rootfs at "/etc/grafana/grafana.ini": create mountpoint for /etc/grafana/grafana.ini mount: cannot create subdirectories in "/var/lib/docker/overlay2/0a9f34358f3627017195d34b63abc7b6c5ffd3ce2c693ff48be2a9eee6be9d05/merged/etc/grafana/grafana.ini": not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type

Steps to Reproduce

  1. in the git repo you have an ini file
  2. you use a docker compose for resources
  3. you set a volume with the ini file with the long syntax and is_directory: false
  4. you parse the docker compose in Coolify

Example Repository URL

No response

Coolify Version

v4.0.0-beta.419

Are you using Coolify Cloud?

No (self-hosted)

Operating System and Version (self-hosted)

Debian 12

Additional Information

    volumes:
      - type: bind
        source: ./grafana.ini
        target: /etc/grafana/grafana.ini
        is_directory: false

In the Persistant storage, it is marked as a directory. To date, it seems there is no way to bind a file.

long syntax volumes:

if ((is_null($isDirectory) || ! $isDirectory) && is_null($content)) {
// if isDirectory is not set (or false) & content is also not set, we assume it is a directory
$isDirectory = true;

If there is no content i understand that if is_directory is not set you consider it is a directory, but if is_directory: false you should respect the setting and just bind the container to the file no ?

It's the same thing if you use the short syntax:

$foundConfig = $resource->fileStorages()->whereMountPath($target)->first();
if ($source->startsWith('./') || $source->startsWith('/') || $source->startsWith('~')) {
$type = str('bind');
if ($foundConfig) {
$contentNotNull = data_get($foundConfig, 'content');
if ($contentNotNull) {
$content = $contentNotNull;
}
$isDirectory = data_get($foundConfig, 'is_directory');
} else {
// By default, we cannot determine if the bind is a directory or not, so we set it to directory
$isDirectory = true;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    🐛 BugReported issues that need to be reproduced by the team.🔍 TriageIssues that need assessment and prioritization.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions