Volumes & Mounts
Fix issues with Docker Compose volumes, file mounts, and files from your repository.
Mounts Are Causing My Application Not to Run?
Docker Swarm won't run your application if there are invalid mounts, even if the deployment shows as successful. Double-check your mounts to ensure they are valid or check the General Swarm Section and find your application, and you will see the real error.
Volumes in Docker Compose Not Working?
For docker compose all the file mounts you've created in the volumes section will be stored to files folder, this is the default structure of the docker compose.
/application-name
/code
/filesSo instead of using this invalid way to mount a volume:
volumes:
- "/folder:/path/in/container" ❌You should use this format:
volumes:
- "../files/my-database:/var/lib/mysql" ✅
- "../files/my-configs:/etc/my-app/config" ✅Using Files from Your Repository
If you need to use files from your repository (e.g., configuration files, scripts, or directories), you must move them to Dokploy's file mounts and reference them manually using the Dokploy interface. This is because when using AutoDeploy, Dokploy performs a git clone operation on each deployment, which clears the repository directory. If you mount files directly from your repository using relative paths like ./ or ./docker/config/odoo.conf, these files will be lost or empty in subsequent deployments, even though the first deployment may work correctly.
Why this happens:
- On the first deployment, the files exist and are mounted correctly
- On subsequent deployments, Dokploy cleans the directory and performs a fresh
git clone - Docker loses the reference to the files that were in the filesystem, and the new files have a new reference
- This causes mounted directories and files to be empty or missing inside the container
Solution:
- Go to Advanced → Mounts in your Docker Compose application
- Create a new File Mount for each file or directory you need from your repository
- Copy the content from your repository files into the File Mount content field
- Specify the file path for your configuration
- Reference the file mount in your
docker-compose.ymlusing the../files/path:
volumes:
- "../files/my-config.json:/etc/my-app/config" ✅
- "../files/my-directory:/path/in/container" ✅Example: Instead of mounting directly from your repository:
volumes:
- ./:/mnt/extra-addons/va_subscription_18 ❌
- ./docker/config/odoo.conf:/etc/odoo/odoo.conf ❌Use Dokploy's file mounts:
volumes:
- ../files/va_subscription_18:/mnt/extra-addons/va_subscription_18 ✅
- ../files/odoo.conf:/etc/odoo/odoo.conf ✅Docker Compose Volume Mounts
When using Docker Compose, you can configure volume mounts in your docker-compose.yml file:
volumes:
- my-database:/var/lib/mysqlCreating Configuration Files
If you need to create configuration files before deploying your compose setup:
- Go to Advanced -> Mounts
- Create a new File Mount
- Add your configuration content in the content field
- Specify the file path for your configuration
Note: All File Mounts are automatically created in the /files directory. For example, if you create a file named my-config.json, it will be available at /files/my-config.json.
You can then reference this configuration file in your docker-compose.yml:
volumes:
- ../files/my-config.json:/etc/my-app/configImportant for AutoDeploy users: If you have configuration files or directories in your repository that you need to mount into your containers, you must copy their content to Dokploy's File Mounts (via Advanced → Mounts) instead of mounting them directly from the repository. This ensures the files persist across deployments, as the repository directory is cleaned and re-cloned on each AutoDeploy.