Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

“no such file or directory” when passing full path to Docker image, but works with relative path to same folder #1

Open
espechtcfe opened this issue Feb 16, 2021 · 1 comment

Comments

@espechtcfe
Copy link

espechtcfe commented Feb 16, 2021

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

@espechtcfe
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant