mirror of
https://github.com/gomods/athens
synced 2026-02-03 11:00:32 +00:00
feat: add non-root user to docker image (#1843)
This commit is contained in:
@@ -32,6 +32,9 @@ RUN chmod 644 /config/config.toml
|
||||
RUN apk add --update git git-lfs mercurial openssh-client subversion procps fossil tini && \
|
||||
mkdir -p /usr/local/go
|
||||
|
||||
ARG USER=athens
|
||||
RUN adduser -D -h /home/$USER $USER
|
||||
|
||||
EXPOSE 3000
|
||||
|
||||
ENTRYPOINT [ "/sbin/tini", "--" ]
|
||||
|
||||
@@ -53,6 +53,23 @@ docker run -d -v "$($env:ATHENS_STORAGE):/var/lib/athens" `
|
||||
gomods/athens:latest
|
||||
```
|
||||
|
||||
## Non-Root User
|
||||
|
||||
The Athens docker images comes with a non-root user `athens` with `uid: 1000`, `gid: 1000` and home directory `/home/athens`.
|
||||
In situations where running as root is not permitted, this user can be used instead. In all other instuctions
|
||||
replace `/root/` with `/home/athens/` and set the user and group ids in the run environment to `1000`.
|
||||
|
||||
```shell
|
||||
docker run -d -v $ATHENS_STORAGE:/var/lib/athens \
|
||||
-e ATHENS_DISK_STORAGE_ROOT=/var/lib/athens \
|
||||
-e ATHENS_STORAGE_TYPE=disk \
|
||||
-v "$PWD/gitconfig/.gitconfig:/home/athens/.gitconfig" \
|
||||
--name athens-proxy \
|
||||
--restart always \
|
||||
-p 3000:3000 \
|
||||
-u 1000:1000 \
|
||||
gomods/athens:latest
|
||||
```
|
||||
|
||||
## Troubleshooting Athens in Docker
|
||||
|
||||
|
||||
Reference in New Issue
Block a user