Don't package the nimbus_validator_client in the nimbus-eth2 docker images; Document the new dedicated image (#4441)

This commit is contained in:
zah 2022-12-20 23:32:31 +02:00 committed by GitHub
parent 94a87da4a2
commit 0be57eec6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 29 additions and 34 deletions

View File

@ -53,7 +53,7 @@ jobs:
cd ../docker/dist/binaries
REFNAME="${{ github.ref }}"
TAG="${REFNAME#refs/tags/}"
DOCKER_BUILDKIT=1 docker build -f Dockerfile.amd64 -t statusim/nimbus-eth2:amd64-${TAG} -t statusim/nimbus-eth2:amd64-latest .
DOCKER_BUILDKIT=1 docker build -f Dockerfile.bn.amd64 -t statusim/nimbus-eth2:amd64-${TAG} -t statusim/nimbus-eth2:amd64-latest .
docker push statusim/nimbus-eth2:amd64-${TAG}
docker push statusim/nimbus-eth2:amd64-latest
@ -132,7 +132,7 @@ jobs:
TAG="${REFNAME#refs/tags/}"
cp -a /usr/bin/qemu-aarch64-static .
DOCKER_BUILDKIT=1 docker build -f Dockerfile.arm64 -t statusim/nimbus-eth2:arm64-${TAG} -t statusim/nimbus-eth2:arm64-latest .
DOCKER_BUILDKIT=1 docker build -f Dockerfile.bn.arm64 -t statusim/nimbus-eth2:arm64-${TAG} -t statusim/nimbus-eth2:arm64-latest .
docker push statusim/nimbus-eth2:arm64-${TAG}
docker push statusim/nimbus-eth2:arm64-latest
@ -210,7 +210,7 @@ jobs:
REFNAME="${{ github.ref }}"
TAG="${REFNAME#refs/tags/}"
cp -a /usr/bin/qemu-arm-static .
DOCKER_BUILDKIT=1 docker build -f Dockerfile.arm -t statusim/nimbus-eth2:arm-${TAG} -t statusim/nimbus-eth2:arm-latest .
DOCKER_BUILDKIT=1 docker build -f Dockerfile.bn.arm -t statusim/nimbus-eth2:arm-${TAG} -t statusim/nimbus-eth2:arm-latest .
docker push statusim/nimbus-eth2:arm-${TAG}
docker push statusim/nimbus-eth2:arm-latest

View File

@ -10,8 +10,6 @@ USER user
STOPSIGNAL SIGINT
# Docker refuses to copy the source directory here, so read it as "nimbus-eth2/*"
COPY "nimbus-eth2" "/home/user/nimbus-eth2/"
WORKDIR "/home/user/nimbus-eth2/"
ENTRYPOINT ["/home/user/nimbus-eth2/build/nimbus_beacon_node"]
COPY "nimbus-eth2/build/nimbus_beacon_node" "/home/user/nimbus_beacon_node"
WORKDIR "/home/user/"
ENTRYPOINT ["/home/user/nimbus_beacon_node"]

View File

@ -14,8 +14,6 @@ USER user
STOPSIGNAL SIGINT
# Docker refuses to copy the source directory here, so read it as "nimbus-eth2/*"
COPY "nimbus-eth2" "/home/user/nimbus-eth2/"
WORKDIR "/home/user/nimbus-eth2/"
ENTRYPOINT ["/home/user/nimbus-eth2/build/nimbus_beacon_node"]
COPY "nimbus-eth2/build/nimbus_beacon_node" "/home/user/nimbus_beacon_node"
WORKDIR "/home/user/"
ENTRYPOINT ["/home/user/nimbus_beacon_node"]

View File

@ -14,8 +14,6 @@ USER user
STOPSIGNAL SIGINT
# Docker refuses to copy the source directory here, so read it as "nimbus-eth2/*"
COPY "nimbus-eth2" "/home/user/nimbus-eth2/"
WORKDIR "/home/user/nimbus-eth2/"
ENTRYPOINT ["/home/user/nimbus-eth2/build/nimbus_beacon_node"]
COPY "nimbus-eth2/build/nimbus_beacon_node" "/home/user/nimbus_beacon_node"
WORKDIR "/home/user/"
ENTRYPOINT ["/home/user/nimbus_beacon_node"]

View File

@ -1,42 +1,43 @@
# Docker images
Docker images are available from [Docker Hub](https://hub.docker.com/r/statusim/nimbus-eth2) .
Docker images for the [Nimbus beacon node](https://hub.docker.com/r/statusim/nimbus-eth2) and the [Nimbus validator client](https://hub.docker.com/r/statusim/nimbus-validator-client) are available at docker hub.
We have version-specific Docker tags (`statusim/nimbus-eth2:amd64-v1.2.3`) and a tag for the latest image (`statusim/nimbus-eth2:amd64-latest`).
We have version-specific Docker tags (e.g. `statusim/nimbus-eth2:amd64-v1.2.3`) and a tag for the latest image (e.g. `statusim/nimbus-eth2:amd64-latest`).
These images are simply the contents of [release tarballs](./binaries.md) inside a `debian:bullseye-slim` image, running under a user imaginatively named `user`, with UID:GID of 1000:1000.
These images contain the same binaries as the [release tarballs](./binaries.md) inside a `debian:bullseye-slim` image, running under a user imaginatively named `user`, with UID:GID of 1000:1000.
The unpacked archive is in `/home/user/nimbus-eth2` which is also the default *WORKDIR*. The default *ENTRYPOINT* is the binary itself: `/home/user/nimbus-eth2/build/nimbus_beacon_node`
The binaries are placed under the `/home/user/` directory which is also the default *WORKDIR*. The *ENTRYPOINT* of the image is configured to directly launch the respective binary without any extra arguments.
## Usage
Before running Nimbus via docker, you need to prepare a data directory and mount it in docker.
It is recommended that you mount the directory at `/home/user/nimbus-eth2/build/data` and pass `--data-dir=build/data/shared_mainnet_0` to all `nimbus_beacon_node` commands.
The wrapper script outlined below will set the data directory automatically.
It is recommended that you mount the directory at `/home/user/data` and pass `--data-dir=data/beacon_node/mainnet_0` to all `nimbus_beacon_node` commands.
```sh
mkdir data
docker run -it --rm \
-v ${PWD}/data:/home/user/nimbus-eth2/build/data \
-v ${PWD}/data:/home/user/data \
statusim/nimbus-eth2:amd64-latest \
--data-dir=build/data/shared_mainnet_0
--network=mainnet [other options]
--data-dir=data/beacon_node/mainnet_0
--network=mainnet \
[other options]
```
### Wrapper script
If you wish, you can choose to use a wrapper script instead:
Similarly, to launch a Nimbus validator client you can use the following command:
```sh
mkdir data
docker run -it --rm \
-v ${PWD}/data:/home/user/nimbus-eth2/build/data \
--entrypoint /home/user/nimbus-eth2/run-mainnet-beacon-node.sh \
statusim/nimbus-eth2:amd64-latest [other options]
-v ${PWD}/data:/home/user/data \
statusim/nimbus-validator_client:amd64-latest \
--data-dir=data/validator_client/mainnet_0 \
[other options]
```
!!! warning
Do not use the same data directory for beacon node and validator client - they will both try to load the same keys which may result in slashing!
### Docker compose
Our preferred setup is using `docker-compose`. You can use one of our [example configuration files](https://github.com/status-im/nimbus-eth2/tree/stable/docker/dist/binaries) as a base for your own custom configuration: