Skip to content

[Bug]: v4 Git repo with Build Pack: Docker Compose: volumes created with wrong name #2168

Closed
@colinmollenhour

Description

@colinmollenhour

Description

In normal Docker Compose (without Coolify), using a named volume means your volume will be created with the project name prepended to it. For example:

services:
  mariadb:
    image: mariadb
    volumes:
      mydb:/var/lib/mysql

Coolify v4 is changing the compose spec to look like this:

services:
  mariadb:
    image: mariadb
    volumes:
      oksgc84_mydb:/var/lib/mysql
volumes:
  oksgc84_mydb:
    name: oksgc84_mydb

This works fine when deploying a new resource with a raw Docker Compose spec. However, when deploying a resource from a Git repo with Build Pack: Docker Compose, it is turning into this:

services:
  mariadb:
    image: mariadb
    volumes:
      mydb:/var/lib/mysql
volumes:
  mydb:
    name: mydb

This is very bad because by adding name: mydb to the compose spec the volume is not created with any namespacing and then there is zero separation between projects so any two that use "Build Pack: Docker Compose" and a volume with "mydb" will have a conflict. I think Services would also be affected?

The UID needs to be added as a prefix to the rendered Compose file like it is for the raw Docker Compose deployment or the name: mydb not added so that Docker Compose can namespace the project volumes properly.

Minimal Reproduction (if possible, example repository)

Example repo here:
https://github.com/colinmollenhour/coolify-bug-report

Screenshot:
image

Exception or Error

No response

Version

v4.0.0-beta.276

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions