Skip to content
This repository has been archived by the owner on Oct 8, 2023. It is now read-only.

Get rid of chown.sh? #15

Open
matsp opened this issue Jan 6, 2021 · 3 comments
Open

Get rid of chown.sh? #15

matsp opened this issue Jan 6, 2021 · 3 comments
Labels
question Further information is requested

Comments

@matsp
Copy link
Owner

matsp commented Jan 6, 2021

Is it possible to improve file permissions?

@matsp matsp added the question Further information is requested label Jan 6, 2021
@x29a
Copy link
Contributor

x29a commented Jan 6, 2021

How can we test if its working?

I took out the call to chown.sh in the entrypoint.sh, rebuilt the image (named dockerflutterstable) and called it via

docker run --rm -e UID=$(id -u) -e GID=$(id -g) --workdir /project -v "$PWD":/project dockerflutterstable build apk

or (after a clean)

docker run --rm --workdir /project -v "$PWD":/project dockerflutterstable build apk

and the folders created all belong to my user/group.

My suggestion would have been --user "$(id -u):$(id -g) in something like this

docker run --rm -e UID=$(id -u) -e GID=$(id -g) --workdir /project -v "$PWD":/project --user "$(id -u):$(id -g)" dockerflutterstable build apk

@matsp
Copy link
Owner Author

matsp commented Jan 6, 2021

I would guess that your local user has also the uid 1000 and gid 1000 that are set at build time. You only set them when you build the image on your own, which is not very user friendly to use this image directly from the hub.

Setting the uid/gid at runtime is for the chown.sh script, to change the ids when they are different than 1000. In most distributions of linux this is the default but not in all.

Using podman instead of docker is fixing this by the way because podman container can only write with the executing user from the host if you have enabled rootless execution.

The --user option could work. For that you should modify the UID and GID of the Dockerfile so that they differ from your host user.

@matsp
Copy link
Owner Author

matsp commented Jan 9, 2021

I try to improve it along the multistage image changes.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants