sprintcube/docker-compose-lamp

[BUG] php8 container unable to start when using symlink for www directory

Crowley723 opened this issue · 2 comments

Describe the bug
Because I am using the LAMP stack for multiple sites, I am using symlinks/directory junctions (used both, same result) rather than storing the repositories in the lamp directory. Whenever I start the containers with a link instead of a directory for www, the php container refuses to start with
Error response from daemon: error while creating mount source path '/run/desktop/mnt/host/c/Users/user/Documents/Docker/docker-compose-lamp/www': mkdir /run/desktop/mnt/host/c/Users/user/Documents/Docker/docker-compose-lamp/www: file exists
My solution: rename the symlink, create an empty www directory, once the container is started delete the empty directory and rename the symlink. Once I've done this, it works as expected.
which Branch / PHP Version are you using ?
php8

Steps to reproduce
Steps to reproduce the behavior:

  1. Create symbolic link to directory (named www) in lieu of 'www' directory.
  2. Start containers
  3. See error - Notice that php container refuses to start.

Expected behavior
While using symlink instead of www directory.
Start containers.
All containers start.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Windows 10,
  • WSL version: WSL version: 1.2.5.0 Kernel version: 5.15.90.1 WSLg version: 1.0.51 MSRDC version: 1.2.3770 Direct3D version: 1.608.2-61064218 DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp Windows version: 10.0.19045.3570`
  • Browser: N/A
  • Docker Version:
    Docker version 24.0.6, build ed223bc
    Additional context
    If we start container with empty 'www' directory then delete empty directory and rename symlink to 'www' it works as expected (without restarting containers)

Thanks for making such a simple lamp stack.

Not exactly understood what you are doing.
Just want to explain how I keep my sites in their places, not under www.
I just added to docker-compose.yml, to webserver service, new volume for my site:

volumes
  - ...
  - /home/michael/myprojects/mysite1:/var/www/html/mysite1

Apologies if it was unclear, I was using a windows symbolic link to link to a different directory. I have since just moved those directories to the www directory and created a separate virtualhost for each site on a different port. so I can visit all my sites at localhost:8080, localhost 8131, etc.

It remains to be seen if this is still a issue worth addressing. I'm happy to keep answering questions regarding it but I solved my issue with a workaround. I wont mark it as closed in case someone wants to try and tackle it.