Skip to content
This repository has been archived by the owner on Jul 3, 2023. It is now read-only.

Executable file not found in $PATH #3

Open
eohtake opened this issue Nov 8, 2019 · 1 comment
Open

Executable file not found in $PATH #3

eohtake opened this issue Nov 8, 2019 · 1 comment

Comments

@eohtake
Copy link

eohtake commented Nov 8, 2019

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
@Patazerty
Copy link
Contributor

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants