polkadot-sdk icon indicating copy to clipboard operation
polkadot-sdk copied to clipboard

Unable to run the substrate dockerfile

Open kamalbuilds opened this issue 1 year ago • 4 comments

Is there an existing issue?

  • [X] I have searched the existing issues

Experiencing problems? Have you tried our Stack Exchange first?

  • [X] This is not a support question.

Description of bug

=> ERROR [builder 4/4] RUN cargo build --locked --release 2.7s

[builder 4/4] RUN cargo build --locked --release: 2.610 error: could not find Cargo.toml in /substrate or any parent directory


substrate_builder.Dockerfile:6

4 | WORKDIR /substrate 5 | COPY . /substrate 6 | >>> RUN cargo build --locked --release 7 |
8 | # This is the 2nd stage: a very small image where we copy the Substrate binary."

ERROR: failed to solve: process "/bin/sh -c cargo build --locked --release" did not complete successfully: exit code: 101

image

image

Steps to reproduce

cd substrate/docker

./build.sh

kamalbuilds avatar Dec 19 '23 05:12 kamalbuilds

Yeah the Dockerfile was probably not updated for the new repo structure. Maybe you could fix it @kamalbuilds and add a pr?

bkchr avatar Dec 19 '23 12:12 bkchr

@bkchr I dont know how to fix it coz I have been struggliug to make the node run from past 3 days. Fixed the earlier to arrive at this . image

kamalbuilds avatar Dec 19 '23 12:12 kamalbuilds

Had a look but docker.io/paritytech/ci-linux:production is running rust 1.55. Is there a more up to date image that should be used?

Once I fix up the dirs I get: "The package requires the Cargo feature called named-profiles, but that feature is not stabilized in this version of Cargo (1.55.0 (32da73ab1 2021-08-23))."

gilescope avatar Jan 02 '24 08:01 gilescope

i've been going through fixing this too since yesterday since i want to use the Substrate Docker for a hackathon where the audience could be using different operating systems. i'm using a macOS M2 Pro 64Gb and it takes ~52 mins to build.

so far i've fixed the following errors:

  • error: could not find Cargo.toml in /substrate or any parent directory
  • error: failed to select a version for env_logger
  • fetch-pack: unexpected disconnect while reading sideband packet

but i still got the following error because the latest docker.io/paritytech/ci-linux:production hasn't been updated for 10 months and is still using RUST_NIGHTLY=2023-05-23 on this line https://github.com/paritytech/scripts/blob/master/dockerfiles/ci-linux/Dockerfile#L7

  • error: package jsonrpsee-types v0.22.5 cannot be built because it requires rustc 1.74.1 or newer, while the currently active rustc version is 1.70.0

so since i can't modify that docker.io/paritytech/ci-linux:production without first creating a separate PR to https://github.com/paritytech/scripts/blob/master/dockerfiles/ci-linux/Dockerfile, so in the interim i'm modifying the line RUN cargo build --locked --release in ./substrate/docker/substrate_builder.Dockerfile, to instead be something like RUN RUST_NIGHTLY=2024-04-29 ... cargo build --locked --release to check what works.

so just to clarify, if i get it to work, and we want to update docker.io/paritytech/ci-linux:production to use the latest Rust version that is compatible with the polkadot-sdk rather than the old version RUST_NIGHTLY=2023-05-23 that breaks the build, do we just create a PR to modify https://github.com/paritytech/scripts/blob/master/dockerfiles/ci-linux/Dockerfile, and if the PR gets merged then a new release of docker.io/paritytech/ci-linux:production gets created?

note: docker.io/paritytech/ci-linux:production uses code from these repos:

  • https://github.com/paritytech/scripts/blob/master/dockerfiles/ci-linux/Dockerfile
  • https://github.com/paritytech/scripts/blob/master/dockerfiles/base-ci-linux/Dockerfile
  • https://github.com/paritytech/scripts/blob/master/dockerfiles/contracts-ci-linux/Dockerfile

the above errors seem to be the reason why other issues like this https://github.com/paritytech/polkadot-sdk/issues/2301 are being created.

FYI, for my own project for xcm testing i created a custom version of docker.io/paritytech/ci-linux:production that uses a more recent Rust version here https://github.com/ltfschoen/XCMTemplate/blob/main/docker/Dockerfile

ltfschoen avatar May 13 '24 01:05 ltfschoen