I'm running a client Symfony3 application on my Docker for windows. My docker-compose is pretty simple : PHP7.1, Nginx, MySQL, and phpMyAdmin.
Everything runs fine, but I got multiple errors when PHP try to access file paths containing both forward slashed and back slashes.
For example the first error I got is : "Session Storage was not able to create directory "/var/www/symfony\app/../var/sessions/prod""
It's not a permissions problem, because when I find the PHP part of code calling this file, and replace \app
with /app
everything works fine, and the application runs to the next path like that.
I absolutely cannot replace all backslashes in the code, because other developers may work on Windows and put these backslashed for a reason. However, I'm pretty sure I already ran apps with this king of path without any problem.
Any idea about where it could come from ? Php config ? Nginx config ?
Thanks !
So, if you want to keep your Dockerfiles looking Windows-y, use the backtick to escape, watch out for instructions that don't work with it, and stick to shell form for running commands:
# escape=`
FROM microsoft/nanoserver
COPY template.html c:\template.html
RUN mkdir c:\inetpub\wwwroot
RUN powershell `
cat c:\template.html `
> c:\inetpub\wwwroot\index.html
@ref: https://blog.sixeyed.com/windows-dockerfiles-and-the-backtick-backslash-backlash/