JK Docs
DevOps

Coolify Persistent Storage: Keeping Config Files Across Deploys

Last updated: 4/20/2026

The Problem

When using Coolify's CI/CD (auto-deploy from GitHub), each deployment creates a brand new container, destroying any files you manually placed in the old container.

Files that WILL be lost on deploy:

  • Manually created config.php
  • Uploaded files not in Git
  • Any changes made directly inside the container

Solution: Bind Mount (Persistent Storage)

A Bind Mount links a file/directory on the host server to a path inside the container.

Step 1: Create the File on the Server

SSH into server or use Coolify's Server Terminal:

# Create config file in a safe location outside the app nano /opt/karimi-config.php

Paste config content, then save: Ctrl+X → Y → Enter

Step 2: Add Storage Mount in Coolify

Application settings → Storages tab:

  • Source Path (on host server): /opt/karimi-config.php
  • Destination Path (inside container): /app/config.php

Step 3: Redeploy

Click Deploy to apply the mount. From now on, every new container will have access to the config file.

Nixpacks Default Code Location

Nixpacks places the application code in /app/.

Verify with:

# In Coolify's application Terminal tab: ls -la /app

Best Practices

  • Store config files in /opt/appname-config/ on the server
  • Never commit sensitive files (config.php, .env) to Git
  • Use Bind Mounts for: database config, SMTP credentials, API keys
JK Docs
New Guide

Categories

DevOpsBackendFrontendDatabaseToolsSecurityDesignSystem Admin
Admin Panel