Creates a new lighthouse user and makes it the default user to be use… (#1502)

…d in the Docker image

## Issue Addressed
https://github.com/sigp/lighthouse/issues/1459

## Proposed Changes

- Create new `lighthouse` user and group in Docker container
- Set user as the default user
This commit is contained in:
Maximilian Ehlers 2020-08-31 07:52:26 +00:00
parent c34e8efb12
commit 7d71d98dc1
2 changed files with 5 additions and 3 deletions

View File

@ -12,5 +12,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \ ca-certificates \
&& apt-get clean \ && apt-get clean \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
RUN groupadd -r lighthouse && useradd --no-log-init -r -g lighthouse lighthouse
USER lighthouse
COPY --from=builder /usr/local/cargo/bin/lighthouse /usr/local/bin/lighthouse COPY --from=builder /usr/local/cargo/bin/lighthouse /usr/local/bin/lighthouse
COPY --from=builder /usr/local/cargo/bin/lcli /usr/local/bin/lcli COPY --from=builder /usr/local/cargo/bin/lcli /usr/local/bin/lcli

View File

@ -53,7 +53,7 @@ $ docker run lighthouse:local lighthouse --help
You can run a Docker beacon node with the following command: You can run a Docker beacon node with the following command:
```bash ```bash
$ docker run -p 9000:9000 -p 127.0.0.1:5052:5052 -v $HOME/.lighthouse:/root/.lighthouse sigp/lighthouse lighthouse --testnet medalla beacon --http --http-address 0.0.0.0 $ docker run -p 9000:9000 -p 127.0.0.1:5052:5052 -v $HOME/.lighthouse:/home/lighthouse/.lighthouse sigp/lighthouse lighthouse --testnet medalla beacon --http --http-address 0.0.0.0
``` ```
> To join the altona testnet, use --testnet altona instead. > To join the altona testnet, use --testnet altona instead.
@ -62,7 +62,7 @@ $ docker run -p 9000:9000 -p 127.0.0.1:5052:5052 -v $HOME/.lighthouse:/root/.lig
### Volumes ### Volumes
Lighthouse uses the `/root/.lighthouse` directory inside the Docker image to Lighthouse uses the `/home/lighthouse/.lighthouse` directory inside the Docker image to
store the configuration, database and validator keys. Users will generally want store the configuration, database and validator keys. Users will generally want
to create a bind-mount volume to ensure this directory persists between `docker to create a bind-mount volume to ensure this directory persists between `docker
run` commands. run` commands.
@ -71,7 +71,7 @@ The following example runs a beacon node with the data directory
mapped to the users home directory: mapped to the users home directory:
```bash ```bash
$ docker run -v $HOME/.lighthouse:/root/.lighthouse sigp/lighthouse lighthouse beacon $ docker run -v $HOME/.lighthouse:/home/lighthouse/.lighthouse sigp/lighthouse lighthouse beacon
``` ```
### Ports ### Ports