paritytech / substrate

Substrate: The platform for blockchain innovators
Apache License 2.0
8.39k stars 2.65k forks source link

Fix docker related problems #10051

Closed nuke-web3 closed 2 years ago

nuke-web3 commented 3 years ago

Originally by @koslib here :

Most of the links posted above also contain non functional manifests.

Example 1: this link https://github.com/paritytech/substrate/blob/master/bin/node-template/docker-compose.yml results in a path error.

Example 2: this link https://github.com/paritytech/substrate/tree/master/docker indicates this as an option

docker run --rm -it parity/substrate node-template --version

however this spits back

❯ docker run --rm -it parity/substrate node-template --version
error: Found argument 'node-template' which wasn't expected, or isn't valid in this context

That's why I think a general revamp and cleanup of all docker-related examples is needed. It's confusing for a starter.

TriplEight commented 3 years ago

Example 1: this link https://github.com/paritytech/substrate/blob/master/bin/node-template/docker-compose.yml results in a path error.

works for me right from here.

@chevdor last time updatin the manuals, we've missed a little something: https://github.com/paritytech/substrate/pull/9808/files#diff-da8fcbe728a9172b578e5d754f8e2df214c658c4321f610e63dd68bea828ab49R19-R22

chevdor commented 3 years ago

Yes, indeed:

docker run --rm -it parity/substrate node-template --version                                                                                        

outputs:

node-template 3.0.0-9fae71e30a-x86_64-linux-gnu
koslib commented 3 years ago

Just ran it again from a different computer even. Any ideas what could be the issue in my case?

❯ docker run --rm -it parity/substrate node-template --version

error: Found argument 'node-template' which wasn't expected, or isn't valid in this context

USAGE:
    substrate [FLAGS] [OPTIONS]
    substrate <SUBCOMMAND>

For more information try --help
chevdor commented 3 years ago

ok, I think the issue is that I had an old image on my machine. The published image no longer has the node-template. So the options are:

@koslib if you need a quick solution, you could build an image locally, would that work ?

koslib commented 3 years ago

@chevdor thanks for the proposed solution, but it doesn't seem to work at least out of the box either.

When building the node-template image from scratch (to be specific, this: https://github.com/paritytech/substrate/tree/master/bin/node-template)

I still get errors

ERROR: for dev  Cannot create container for service dev: invalid mount config for type "bind": bind source path does not exist: <redacted path>/substrate/bin/node-template/.local

I'm suspecting that the .local/ path it's trying to find has something to do with rust's compilation, but I don't want to do anything outside of Docker. Am I wrong? Or generally, all ideas welcome.

chevdor commented 3 years ago

It sounds like you'd need to creater this folder that does not exist. For this kind of issue I suggest testing first without binding any path (so no -v flag). It help knowing if that works at that point or not. You may also need to get inspired from https://github.com/paritytech/substrate/blob/master/docker/substrate_builder.Dockerfile#L24-L26

bkchr commented 2 years ago

Any update on this? Can this be closed?

TriplEight commented 2 years ago

Just realized that the problem was on the surface:

docker run --rm -it parity/substrate node-template --version errors out with an unexpected argument node-template. It expects the flags right away as if you'd run a binary.

To specify which binary are you calling, you should override the entrypoint script i.e. adding --entrypoint [new_command] to `docker call.