Learn how to run Nexus as a Docker container
It’s possible to run Nexus in a Docker container, without needing to write a single line of code. This is possible thanks to the Nexus environment variables that allow you to configure the Nexus instance.
version: "3.8" services: nexus: image: "whatsgood/nexus:latest" container_name: nexus ports: - "4000:4000" environment: - 'NEXUS_NODE_PROVIDERS=[{"name": "eth.public", "url":"https://eth.public-rpc.com", "chainId": 1}]' - 'NEXUS_CHAINS=[{"name": "mainnet", "chainId": 1, "blockTime": 15}]' - 'NEXUS_RELAY_FAILURE=["cycle-requests", 5]' - "NEXUS_RELAY_ORDER=random" - "NEXUS_LOG_LEVEL=debug"
curl -X POST http://localhost:4000/1 \ -H "Content-Type: application/json" \ -d '{ "jsonrpc": "2.0", "method": "eth_blockNumber", "params": [], "id": 1 }'
Was this page helpful?