- Does the file exist... in the path and inside the container?
The path inside the container may be different from the path on your host. You can update the PATH environment variable during the build, or you can call the binary with a full path, e.g. /home/container_user/scripts/docker.groovy
(we don't know where this file is inside your container from the question provided). That path needs to be to the script inside of your container, docker doesn't have direct access to the host filesystem, but you can run your container with a volume mount to bind mount a path on the host into the container.
- If it is a shell script, check the first line, e.g.
#!/bin/bash
You may have a groovy command at the top of your script. This binary must exist inside the container, and be in your path that's defined inside the container.
- Check for windows linefeeds on linux shell scripts
If the script was written on windows, you may have the wrong linefeeds in the script. It will look for groovy\r
instead of groovy
and the first command won't exist.
- If it is a binary, there is likely a missing library
You'll see this if the groovy binary was added with something like a COPY command, instead of compiling locally or installing from the package manager. You can use ldd /path/to/groovy
inside the container to inspect the linked libraries.
This list is from my DC2018 presentation: https://sudo-bmitch.github.io/presentations/dc2018/faq-stackoverflow.html#59