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

Bind volumes don't work #38

Open
whamtet opened this issue Feb 28, 2019 · 1 comment
Open

Bind volumes don't work #38

whamtet opened this issue Feb 28, 2019 · 1 comment

Comments

@whamtet
Copy link

whamtet commented Feb 28, 2019

Thanks for the excellent work Alek,

Your Dockerfile changes the user from root which breaks bind volumes on docker for linux. The use case is that I output a pdf to the bind volume so I can access it from the docker host. When I run

docker run -it --entrypoint=/bin/bash -v `pwd`/tmp:/app/tmp alekzonder/docker-puppeteer
pptruser@ip-172-31-26-224:/app$ cd tmp
pptruser@ip-172-31-26-224:/app/tmp$ mkdir f
mkdir: cannot create directory ‘f’: Permission denied
pptruser@ip-172-31-26-224:/app/tmp$ ls -all .
total 8
drwxrwxr-x 2      500      500 4096 Feb 27 18:43 .
drwxr-xr-x 1 pptruser pptruser 4096 Feb 27 19:21 ..

So you see the bind volume is not owned by pptruser, therefore we cannot write files to it to share with the docker host. You might want to mention a workaround in Readme.md. If you can suggest one I'm happy to submit a PR.

@whamtet whamtet changed the title Bind mounts don't work Bind volumes don't work Feb 28, 2019
@rafipiccolo
Copy link

rafipiccolo commented Jan 19, 2021

its a common strategy with docker volumes.
you need to chown to the proper user before running the container.

this may work

# get userId inside container
$> docker run --rm -ti alekzonder/puppeteer id
uid=999(pptruser) gid=999(pptruser) groups=999(pptruser),29(audio),44(video)
# chown
$> chown -r 999:999 /somePathOnTheHost

or just force container to execute as root.

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

2 participants