Skip to content
New issue

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

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

Already on GitHub? # to your account

Alpine Image has no home directory, defaults to /, so needs root #199

Closed
benbuzbee opened this issue Mar 16, 2020 · 0 comments · Fixed by #213
Closed

Alpine Image has no home directory, defaults to /, so needs root #199

benbuzbee opened this issue Mar 16, 2020 · 0 comments · Fixed by #213

Comments

@benbuzbee
Copy link

As noted in #154 , you can't run the container as non-root and have gsutil work

$docker run -u $(id -u $USER):$(id -g $USER) -it -e CLOUDSDK_CONFIG=$(pwd)/.gcloud -v $(pwd)/.gcloud:$(pwd)/.gcloud google/cloud-sdk:alpine gsutil ls
OSError: Permission denied.

Why? Because gsutil tries to create ~/.gsutil, and $HOME in the container is set to /, which is owned by root.

Solution: Set $HOME to something anyone can write to.
Suggestion: /tmp

This command would work

$ docker run -u $(id -u $USER):$(id -g $USER) -it -e CLOUDSDK_CONFIG=$(pwd)/.gcloud -v $(pwd)/.gcloud:$(pwd)/.gcloud -e HOME=/tmp google/cloud-sdk:alpine gsutil ls
gs://...
gs://...
gs://...
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant