Files
pezkuwi-subxt/docs/contributor/container.md
T
Juan Girini a310df263d Move developer-hub to polkadot-sdk-docs (#2598)
This PR is a continuation of
https://github.com/paritytech/polkadot-sdk/pull/2102 and part of an
initiative started here https://hackmd.io/@romanp/rJ318ZCEp
What has been done:
- The content under `docs/*` (with the exception of `docs/mermaid`) has
been moved to `docs/contributor/`
- Developer Hub has been renamed to Polkadot SDK Docs, and the crate has
been renamed from `developer-hub` to `polkadot-sdk-docs`
- The content under `developer-hub/*` has been moved to `docs/sdk`

---
Original PR https://github.com/paritytech/polkadot-sdk/pull/2565, it has
been close due to too many rebase conflicts

---------

Co-authored-by: Serban Iorga <serban@parity.io>
Co-authored-by: Chevdor <chevdor@users.noreply.github.com>
Co-authored-by: Egor_P <egor@parity.io>
Co-authored-by: Bastian Köcher <git@kchr.de>
2023-12-05 10:23:24 +01:00

2.5 KiB

Using Containers

Using containers via Podman or Docker brings benefit, whether it is to build a container image or run a node while keeping a minimum footprint on your local system.

This document mentions using podman or docker. Those are usually interchangeable and it is encouraged using preferably Podman. If you have podman installed and want to use all the commands mentioned below, you can simply create an alias with alias docker=podman.

There are a few options to build a node within a container and inject a binary inside an image.

Parity built container image

Parity builds and publishes a container image that can be found as docker.io/parity/polkadot-parachain.

Parity CI image

Parity maintains and uses internally a generic "CI" image that can be used as a base to build binaries: Parity CI container image:

The command below allows building a Linux binary without having to even install Rust or any dependency locally:

docker run --rm -it \
    -w /polkadot-sdk \
    -v $(pwd):/polkadot-sdk \
    paritytech/ci-linux:production \
    cargo build --release --locked -p polkadot-parachain-bin --bin polkadot-parachain
sudo chown -R $(id -u):$(id -g) target/

If you want to reproduce other steps of CI process you can use the following guide.

Injected image

Injecting a binary inside a base image is the quickest option to get a working container image. This only works if you were able to build a Linux binary, either locally, or using a container as described above.

After building a Linux binary (polkadot-parachain) with cargo or with Parity CI image as documented above, the following command allows producing a new container image where the compiled binary is injected:

ARTIFACTS_FOLDER=./target/release /docker/scripts/build-injected.sh

Container build

Alternatively, you can build an image with a builder pattern. This options takes a while but offers a simple method for anyone to get a working container image without requiring any of the Rust toolchain installed locally.

docker build \
	--tag $OWNER/$IMAGE_NAME \
 --file ./docker/dockerfiles/polkadot-parachain/polkadot-parachain_builder.Dockerfile .

You may then run your new container:

docker run --rm -it \
	$OWNER/$IMAGE_NAME \
		--collator --tmp \
		--execution wasm \
		--chain /specs/asset-hub-westend.json