Skip to main content

使用 Docker Compose 运行

有时,不依赖冗长的Docker命令也是不错的选择。使用Docker compose运行与使用原始Docker非常相似,你可以在Docker docs中找到完整的格式说明。

这是一个运行验证器的docker-compose文件示例,应该能帮你完成大部分工作。

{
"chains": {
"ethereum": {
"customRpcUrls": "https://node1.com,https://node2.com,https://node3.com"
}
},
"originchainname": "ethereum",
"validator": {
"id": "alias/validator-signer-ethereum",
"type": "aws",
"region": "us-east-1"
},
"checkpointsyncer": {
"bucket": "signatures-ethereum",
"region": "us-east-1",
"type": "s3"
},
"reorgperiod": 1,
"interval": 30,
"metrics": "9090"
}
services:
ethereum-validator:
image: gcr.io/abacus-labs-dev/hyperlane-agent:3adc0e9-20240319-152359
command: ./validator
ports:
- "9090:9090/tcp"
environment:
CONFIG_FILES: /ethereum_validator.json
AWS_ACCESS_KEY_ID: somesecretkey
AWS_SECRET_ACCESS_KEY: somesecretkey
configs:
- ethereum_validator.json
configs:
ethereum_validator.json:
file: ./ethereum_validator.json

上面有很多填充值,您需要用真实值更新这些填充值。

您还可以指定多个服务,因此如果要运行多个验证器,可以在services下指定每个验证器。

要运行编译配置,请使用docker compose updocker compose down进行清理。关于命令行的完整文档可以在docker 网站上找到。