There is anyway to add custom folder using symbolic link into data folder in Devilbox ? When i put the symbolic link the Auto Virtual Host ignore the folder.
Thank You.
I used to had the same exact issue but I solved it.
Create a new file in the root of devilbox project called docker-compose.override.yml
Copy and paste this into the file
# IMPORTANT: The version must match the version of docker-compose.yml
---
version: '2.3'
services:
php:
volumes:
- $HOME:$HOME
httpd:
volumes:
- $HOME:$HOME
data/www/proj-slug/htdocs -> ~/your-custom-path
Following the reply of @Pirex360 is not enough to use symlinks. Indeed, when you create the symlink, the vhost page says "There is no htdocs folder".
The problem is that everything inside Devilbox is "Dockerized", therefore your Docker container is not able to access to files and folder that are not mounted inside the Docker container.
Searching a bit online I have found an issue on the project repository that talks about here. Many users thought about the possibility to modify the docker-compose.yml
file in order to mount the folder they need.
Docker, however, already provides a way to override docker compose file. The correct way is to create a docker-compose.override.yml
file.
The configuration pasted above permit to mount the host user home folder inside the docker. As a matter of fact, you can find your home
folder mounted in Docker homes.
You can check out the effect entering in the Docker environment by means of shell file
$ cd devilbox
$ ./shell.sh # or .bat
$ ls /home
devilbox/ yourusername/
Then each symlink pointing to /home/yourusername/custompath
is working as expected!
If you are only trying to create a symlink that map public folder to htdocs you can use the guide provided by Devilbox, Setup Laravel.
@marcogmonteiro talked about this in a comment. However this method works only if you are symlinking files or folder that are not outside of the Docker visible tree.
This way of mounting your home folder into Docker breaks the isolation between the container and your files and folder. So, the Docker container, CAN read/write/execute your files.
Ok, i make it work. For future reference, make all the root folders by hand, but inside of the root folders symbolic links are accepted.
data/www/proj-slug/{htdocs} width {htdocs} -> ~/git/proj-slug