Skip to content

Add user education about file mount prerequisites and troubleshooting #347

@Cinzya

Description

@Cinzya

Summary

Users frequently encounter file mount failures because they don't understand the prerequisites for mounting files in Docker Compose deployments. We need to add educational content about file mount requirements to prevent common mistakes.

Problem

Reference: coollabsio/coolify#3375

Root cause: Users attempt to mount files that don't exist on the host system, leading to Docker creating directories instead of mounting files. This is user education issue, not a Coolify bug.

Common scenarios:

  • Users try to mount files from their Git repository without enabling "Preserve Repository During Deployment" (Docker Compose Applications)
  • Users assume files will be created automatically when they don't exist
  • Users don't understand when to use content: vs. bind mounts

Suggested Documentation Improvements

Note: The examples below are suggestions to illustrate the content that should be covered. Feel free to adapt the format, wording, and structure as you see fit to match the documentation style and improve clarity.

1. Add warnings to existing documentation

Files to update: docs/knowledge-base/docker/compose.md and docs/knowledge-base/persistent-storage.md

Example warning boxes:

::: warning File Mount Prerequisites
When mounting files (not directories), ensure that:
- The file exists on the host system, OR
- You define the file content using the `content:` property
- For files in your Git repository, enable **"Preserve Repository During Deployment"** (Docker Compose Applications) in project settings
:::

::: danger Common Mistake
If you try to mount a non-existent file, Docker will create a directory instead, causing deployment failures with errors like "not a directory: unknown".
:::

2. Add troubleshooting section

Example troubleshooting content:

### Troubleshooting File Mounts

**Error: "failed to mount... not a directory: unknown"**

This error occurs when you try to mount a file that doesn't exist on the host system.

**Solutions:**
1. **For files in your Git repository**: Enable "Preserve Repository During Deployment" (Docker Compose Applications) in Project → Settings
2. **For configuration files**: Use the `content:` property to define the file content inline
3. **For existing host files**: Ensure the file path is correct and the file exists

**How to verify:**
- SSH into your server and check if the file exists at the specified path
- For Git repository files, verify "Preserve Repository During Deployment" (Docker Compose Applications) is enabled

3. Enhanced examples showing correct vs incorrect usage

Example code blocks:

# ✅ CORRECT: File with content defined
volumes:
  - type: bind
    source: ./config/app.conf
    target: /app/config.conf
    content: |
      server_name=example.com
      port=8080

# ✅ CORRECT: Mounting existing file from repository 
# (requires "Preserve Repository During Deployment" (Docker Compose Applications) enabled)
volumes:
  - type: bind
    source: ./config/existing-file.conf
    target: /app/config.conf

# ❌ WRONG: Will fail if file doesn't exist
volumes:
  - type: bind
    source: ./config/nonexistent-file.conf
    target: /app/config.conf
    # This will create a directory instead of mounting a file

Key Concepts to Cover

  1. File existence requirements: Files must exist on host OR have content: defined
  2. Git repository files: Need "Preserve Repository During Deployment" (Docker Compose Applications) enabled
  3. Error consequences: Missing files become directories, causing deployment failures
  4. Troubleshooting steps: How to diagnose and fix common issues

Acceptance Criteria

  • Users understand file mount prerequisites before attempting to use them
  • Clear guidance on when to enable "Preserve Repository During Deployment" (Docker Compose Applications)
  • Troubleshooting help for common file mount errors
  • Examples demonstrate correct file mount patterns

Metadata

Metadata

Assignees

Labels

⚠️ High PriorityCritical documentation tasks requiring immediate attention.✨ EnhancementSuggestions to improve or add detail to existing docs.⭐️ New ContentAdding entirely new content or guides.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions