alpine-docker/git

can i use -u start container without root

jhsea3do opened this issue · 2 comments

I try to use "-u 1000" clone project files.
cause i want create all files with lower privileges, not ROOT privileges.

docker run -u 1000 -i --rm --name git-jobs \
-v /tmp/xxx:/git \
alpine/git:latest clone git@xxx/xxx.git
Cloning into 'xxx'...
No user exists for uid 1000
fatal: Could not read from remote repository.

you can build a new image and run your command with it.

$ cat Dockerfile

FROM alpine/git:latest

RUN addgroup -g 1000 gituser && \
    adduser -D -u 1000 -G gituser gituser

USER gituser

thank you