You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
From a PHP page in Apache I'm trying to run a docker command that will generate a PDF. I've added both my user and the www-data user to the docker group so they can execute a docker command without sudo.
This works within a PHP file that exists at the /home/my_user/projects/my_project/public folder:
system("docker run --rm -v pwd:/app -w /app weasyprint:51 ./healthcheck.htm /weasyprint_test.pdf");
But when I specify the full path (which I've verified is correct), it doesn't work:
system("docker run --rm -v pwd:/app -w /app weasyprint:51 /home/my_user/projects/my_project/public/healthcheck.htm /home/my_user/projects/my_project/public/weasyprint_test.pdf");
I see this in the PHP error log when I run the second version: su-exec: /home/my_user/projects/my_project/public/healthcheck.htm: No such file or directory
For the life of me, I can't figure out why the first version would work and the second wouldn't because they are referring to the same path, just via different syntax. Please let me know if you have any ideas.
I think I understand it now. I believe the docker image only can access the current folder. I'll try a micro service version where I can use REST calls instead of relying on the file system. Sorry for the false alarm.
From a PHP page in Apache I'm trying to run a docker command that will generate a PDF. I've added both my user and the www-data user to the docker group so they can execute a docker command without sudo.
This works within a PHP file that exists at the /home/my_user/projects/my_project/public folder:
system("docker run --rm -v
pwd
:/app -w /app weasyprint:51 ./healthcheck.htm /weasyprint_test.pdf");But when I specify the full path (which I've verified is correct), it doesn't work:
system("docker run --rm -v
pwd
:/app -w /app weasyprint:51 /home/my_user/projects/my_project/public/healthcheck.htm /home/my_user/projects/my_project/public/weasyprint_test.pdf");I see this in the PHP error log when I run the second version: su-exec: /home/my_user/projects/my_project/public/healthcheck.htm: No such file or directory
For the life of me, I can't figure out why the first version would work and the second wouldn't because they are referring to the same path, just via different syntax. Please let me know if you have any ideas.
This was cross-posted to https://stackoverflow.com/questions/66230433/no-such-file-or-directory-when-passing-full-path-to-docker-image-but-works-wi
The text was updated successfully, but these errors were encountered: