'`RUN ./gradlew build -x test` command error

I have been trying to install conductor using docker but I have been constantly getting errors. I tried using [https://github.com/Netflix/conductor/tree/main/docker][1] commands as given in this. But the first command didnt work(gradlew build) I instead used gradlew init. When running the second command (docker build -t conductor:server ./server)

 => [internal] load build definition from Dockerfile                                                               0.0s
 => => transferring dockerfile: 923B                                                                               0.0s
 => [internal] load .dockerignore                                                                                  0.0s
 => => transferring context: 2B                                                                                    0.0s
 => [internal] load metadata for docker.io/library/openjdk:8-jre-alpine                                            5.3s
 => [internal] load metadata for docker.io/library/openjdk:8-jdk                                                   5.3s
 => [auth] library/openjdk:pull token for registry-1.docker.io                                                     0.0s
 => [internal] load build context                                                                                  0.1s
 => => transferring context: 1.33kB                                                                                0.0s
 => [builder 1/4] FROM docker.io/library/openjdk:8-jdk@sha256:96c15b4ddc92615cc8ab30b60deba963232de521784661e1ab8  0.0s
 => CANCELED [stage-1 1/6] FROM docker.io/library/openjdk:8-jre-alpine@sha256:f362b165b870ef129cbe730f29065ff3739  0.9s
 => => resolve docker.io/library/openjdk:8-jre-alpine@sha256:f362b165b870ef129cbe730f29065ff37399c0aa8bcab3e44b51  0.0s
 => => sha256:f362b165b870ef129cbe730f29065ff37399c0aa8bcab3e44b51c302938c9193 1.64kB / 1.64kB                     0.0s
 => => sha256:b2ad93b079b1495488cc01375de799c402d45086015a120c105ea00e1be0fd52 947B / 947B                         0.0s
 => => sha256:f7a292bbb70c4ce57f7704cc03eb09e299de9da19013b084f138154421918cb4 3.42kB / 3.42kB                     0.0s
 => => sha256:e7c96db7181be991f19a9fb6975cdbbd73c65f4a2681348e63a141a2192a5f10 0B / 2.76MB                         0.9s
 => => sha256:f910a506b6cb1dbec766725d70356f695ae2bf2bea6224dbe8c7c6ad4f3664a2 0B / 238B                           0.9s
 => => sha256:b6abafe80f63b02535fc111df2ed6b3c728469679ab654e03e482b6f347c9639 0B / 54.94MB                        0.9s
 => CACHED [builder 2/4] COPY . /conductor                                                                         0.0s
 => CACHED [builder 3/4] WORKDIR /conductor                                                                        0.0s
 => ERROR [builder 4/4] RUN ./gradlew build -x test                                                                0.9s
------
 > [builder 4/4] RUN ./gradlew build -x test:
#12 0.803 /bin/sh: 1: ./gradlew: not found
------
executor failed running [/bin/sh -c ./gradlew build -x test]: exit code: 127

I am using windows I tried changing RUN ./gradlew build -x test to .\gradlew,gradlew,gradle,..\gradlew,../gradlew but nothing has worked.

Thank you



Solution 1:[1]

The root cause is that the file gradlew is DOS format on windows. You need to transfer the file format to unix format in advance before compose or build, so you need add :

RUN apt-get update && apt-get install -y dos2unix && dos2unix gradlew
RUN find ./ -name "*.java" | xargs dos2unix

before

RUN ./gradlew build -x test

in the DockerFile which under server fold.

Solution 2:[2]

Let me disclose steps I've executed, which is explained on, https://github.com/Netflix/conductor/issues/1814.

  1. Delete your current conductor folder
  2. Run git config --global core.autocrlf false; or simply make sure it is already set if you ran in the past
  3. Clone conductor repo again
  4. Check if end of lines shows as CRLF via NotePad++ by opening a DockerFile, e.g. => conductor/docker/server/DockerFile
  5. Run docker-compose up on conductor/docker

This worked for me!

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 surendarmx