How to get detailed error message using docker-compose up? I can only see "command returned non-zero code"

I'm trying to run my docker-container on linux. During build I'm encountering an error after running this command:

sudo docker-compose -f docker-compose.yml up --build

docker-compose shows this message:

Step 10/19 : RUN dotnet restore "test/test.csproj"
 ---> Running in ea65364853f3
standard_init_linux.go:211: exec user process caused "exec format error"
ERROR: Service 'test' failed to build: The command '/bin/sh -c dotnet restore "test/test.csproj"' returned a non-zero code: 1

Is there any way I can see detailed error message?

The error is occurring during the build process. You should see the same results when you run docker-compose build.

This error:

standard_init_linux.go:211: exec user process caused "exec format error"

means that Docker tried to run the dotnet executable inside the container, but it couldn't start because the dotnet binary in the image is incompatible with the environment in the container. Perhaps it is compiled for a different architecture, or something like that? If you show the rest of your build process (steps 1-9) we can probably spot the problem for you.

Because RUN commands are said to work like this: get an image, create a container ContainerA, run your command in this container, and generate a new image ImageB. delete ContainerA, create ContainerB... Now it quits at one RUN, so it must leave a containerX behind. Therefore, you can see log like this:

docker build -t <yourname>:<tag>

quit on error

docker logs <yourname>

here is your detailed error log.

You already got the detailed error message!