Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Commit 77c675b

Browse files
authored
Update Docker instructions (#13437)
1 parent 7c3d279 commit 77c675b

File tree

7 files changed

+51
-58
lines changed

7 files changed

+51
-58
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,5 @@ rls*.log
2525
*.bin
2626
*.iml
2727
scripts/ci/node-template-release/Cargo.lock
28+
bin/node-template/Cargo.lock
2829
substrate.code-workspace

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Substrate is a next-generation framework for blockchain innovation 🚀.
99

1010
Head to [docs.substrate.io](https://docs.substrate.io) and follow the [installation](https://docs.substrate.io/install/) instructions.
1111
Then try out one of the [tutorials](https://docs.substrate.io/tutorials/).
12+
Refer to the [Docker instructions](./docker/README.md) to quickly run Substrate, Substrate Node Template, Subkey, or to build a chain spec.
1213

1314
## Community & Support
1415

bin/node-template/README.md

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
A fresh [Substrate](https://substrate.io/) node, ready for hacking :rocket:
44

5-
A standalone version of this template is available for each release of Polkadot in the [Substrate Developer Hub Parachain Template](https://github.com/substrate-developer-hub/substrate-parachain-template/) repository.
6-
The parachain template is generated directly at each Polkadot release branch form the [Node Template in Substreate](https://github.com/paritytech/substrate/tree/master/bin/node-template) upstream
5+
A standalone version of this template is available for each release of Polkadot in the [Substrate Developer Hub Parachain Template](https://github.com/substrate-developer-hub/substrate-parachain-template/) repository.
6+
The parachain template is generated directly at each Polkadot release branch from the [Node Template in Substrate](https://github.com/paritytech/substrate/tree/master/bin/node-template) upstream
77

8-
It is usually best to to use the stand-alone version to start a new project.
8+
It is usually best to use the stand-alone version to start a new project.
99
All bugs, suggestions, and feature requests should be made upstream in the [Substrate](https://github.com/paritytech/substrate/tree/master/bin/node-template) repository.
1010

1111
## Getting Started
@@ -158,25 +158,4 @@ To get all the correct dependencies, activate direnv `direnv allow` and lorri `l
158158

159159
### Docker
160160

161-
First, install [Docker](https://docs.docker.com/get-docker/) and [Docker Compose](https://docs.docker.com/compose/install/).
162-
163-
Then run the following command to start a single node development chain.
164-
165-
```sh
166-
./scripts/docker_run.sh
167-
```
168-
169-
This command compiles the code and starts a local development network.
170-
You can also replace the default command (`cargo build --release && ./target/release/node-template --dev --ws-external`) by appending your own.
171-
For example:
172-
173-
```sh
174-
# Run Substrate node without re-compiling
175-
./scripts/docker_run.sh ./target/release/node-template --dev --ws-external
176-
177-
# Purge the local dev chain
178-
./scripts/docker_run.sh ./target/release/node-template purge-chain --dev
179-
180-
# Check whether the code is compilable
181-
./scripts/docker_run.sh cargo check
182-
```
161+
Please follow the [Substrate Docker instructions here](https://github.com/paritytech/substrate/blob/master/docker/README.md) to build the Docker container with the Substrate Node Template binary.

bin/node-template/docker-compose.yml

Lines changed: 0 additions & 17 deletions
This file was deleted.

bin/node-template/scripts/docker_run.sh

Lines changed: 0 additions & 10 deletions
This file was deleted.

docker/README.md

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,49 @@ There is no requirement on having Rust or any other toolchain installed but a wo
55

66
Unlike the `parity/polkadot` image which contains a single binary (`polkadot`!) used by default, the image in this folder builds and contains several binaries and you need to provide the name of the binary to be called.
77

8-
You should refer to the .Dockerfile for the actual list. At the time of editing, the list of included binaries is:
8+
You should refer to the [.Dockerfile](./substrate_builder.Dockerfile) for the actual list. At the time of editing, the list of included binaries is:
99

1010
- substrate
1111
- subkey
1212
- node-template
1313
- chain-spec-builder
1414

15-
To generate the latest parity/substrate image. Please first run:
15+
First, install [Docker](https://docs.docker.com/get-docker/).
16+
17+
Then to generate the latest parity/substrate image. Please run:
1618
```sh
1719
./build.sh
1820
```
1921

22+
> If you wish to create a debug build rather than a production build, then you may modify the [.Dockerfile](./substrate_builder.Dockerfile) replacing `cargo build --locked --release` with just `cargo build --locked` and replacing `target/release` with `target/debug`.
23+
24+
> If you get an error that a tcp port address is already in use then find an available port to use for the host port in the [.Dockerfile](./substrate_builder.Dockerfile).
25+
2026
The image can be used by passing the selected binary followed by the appropriate tags for this binary.
2127

2228
Your best guess to get started is to pass the `--help flag`. Here are a few examples:
2329

24-
- `docker run --rm -it parity/substrate substrate --version`
25-
- `docker run --rm -it parity/substrate subkey --help`
26-
- `docker run --rm -it parity/substrate node-template --version`
27-
- `docker run --rm -it parity/substrate chain-spec-builder --help`
30+
- `./run.sh substrate --version`
31+
- `./run.sh subkey --help`
32+
- `./run.sh node-template --version`
33+
- `./run.sh chain-spec-builder --help`
34+
35+
Then try running the following command to start a single node development chain using the Substrate Node Template binary `node-template`:
36+
37+
```sh
38+
./run.sh node-template --dev --ws-external
39+
```
40+
41+
Note: It is recommended to provide a custom `--base-path` to store the chain database. For example:
42+
43+
```sh
44+
# Run Substrate Node Template without re-compiling
45+
./run.sh node-template --dev --ws-external --base-path=/data
46+
```
47+
48+
> To print logs follow the [Substrate debugging instructions](https://docs.substrate.io/test/debug/).
49+
50+
```sh
51+
# Purge the local dev chain
52+
./run.sh node-template purge-chain --dev --base-path=/data -y
53+
```

docker/run.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env bash
2+
3+
args=$@
4+
5+
# handle when arguments not provided. run arguments provided to script.
6+
if [ "$args" = "" ] ; then
7+
printf "Note: Please try providing an argument to the script.\n\n"
8+
exit 1
9+
else
10+
printf "*** Running Substrate Docker container with provided arguments: $args\n\n"
11+
docker run --rm -it parity/substrate $args
12+
fi
13+

0 commit comments

Comments
 (0)