[Bug]: Mounting files or directories in Docker Compose does not work
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
- Add git repository
- Use Docker-Compose as build option
- Deploy
- 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 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 Thanks! Oh, I wasn't aware of that and did not select the "Preserve repository" checkbox.
With this checkbox ticked, it works 🥳
@djsisson Is it a general recommendation to use COPY inside a Dockerfile with Coolify instead of mounting files? Or are mounts fine as well?