Executable file not found in $PATH
Opened this issue · 1 comments
Hello,
Running a container with an image built from this Dockerfile generates an error:
Missing binary name when copy to /usr/local/bin/ folder
docker: Error response from daemon: OCI runtime create failed: container_linux.go:346: starting container process caused "exec: "clair": executable file not found in $PATH": unknown.
I did a little investigation and found that on the Dockerfile, the binary name is missing in the destination folder, so the copy operation is overwriting the /usr/local/bin folder.
The correct copy line should be:
COPY --from=0 /gopath/src/clair/clair /usr/local/bin/clair
Below some evidence that the bin folder became the Clair binary:
~ # cd /usr/local/bin
/bin/sh: cd: can't cd to /usr/local/bin: Not a directory
~ #
~ #
~ #
~ # cd /usr/local
/usr/local #
/usr/local #
/usr/local #
/usr/local # ls
bin lib share
/usr/local #
/usr/local #
/usr/local #
/usr/local # ./bin
Error: incorrect usage
Usage: clair-scanner [OPTIONS] IMAGE
Scan local Docker images for vulnerabilities with Clair
Arguments:
IMAGE="" Name of the Docker image to scan
Options:
-w, --whitelist="" Path to the whitelist file
-t, --threshold="Unknown" CVE severity threshold. Valid values; 'Defcon1', 'Critical', 'High', 'Medium', 'Low', 'Negligible', 'Unknown'
-c, --clair="http://127.0.0.1:6060" Clair URL
--ip="localhost" IP address where clair-scanner is running on
-l, --log="" Log to a file
--all, --reportAll=true Display all vulnerabilities, even if they are approved
-r, --report="" Report output file, as JSON
--exit-when-no-features=false Exit with status code 5 when no features are found for a particular image
I can't reproduce this issue, building with the latest alpine
produces a correct build with the clair binary in the /usr/local/bin
folder that already exists in the base alpine image:
$ docker run -ti alpine
# ls -la /usr/local/
total 20
drwxr-xr-x 5 root root 4096 Oct 21 13:39 .
drwxr-xr-x 7 root root 4096 Oct 21 13:39 ..
drwxr-xr-x 2 root root 4096 Oct 21 13:39 bin
drwxr-xr-x 2 root root 4096 Oct 21 13:39 lib
drwxr-xr-x 2 root root 4096 Oct 21 13:39 share
Are you sure you are using an up to date alpine base image ?
I've also just setup automated builds on the docker hub instead of travis, so the image should objectiflibre/clair-scanner
stay up-to-date.