Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error docker build /bin/sh: 1: ./gradlew: not found The command '/bin/sh -c ./gradlew shadowJar' returned a non-zero code: 127 #74

Open
vvp83 opened this issue Feb 14, 2021 · 6 comments
Labels
bug Something isn't working

Comments

@vvp83
Copy link

vvp83 commented Feb 14, 2021

Sending build context to Docker daemon 265.7MB
Step 1/17 : FROM openjdk:13-jdk-slim-buster
---> 5927024fce47
Step 2/17 : RUN apt-get update && apt-get install -y --no-install-recommends nmap ncrack git ca-certificates && rm -rf /var/lib/apt/lists/*
---> Using cache
---> 7797c8a9e0ba
Step 3/17 : WORKDIR /usr/tsunami/repos
---> Using cache
---> 472724b42a15
Step 4/17 : RUN git clone --depth 1 "https://github.com/google/tsunami-security-scanner-plugins"
---> Using cache
---> 951a2e324a9a
Step 5/17 : WORKDIR /usr/tsunami/repos/tsunami-security-scanner-plugins/google
---> Using cache
---> 18a9e784b75e
Step 6/17 : RUN chmod +x build_all.sh && ./build_all.sh
---> Using cache
---> 97e45dbca963
Step 7/17 : RUN mkdir /usr/tsunami/plugins
---> Using cache
---> 3a22d9b0cc92
Step 8/17 : RUN cp build/plugins/*.jar /usr/tsunami/plugins
---> Using cache
---> a09d4e602f62
Step 9/17 : WORKDIR /usr/repos/tsunami-security-scanner
---> Using cache
---> fbc8c9d682ec
Step 10/17 : COPY . .
---> 7fe628c935e8
Step 11/17 : RUN ./gradlew shadowJar
---> Running in d753c1459783
/bin/sh: 1: ./gradlew: not found
The command '/bin/sh -c ./gradlew shadowJar' returned a non-zero code: 127

Update: Run docker build after bash -c "$(curl -sfL https://raw.githubusercontent.com/google/tsunami-security-scanner/master/quick_start.sh)" comand.

@sriramnrn
Copy link

sriramnrn commented Feb 14, 2021 via email

@magl0
Copy link
Collaborator

magl0 commented Mar 1, 2021

Sorry we cannot reproduce issue on our local dev environment. Do you mind posting the full build logs from a clean state? In addition, FYI we are working on releasing the docker images to gcr.io so that you can directly fetching the image without building by yourself.

@jsburch83
Copy link

Just tried to install with the Dockfile and received the same error:

BUILD SUCCESSFUL in 9s
5 actionable tasks: 5 executed
Removing intermediate container 3f0ff67a2178
---> 1adde0426927
Step 7/16 : RUN mkdir /usr/tsunami/plugins && cp build/plugins/.jar /usr/tsunami/plugins
---> Running in 31010388ab6f
Removing intermediate container 31010388ab6f
---> f3f65159c9b5
Step 8/16 : WORKDIR /usr/repos/tsunami-security-scanner
---> Running in c11f77686949
Removing intermediate container c11f77686949
---> 77006843b93c
Step 9/16 : COPY . .
---> 4f76ab26c1ff
Step 10/16 : RUN ./gradlew shadowJar && cp $(find "./" -name 'tsunami-main-
-cli.jar') /usr/tsunami/tsunami.jar && cp ./tsunami.yaml /usr/tsunami
---> Running in ded77ec4e3c3
/bin/sh: 1: ./gradlew: not found
The command '/bin/sh -c ./gradlew shadowJar && cp $(find "./" -name 'tsunami-main-*-cli.jar') /usr/tsunami/tsunami.jar && cp ./tsunami.yaml /usr/tsunami' returned a non-zero code: 127

@DuncanConroy
Copy link

I have the same issue, building on MinGW on Windows. Haven't checked on Linux, yet.
This is my build log (with cached dependencies)

#0 building with "default" instance using docker driver

#1 [internal] load build definition from Dockerfile
#1 transferring dockerfile: 1.39kB 0.0s done
#1 DONE 0.0s

#2 [internal] load .dockerignore
#2 transferring context: 266B done
#2 DONE 0.1s

#3 [internal] load metadata for docker.io/adoptopenjdk/openjdk13:debianslim-jre
#3 DONE 1.7s

#4 [internal] load metadata for docker.io/adoptopenjdk/openjdk13:debianslim
#4 DONE 1.7s

#5 [stage-0  1/10] FROM docker.io/adoptopenjdk/openjdk13:debianslim@sha256:442a10b6f318bd6a11f81c6f0f0de90cc0870a4421ab0eba875ef3680220a542
#5 DONE 0.0s

#6 [stage-1 1/4] FROM docker.io/adoptopenjdk/openjdk13:debianslim-jre@sha256:a193ed5ea489b5ac33777010d7f12009ef9c0e0fc172181ab0365f07d4086137
#6 DONE 0.0s

#7 [stage-1 2/4] RUN apt-get update     && apt-get install -y --no-install-recommends nmap ncrack ca-certificates     && apt-get clean     && mkdir logs/
#7 CACHED

#8 [stage-1 3/4] WORKDIR /usr/tsunami
#8 CACHED

#9 [internal] load build context
#9 transferring context: 29.72kB 0.0s done
#9 DONE 0.1s

#10 [stage-0  8/10] WORKDIR /usr/repos/tsunami-security-scanner
#10 CACHED

#11 [stage-0  7/10] RUN mkdir /usr/tsunami/plugins     && cp build/plugins/*.jar /usr/tsunami/plugins
#11 CACHED

#12 [stage-0  5/10] WORKDIR /usr/tsunami/repos/tsunami-security-scanner-plugins/google
#12 CACHED

#13 [stage-0  6/10] RUN chmod +x build_all.sh     && ./build_all.sh
#13 CACHED

#14 [stage-0  2/10] RUN apt-get update  && apt-get install -y --no-install-recommends git ca-certificates
#14 CACHED

#15 [stage-0  4/10] RUN git clone --depth 1 "https://github.com/google/tsunami-security-scanner-plugins"
#15 CACHED

#16 [stage-0  3/10] WORKDIR /usr/tsunami/repos
#16 CACHED

#17 [stage-0  9/10] COPY . .
#17 CACHED

#18 [stage-0 10/10] RUN ./gradlew shadowJar     && cp $(find "./" -name 'tsunami-main-*-cli.jar') /usr/tsunami/tsunami.jar     && cp ./tsunami.yaml /usr/tsunami
#18 0.400 /usr/bin/env: ‘sh\r’: No such file or directory
#18 ERROR: process "/bin/sh -c ./gradlew shadowJar     && cp $(find \"./\" -name 'tsunami-main-*-cli.jar') /usr/tsunami/tsunami.jar     && cp ./tsunami.yaml /usr/tsunami" did not complete successfully: exit code: 127
------
 > [stage-0 10/10] RUN ./gradlew shadowJar     && cp $(find "./" -name 'tsunami-main-*-cli.jar') /usr/tsunami/tsunami.jar     && cp ./tsunami.yaml /usr/tsunami:
0.400 /usr/bin/env: ‘sh\r’: No such file or directory
------
Dockerfile:23
--------------------
  22 |     COPY . .
  23 | >>> RUN ./gradlew shadowJar \
  24 | >>>     && cp $(find "./" -name 'tsunami-main-*-cli.jar') /usr/tsunami/tsunami.jar \
  25 | >>>     && cp ./tsunami.yaml /usr/tsunami
  26 |
--------------------
ERROR: failed to solve: process "/bin/sh -c ./gradlew shadowJar     && cp $(find \"./\" -name 'tsunami-main-*-cli.jar') /usr/tsunami/tsunami.jar     && cp ./tsunami.yaml /usr/tsunami" did not complete successfully: exit code: 127

@sriramnrn
Copy link

sriramnrn commented Jan 6, 2024 via email

@DuncanConroy
Copy link

DuncanConroy commented Jan 6, 2024

I have found a solution - it was Windows vs. Unix line endings. Running dos2unix on the script files helped.
See stack overflow

It looks like this might help @jsburch83 as well.

@tooryx tooryx added the bug Something isn't working label Jan 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants