cardano-foundation / cardano-graphql

GraphQL API for Cardano
Apache License 2.0
263 stars 105 forks source link

docker-compose error: yaml.scanner.ScannerError: while scanning a plain scalar #555

Closed lijixy closed 3 years ago

lijixy commented 3 years ago

docker-compose up -d --build && docker-compose logs -f ERROR: yaml.scanner.ScannerError: while scanning a plain scalar in "./docker-compose.yml", line 31, column 21 found unexpected ':' in "./docker-compose.yml", line 31, column 44 Please check http://pyyaml.org/wiki/YAMLColonInFlowContext for details.

rhyslbw commented 3 years ago

Please complete the form:


Environment

Version or Git revision:

Platform

Platform version:

Runtime

Runtime version:

node -v
docker version

Steps to reproduce the bug

What is the expected behavior?

lijixy commented 3 years ago

Version or Git revision: version 2.17.1 Platform: Linux / Ubuntu Platform version: node:v14.17.2 docker:20.10.2

lijixy commented 3 years ago

Please complete the form:

Environment

Version or Git revision:

Platform

* [ ]  Linux / Ubuntu

* [ ]  Linux / Other

* [ ]  macOS

* [ ]  Windows

Platform version:

Runtime

* [ ]  Node.js

* [ ]  Docker

Runtime version:

node -v
docker version

Steps to reproduce the bug

What is the expected behavior?

Version or Git revision: version 2.17.1 Platform: Linux / Ubuntu Platform version: node:v14.17.2 docker:20.10.2

CyberCyclone commented 3 years ago

What cardano-graphql Git commit did you clone from?

Did you change anything in your docker-compose.yml file?

lijixy commented 3 years ago

5.0.0 and I did not change anything in docer-compose.yml file

lijixy commented 3 years ago

git clone --single-branch --branch 5.0.0 --recurse-submodules https://github.com/input-output-hk/cardano-graphql.git

CyberCyclone commented 3 years ago

Did you build with this command? DOCKER_BUILDKIT=1 COMPOSE_DOCKER_CLI_BUILD=1 docker-compose up -d --build && docker-compose logs -f

lijixy commented 3 years ago

yes

CyberCyclone commented 3 years ago

To me this sounds like your docker-compose.yml is corrupt. Try deleting the cardano-graphql folder and starting again.

git clone \
  --single-branch \
  --branch 5.0.0 \
  --recurse-submodules \
  https://github.com/input-output-hk/cardano-graphql.git \
  && cd cardano-graphql
DOCKER_BUILDKIT=1 COMPOSE_DOCKER_CLI_BUILD=1 docker-compose up -d --build && docker-compose logs -f
lijixy commented 3 years ago

The same error

lijixy commented 3 years ago

DOCKER_BUILDKIT=1 COMPOSE_DOCKER_CLI_BUILD=1 docker-compose up -d --build && docker-compose logs -f ERROR: yaml.scanner.ScannerError: while scanning a plain scalar in "./docker-compose.yml", line 31, column 21 found unexpected ':' in "./docker-compose.yml", line 31, column 44

lijixy commented 3 years ago

Could I use the branch 4.0.0?

CyberCyclone commented 3 years ago

I've built 5.0.0 on three different Ubuntu 20.04 machines. Never had the issues you're having. Based on the error though, it sounds like the file is corrupt, but if you've deleted the entire directory and re-cloned it then it sounds more like a system issue rather then a docker issue.

Just for the sake of checking, can you please screenshot the docker-compose.yml section around line 31 and post here?

lijixy commented 3 years ago

图片

CyberCyclone commented 3 years ago

That looks odd. I've just passed the docker-compose.yml from the master branch through a yamllint and that line is invalid.

CyberCyclone commented 3 years ago

My build has the same file, but it runs fine.

Can you please try removing the square brackets on line 31? I'm pretty certain they're not meant to be there.

lijixy commented 3 years ago

ok I try again

lijixy commented 3 years ago

ERROR: The Compose file './docker-compose.yml' is invalid because: services.cardano-node-ogmios.build.cache_from contains "cardanosolutions/ogmios:latest", which is an invalid type, it should be an array

lijixy commented 3 years ago

if I removed the square brackets on line 31, It had another error

lijixy commented 3 years ago

图片

CyberCyclone commented 3 years ago

The original file is actually correct with the square brackets. I'm pretty sure it's invalid yaml, but it's technically a valid docker-compose file.

Can you please share your docker-compose version?

docker-compose -v

lijixy commented 3 years ago

docker-compose version 1.17.1

CyberCyclone commented 3 years ago

That's pretty old. Can you please try updating it?

lijixy commented 3 years ago

It was failed, but I can run 4.0.0, could I use it?

CyberCyclone commented 3 years ago

Just double checking you reverted the docker-compose.yml to what it was from the 5.0.0 branch, upgraded docker-compose (1.29.2 is the latest I think), and then tried again?

You can use 4.0.0 which still works fine. You'll just need to apply the below patch. And probably change cardano-node in docker-compose.yml to 1.27.0. https://github.com/input-output-hk/cardano-graphql/issues/464

lijixy commented 3 years ago

I updated the docker-compose(1.29.2) , and pull the 5.0.0 branch, it was failed too! 图片 WARNING: Found orphan containers (cardano-graphql_cardano-node_1) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up. Building cardano-node-ogmios [+] Building 1.1s (4/4) FINISHED
=> [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 32B 0.0s => [internal] load .dockerignore 0.0s => => transferring context: 35B 0.0s => ERROR [internal] load metadata for docker.io/library/debian:buster-slim 1.0s => [internal] load metadata for docker.io/library/haskell:8.10.4 0.0s

[internal] load metadata for docker.io/library/debian:buster-slim:

failed to solve with frontend dockerfile.v0: failed to create LLB definition: rpc error: code = Unknown desc = error getting credentials - err: exit status 1, out: Cannot autolaunch D-Bus without X11 $DISPLAY ERROR: Service 'cardano-node-ogmios' failed to build : Build failed

lijixy commented 3 years ago

@CyberCyclone

CyberCyclone commented 3 years ago

It's a project naming clash. It doesn't know it's the same images you want built. Normally you don't need --remove-orphans flag, but in this case it's saying to. See how the below goes.

DOCKER_BUILDKIT=1 COMPOSE_DOCKER_CLI_BUILD=1 docker-compose up -d --build --remove-orphans && docker-compose logs -f

lijixy commented 3 years ago

ok

rhyslbw commented 3 years ago

Thanks for helping out here @CyberCyclone. I'll reopen this issue to correct the syntax in the cache_from value, which as you point out is invalid yaml but somehow docker-compose accepts it :shrug:

https://docs.docker.com/compose/compose-file/compose-file-v3/#cache_from

rhyslbw commented 3 years ago

I've just reviewed the 1.2 spec. The square brackets are an alternative syntax for a sequence, so is legal which is also confirmed by https://onlineyamltools.com/validate-yaml and https://jsonformatter.org/yaml-validator. I'm wondering if http://www.yamllint.com/ is not fully implementing the spec, or is based on an older version.

@lijixy Did you get this working without needing to revert or modify the compose file?

lijixy commented 3 years ago

Very strange, yesterday afternoon, I suddenly worked, and now I have synchronized 95.7%.