Skip to content
Snippets Groups Projects
Commit a6f849f5 authored by Luke Schoen's avatar Luke Schoen Committed by GitHub
Browse files

Update Docker instructions (#13437)

parent 44c342ed
Branches
No related merge requests found
......@@ -25,4 +25,5 @@ rls*.log
*.bin
*.iml
scripts/ci/node-template-release/Cargo.lock
bin/node-template/Cargo.lock
substrate.code-workspace
......@@ -9,6 +9,7 @@ Substrate is a next-generation framework for blockchain innovation 🚀.
Head to [docs.substrate.io](https://docs.substrate.io) and follow the [installation](https://docs.substrate.io/install/) instructions.
Then try out one of the [tutorials](https://docs.substrate.io/tutorials/).
Refer to the [Docker instructions](./docker/README.md) to quickly run Substrate, Substrate Node Template, Subkey, or to build a chain spec.
## Community & Support
......
......@@ -2,10 +2,10 @@
A fresh [Substrate](https://substrate.io/) node, ready for hacking :rocket:
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.
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
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.
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
It is usually best to to use the stand-alone version to start a new project.
It is usually best to use the stand-alone version to start a new project.
All bugs, suggestions, and feature requests should be made upstream in the [Substrate](https://github.com/paritytech/substrate/tree/master/bin/node-template) repository.
## Getting Started
......@@ -158,25 +158,4 @@ To get all the correct dependencies, activate direnv `direnv allow` and lorri `l
### Docker
First, install [Docker](https://docs.docker.com/get-docker/) and [Docker Compose](https://docs.docker.com/compose/install/).
Then run the following command to start a single node development chain.
```sh
./scripts/docker_run.sh
```
This command compiles the code and starts a local development network.
You can also replace the default command (`cargo build --release && ./target/release/node-template --dev --ws-external`) by appending your own.
For example:
```sh
# Run Substrate node without re-compiling
./scripts/docker_run.sh ./target/release/node-template --dev --ws-external
# Purge the local dev chain
./scripts/docker_run.sh ./target/release/node-template purge-chain --dev
# Check whether the code is compilable
./scripts/docker_run.sh cargo check
```
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.
version: "3.2"
services:
dev:
container_name: node-template
image: paritytech/ci-linux:production
working_dir: /var/www/node-template
ports:
- "9944:9944"
environment:
- CARGO_HOME=/var/www/node-template/.cargo
volumes:
- .:/var/www/node-template
- type: bind
source: ./.local
target: /root/.local
command: bash -c "cargo build --release && ./target/release/node-template --dev --ws-external"
#!/usr/bin/env bash
# This script is meant to be run on Unix/Linux based systems
set -e
echo "*** Start Substrate node template ***"
cd $(dirname ${BASH_SOURCE[0]})/..
docker-compose down --remove-orphans
docker-compose run --rm --service-ports dev $@
......@@ -5,23 +5,49 @@ There is no requirement on having Rust or any other toolchain installed but a wo
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.
You should refer to the .Dockerfile for the actual list. At the time of editing, the list of included binaries is:
You should refer to the [.Dockerfile](./substrate_builder.Dockerfile) for the actual list. At the time of editing, the list of included binaries is:
- substrate
- subkey
- node-template
- chain-spec-builder
To generate the latest parity/substrate image. Please first run:
First, install [Docker](https://docs.docker.com/get-docker/).
Then to generate the latest parity/substrate image. Please run:
```sh
./build.sh
```
> 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`.
> 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).
The image can be used by passing the selected binary followed by the appropriate tags for this binary.
Your best guess to get started is to pass the `--help flag`. Here are a few examples:
- `docker run --rm -it parity/substrate substrate --version`
- `docker run --rm -it parity/substrate subkey --help`
- `docker run --rm -it parity/substrate node-template --version`
- `docker run --rm -it parity/substrate chain-spec-builder --help`
- `./run.sh substrate --version`
- `./run.sh subkey --help`
- `./run.sh node-template --version`
- `./run.sh chain-spec-builder --help`
Then try running the following command to start a single node development chain using the Substrate Node Template binary `node-template`:
```sh
./run.sh node-template --dev --ws-external
```
Note: It is recommended to provide a custom `--base-path` to store the chain database. For example:
```sh
# Run Substrate Node Template without re-compiling
./run.sh node-template --dev --ws-external --base-path=/data
```
> To print logs follow the [Substrate debugging instructions](https://docs.substrate.io/test/debug/).
```sh
# Purge the local dev chain
./run.sh node-template purge-chain --dev --base-path=/data -y
```
#!/usr/bin/env bash
args=$@
# handle when arguments not provided. run arguments provided to script.
if [ "$args" = "" ] ; then
printf "Note: Please try providing an argument to the script.\n\n"
exit 1
else
printf "*** Running Substrate Docker container with provided arguments: $args\n\n"
docker run --rm -it parity/substrate $args
fi
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment