coolify icon indicating copy to clipboard operation
coolify copied to clipboard

[Bug]: Docker Compose Deployments Still Have Issues If Repo Files Are Needed.

Open DanyaalMajid opened this issue 10 months ago • 10 comments

Error Message and Logs

Description

We are encountering issues with Docker Compose deployments when repository files are required, similar to past issues referenced below.

The Dockerfile and docker-compose.yml are located in the docker/ directory in the repository. They are properly detected in the dashboard, but deployment fails with an error stating that the /artifacts/docker directory does not exist.

Related Issues

  • https://github.com/coollabsio/coolify/issues/1996
  • https://github.com/coollabsio/coolify/issues/3114

These issues seem related, but our case appears to be a new variation of the problem.

Build Log

Starting deployment of danyaal-majid/replica-backend:main to localhost.
Preparing container with helper image: ghcr.io/coollabsio/coolify-helper:1.0.6.
[CMD]: docker rm -f z0808gscooo8coc8o008ks08
Error response from daemon: No such container: z0808gscooo8coc8o008ks08
[CMD]: docker run -d --network coolify --name z0808gscooo8coc8o008ks08 --rm -v /var/run/docker.sock:/var/run/docker.sock ghcr.io/coollabsio/coolify-helper:1.0.6
7de73f56514fdea3ad93ed41d11de4d58f98e526dafb870ed47d80fc45d6aa9f
[CMD]: docker exec z0808gscooo8coc8o008ks08 bash -c 'GIT_SSH_COMMAND="ssh -o ConnectTimeout=30 -p 22 -o Port=22 -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" git ls-remote [https://x-access-token:<REDACTED>@github.com/DanyaalMajid/replica-backend.git](https://x-access-token:%3CREDACTED%[email protected]/DanyaalMajid/replica-backend.git) main'
76aa2432285ef42460f8f898cadab0c4e109abed	refs/heads/main
9495055499d8b523b47138781da4a292870fee0f	refs/remotes/origin/main
----------------------------------------
Importing DanyaalMajid/replica-backend:main (commit sha HEAD) to /artifacts/z0808gscooo8coc8o008ks08.
[CMD]: docker exec z0808gscooo8coc8o008ks08 bash -c 'git clone -b "main" [https://x-access-token:<REDACTED>@github.com/DanyaalMajid/replica-backend.git](https://x-access-token:%3CREDACTED%[email protected]/DanyaalMajid/replica-backend.git) /artifacts/z0808gscooo8coc8o008ks08 && cd /artifacts/z0808gscooo8coc8o008ks08 && GIT_SSH_COMMAND="ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" git submodule update --init --recursive && cd /artifacts/z0808gscooo8coc8o008ks08 && GIT_SSH_COMMAND="ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" git lfs pull'
Cloning into '/artifacts/z0808gscooo8coc8o008ks08'...
[CMD]: docker exec z0808gscooo8coc8o008ks08 bash -c 'cd /artifacts/z0808gscooo8coc8o008ks08 && git log -1 76aa2432285ef42460f8f898cadab0c4e109abed --pretty=%B'
Add docker configurations.
[CMD]: docker exec z0808gscooo8coc8o008ks08 bash -c 'stat -c '%F' /artifacts/z0808gscooo8coc8o008ks08.'
stat: can't stat '/artifacts/z0808gscooo8coc8o008ks08.': No such file or directory
Pulling & building required images.
[CMD]: docker exec z0808gscooo8coc8o008ks08 bash -c 'SOURCE_COMMIT=76aa2432285ef42460f8f898cadab0c4e109abed COOLIFY_BRANCH=main  docker compose --env-file /artifacts/z0808gscooo8coc8o008ks08/.env --project-name s0s00o8440gwsoososo0o4gk --project-directory /artifacts/z0808gscooo8coc8o008ks08 -f /artifacts/z0808gscooo8coc8o008ks08/docker/docker-compose.yml build --pull'
Service celery  Building
Service fastapi  Building
resolve : lstat /artifacts/docker: no such file or directory
Oops something is not okay, are you okay? 😢
Service celery  Building
Service fastapi  Building
resolve : lstat /artifacts/docker: no such file or directory

Steps to Reproduce

Steps to Reproduce

  1. Set up a repository with a Dockerfile and docker-compose.yml inside a subdirectory (e.g., docker/).
  2. Connect the repository to Coolify and ensure it detects the Docker Compose setup.
  3. Enable the "Preserve Repository During Deployment" Option.
  4. Trigger a deployment using the Coolify dashboard.
  5. Observe the build log, which should show errors related to missing /artifacts/docker directory.
  6. The deployment fails with the error:
   resolve : lstat /artifacts/docker: no such file or directory

This issue seems related to previous problems with handling repository files in deployments.

Example Repository URL

No response

Coolify Version

v4.0.0-beta.394

Are you using Coolify Cloud?

No (self-hosted)

Operating System and Version (self-hosted)

Ubuntu 24.10

Additional Information

No response

DanyaalMajid avatar Feb 19 '25 05:02 DanyaalMajid

@andrasbacsai For the record, the issue is caused by word wrapping. Disabling it resolves the problem:

File: /var/www/html/resources/views/components/form/monaco-editor.blade.php:

...
wordWrap: 'off',
...

Of course, disabling word wrapping is not the proper solution. I believe there's a bug elsewhere, but this serves as a temporary workaround.

nuxwin avatar Feb 21 '25 22:02 nuxwin

@andrasbacsai Sorry, the comment below was not for this issue ... The right issue: https://github.com/coollabsio/coolify/issues/5159

nuxwin avatar Feb 22 '25 12:02 nuxwin

Having the same problem

Locally the docker compose works, but Coolify fails to build with

2025-Feb-22 18:13:40.580570
Oops something is not okay, are you okay? 😢
2025-Feb-22 18:13:40.584546
Service nginx-test  Building
2025-Feb-22 18:13:40.584546
resolve : lstat /deployment: no such file or directory
2025-Feb-22 18:13:40.584546
exit status 17

This is an my docker compose using a custom nginx Dockerfile :

./deployment/NginxTest/docker-compose.yml

services:
  nginx-test:
    hostname: nginx-test
    image: nginx-test:latest
    restart: on-failure:2
    build:
      context: ../../
      dockerfile: ./deployment/NginxTest/Dockerfile.NginxTest
      target: nginx-test
    ports:
      - 8888:80
    expose:
      - 8888

I believe the Dockerfile can be as simple as :

./deployment/NginxTest/Dockerfile.NginxTest

FROM nginx:1.27.4 AS nginx-test

RUN apt-get update && apt-get upgrade -y

ENTRYPOINT ["/bin/bash","tail" "-f" "/dev/null "]

MarArMar avatar Feb 22 '25 18:02 MarArMar

Putting the same exact docker compose file at the root of the repo (and putting context : . ) solved the problem 👍

MarArMar avatar Feb 22 '25 18:02 MarArMar

I stumbled on the same thing, but there were issues in my compose file, so I though that may have been the problem.

Basically docker compose files in sub directories cause breakage of builds, Docker files themselves can be kept in sub directories. But the compose file must be in the root always.

DanyaalMajid avatar Feb 22 '25 18:02 DanyaalMajid

@DanyaalMajid I don't know if this is completed tho, I would still put this as a bug OR at least inform the user in the UI that they cannot use docker compose not in the root folder of the repo

MarArMar avatar Feb 24 '25 12:02 MarArMar

Agreed, I did not consider this beforehand, we can leave it opened for now.

DanyaalMajid avatar Feb 24 '25 12:02 DanyaalMajid

Is there any update on this issue so that we can still be able to use docker compose files in docker/ folder

sglbl avatar May 28 '25 14:05 sglbl

I stumbled on the same thing, but there were issues in my compose file, so I though that may have been the problem.

Basically docker compose files in sub directories cause breakage of builds, Docker files themselves can be kept in sub directories. But the compose file must be in the root always.

Actually when I tried with these settings, it worked for me. My docker/ directory:

Image

My Coolify Setting:

Image

So even though my base directory is root, on coolify I had to select docker/ but then it worked.

sglbl avatar May 29 '25 07:05 sglbl

It may have been fixed, i haven't messed with my deployment system for a couple months, will have to try again and see if its fixed.

DanyaalMajid avatar May 29 '25 16:05 DanyaalMajid

I stumbled on the same thing, but there were issues in my compose file, so I though that may have been the problem. Basically docker compose files in sub directories cause breakage of builds, Docker files themselves can be kept in sub directories. But the compose file must be in the root always.

Actually when I tried with these settings, it worked for me. My docker/ directory:

img

My Coolify Setting:

img

So even though my base directory is root, on coolify I had to select docker/ but then it worked.

God bless you! I was suffering from this bug for days. Unfortunately the bug is still active.

Image

And luckily your solution works with nested directories

djedu28 avatar Jul 21 '25 10:07 djedu28

@djedu28 You're welcome! I'm glad this solved your issue.

sglbl avatar Jul 21 '25 13:07 sglbl