Skip to content

Commit

Permalink
feat: add non-root user to docker image (#1843)
Browse files Browse the repository at this point in the history
  • Loading branch information
nrwiersma committed Mar 9, 2023
1 parent 5099b30 commit 96f7cb8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cmd/proxy/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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", "--" ]
Expand Down
17 changes: 17 additions & 0 deletions docs/content/install/using-docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 96f7cb8

Please sign in to comment.