coolify icon indicating copy to clipboard operation
coolify copied to clipboard

[Bug]: Mounting files or directories in Docker Compose does not work

Open mandrasch opened this issue 8 months ago • 3 comments

Error Message and Logs

Adding files or directories via volumes does not work in latest Coolify 4.0.0-beta.401 (force-update), in the resulting container they are just empty.

version: '3'
services:
  web:
    image: nginx:alpine
    volumes:
      - ./web:/usr/share/nginx/html
      - ./default.conf:/etc/nginx/conf.d/default.conf

Steps to Reproduce

  1. Add git repository
  2. Use Docker-Compose as build option
  3. Deploy
  4. Check mounted folders, e.g. /usr/share/nginx/html

Confirmation in Discord support discussion: https://discord.com/channels/459365938081431553/1355504172920864911/1355898657576190223

Reproduction branch: https://github.com/mandrasch/coolify-docker-compose-simple-example/tree/test-nginx-conf

Example Repository URL

https://github.com/mandrasch/coolify-docker-compose-simple-example/tree/test-nginx-conf

Coolify Version

4.0.0-beta.401

Are you using Coolify Cloud?

No (self-hosted)

Operating System and Version (self-hosted)

Ubuntu 22.04

Additional Information

Thanks very much for this awesome piece of software!

mandrasch avatar Mar 30 '25 16:03 mandrasch

@mandrasch can you confirm that you did you tick preserve repo? if not these files don't exist on your host (your repo and project are seperate)

i would recommend just a simple Dockerfile running

FROM nginx:alpine AS BASE

COPY ./web /usr/share/nginx/html
COPY ./default.conf /etc/nginx/conf.d/default.conf

djsisson avatar Mar 30 '25 16:03 djsisson

@djsisson Thanks! Oh, I wasn't aware of that and did not select the "Preserve repository" checkbox.

Image

With this checkbox ticked, it works 🥳

mandrasch avatar Mar 30 '25 16:03 mandrasch

@djsisson Is it a general recommendation to use COPY inside a Dockerfile with Coolify instead of mounting files? Or are mounts fine as well?

mandrasch avatar Mar 30 '25 16:03 mandrasch