Skip to content

Instantly share code, notes, and snippets.

@chevdor
Last active March 1, 2022 07:06
Show Gist options
  • Save chevdor/be461d11c56baecb0e7bbcb920e964fb to your computer and use it in GitHub Desktop.
Save chevdor/be461d11c56baecb0e7bbcb920e964fb to your computer and use it in GitHub Desktop.
Docker compose for a polkadot local chain

Substrate/Polkadot local chain

Substrate

wget https://gist.github.com/chevdor/be461d11c56baecb0e7bbcb920e964fb/raw/2f18621d648a3aaec548797e55c84843c0c3732f/docker-compose-substrate.yml -O /tmp/dcp-local.yml && docker-compose -f /tmp/dcp-local.yml up --force-recreate

Polkadot

Local

wget https://gist.github.com/chevdor/be461d11c56baecb0e7bbcb920e964fb/raw/2e168b42ad731886ef384ba26d5fe71355905506/docker-compose-local.yml -O /tmp/dcp-local.yml && export VERSION=latest && docker pull chevdor/polkadot:$VERSION && docker-compose -f /tmp/dcp-local.yml up --force-recreate

5 nodes

wget https://gist.github.com/chevdor/be461d11c56baecb0e7bbcb920e964fb/raw/1e3ea5a3f2b1cb39745634c00d3de59df05f9e81/5nodes.yml -O /tmp/dcp-5nodes.yml && docker-compose -f /tmp/dcp-5nodes.yml up --force-recreate
version: '3'
services:
node_alice:
build:
context: .
ports:
- "30333:30333"
- "9933:9933"
- "9944:9944"
image: chevdor/polkadot:${VERSION}
volumes:
- "polkadot-data-alice:/data"
command: polkadot --chain=local --ws-external --validator --alice -d /data --node-key 0000000000000000000000000000000000000000000000000000000000000001
networks:
testing_net:
ipv4_address: 172.28.1.1
node_bob:
build:
context: .
ports:
- "30344:30344"
- "9935:9935"
- "9945:9945"
image: chevdor/polkadot:${VERSION}
volumes:
- "polkadot-data-bob:/data"
links:
- "node_alice:alice"
command: polkadot --chain=local --validator --bob -d /data --port 30344 --rpc-port 9935 --ws-port 9945 --bootnodes '/ip4/172.28.1.1/tcp/30333/p2p/QmQZ8TjTqeDj3ciwr93EJ95hxfDsb9pEYDizUAbWpigtQN'
networks:
testing_net:
ipv4_address: 172.28.1.2
node_charlie:
build:
context: .
ports:
- "30335:30333"
image: chevdor/polkadot:${VERSION}
volumes:
- "polkadot-data-charlie:/data"
links:
- "node_alice:alice"
command: polkadot --chain=local --validator --charlie -d /data --bootnodes '/ip4/172.28.1.1/tcp/30333/p2p/QmQZ8TjTqeDj3ciwr93EJ95hxfDsb9pEYDizUAbWpigtQN'
networks:
testing_net:
ipv4_address: 172.28.1.3
node_dave:
build:
context: .
ports:
- "30336:30333"
image: chevdor/polkadot:${VERSION}
volumes:
- "polkadot-data-dave:/data"
links:
- "node_alice:alice"
command: polkadot --chain=local --validator --dave -d /data --bootnodes '/ip4/172.28.1.1/tcp/30333/p2p/QmQZ8TjTqeDj3ciwr93EJ95hxfDsb9pEYDizUAbWpigtQN'
networks:
testing_net:
ipv4_address: 172.28.1.4
node_eve:
build:
context: .
ports:
- "30337:30333"
image: chevdor/polkadot:${VERSION}
volumes:
- "polkadot-data-eve:/data"
links:
- "node_alice:alice"
command: polkadot --chain=local --validator --eve -d /data --bootnodes '/ip4/172.28.1.1/tcp/30333/p2p/QmQZ8TjTqeDj3ciwr93EJ95hxfDsb9pEYDizUAbWpigtQN'
networks:
testing_net:
ipv4_address: 172.28.1.5
volumes:
polkadot-data-alice:
polkadot-data-bob:
polkadot-data-charlie:
polkadot-data-dave:
polkadot-data-eve:
networks:
testing_net:
ipam:
driver: default
config:
- subnet: 172.28.0.0/16
version: '3'
services:
node_alice:
build:
context: .
ports:
- "30333:30333"
- "9933:9933"
- "9944:9944"
image: chevdor/polkadot:${VERSION}
volumes:
- "polkadot-data-alice:/data"
command: polkadot --chain=local --ws-external --validator --alice -d /data --node-key 0000000000000000000000000000000000000000000000000000000000000001
networks:
testing_net:
ipv4_address: 172.28.1.1
node_bob:
build:
context: .
ports:
- "30344:30344"
- "9935:9935"
- "9945:9945"
image: chevdor/polkadot:${VERSION}
volumes:
- "polkadot-data-bob:/data"
links:
- "node_alice:alice"
command: polkadot --chain=local --validator --bob -d /data --port 30344 --rpc-port 9935 --ws-port 9945 --bootnodes '/ip4/172.28.1.1/tcp/30333/p2p/QmQZ8TjTqeDj3ciwr93EJ95hxfDsb9pEYDizUAbWpigtQN'
networks:
testing_net:
ipv4_address: 172.28.1.2
volumes:
polkadot-data-alice:
polkadot-data-bob:
networks:
testing_net:
ipam:
driver: default
config:
- subnet: 172.28.0.0/16
version: '3'
services:
node_alice:
build:
context: .
ports:
- "30333:30333"
- "9933:9933"
- "9944:9944"
image: chevdor/substrate:bbqb
volumes:
- "substrate-data-alice:/data"
command: substrate --chain=local purge-chain --ws-external --validator --alice -d /data --node-key 0000000000000000000000000000000000000000000000000000000000000001
networks:
testing_net:
ipv4_address: 172.28.1.1
node_bob:
build:
context: .
ports:
- "30344:30344"
- "9935:9935"
- "9945:9945"
image: chevdor/substrate:bbqb
volumes:
- "substrate-data-bob:/data"
links:
- "node_alice:alice"
command: substrate --chain=local --validator --bob -d /data --port 30344 --rpc-port 9935 --ws-port 9945 --bootnodes '/ip4/172.28.1.1/tcp/30333/p2p/QmQZ8TjTqeDj3ciwr93EJ95hxfDsb9pEYDizUAbWpigtQN'
networks:
testing_net:
ipv4_address: 172.28.1.2
volumes:
substrate-data-alice:
substrate-data-bob:
networks:
testing_net:
ipam:
driver: default
config:
- subnet: 172.28.0.0/16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment