coolify icon indicating copy to clipboard operation
coolify copied to clipboard

[Bug]: mapping files, creating file with content doesn't work

Open ton77v opened this issue 9 months ago • 2 comments

Error Message and Logs

  1. You can't map the file you have in repo, the namesake directory would be created instead
  2. You can't add a file with content and a dynamic value that is coming from an environment variable

Steps to Reproduce

Can't map the file you have in repo, I tried the following syntax

    volumes:
      - ./dev_configs/pg_servers.json:/pgadmin4/servers.json

or

    volumes:
      - type: bind
        source: ./dev_configs/pg_servers.json
        target: /pgadmin4/servers.json
        read_only: true
        # noinspection ComposeUnknownKeys
        is_directory: false  # Coolify-specific

Can't add a file with content and a dynamic value that is coming from an environment variable:

Following example from docs https://coolify.io/docs/knowledge-base/docker/compose#create-a-file-with-content

The file is created, but the echo "$POSTGRES_PASSWORD" won't be substituted by the variable value. Instruction just stays as it is with back-ticks etc

Example Repository URL

No response

Coolify Version

v4.0.0-beta.398

Are you using Coolify Cloud?

Yes (Coolify Cloud)

Operating System and Version (self-hosted)

No response

Additional Information

No response

ton77v avatar Mar 20 '25 06:03 ton77v

@ton77v Regarding the first method This is partly how docker works, if a volume mount doesn't exist it will be created as a directory, you have to make as a bind with content.

Your project exists outside of your repo so you can't point to a file in your repo as it won't be on the host, unless you tick preserve repository

Regarding the env substitution I am unsure why it says that in the docs, unless i am mistaken that specific example is unique to psql. In that it reads the env when running as long as the calling shell had export env_var set

You would have to eval or interpolate yourself I think.

djsisson avatar Mar 20 '25 08:03 djsisson

@ton77v Regarding the first method This is partly how docker works, if a volume mount doesn't exist it will be created as a directory, you have to make as a bind with content.

Your project exists outside of your repo so you can't point to a file in your repo as it won't be on the host, unless you tick preserve repository

thanks, I haven't thought about this 👍

ton77v avatar Mar 21 '25 01:03 ton77v