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

Does clair-scanner work with Docker Desktop? #114

Open
ksed opened this issue Mar 25, 2021 · 2 comments
Open

Does clair-scanner work with Docker Desktop? #114

ksed opened this issue Mar 25, 2021 · 2 comments

Comments

@ksed
Copy link

ksed commented Mar 25, 2021

I've installed this via go on an up-to-date Windows 10 machine with Docker Desktop, and have followed the instructions for launching the two db docker containers for the clair-scanner.

Yet, every time I run .\go\bin\clair-scanner.exe --ip="172.17.0.1" --threshold="High" --report="report.json" --log="log.txt" <image name here> , all I get is ... Got response 400 with message {"Error":{"Message":"could not find layer"}}.

Yet when I follow the same steps on a linux box, it works just fine. What gives?

BTW, I found this for getting the IP for the Docker bridge network.

@ksed ksed changed the title Does clair-scanner work with Docker Desktop Does clair-scanner work with Docker Desktop? Mar 25, 2021
@skupfer
Copy link

skupfer commented Jun 25, 2021

EDIT:

IPv4 works but the server opened by clair seems to be a ipv6 listener which is not yet supported by Docker Desktop and here.

EDIT:

Could you add IPv4 support for the fileserver?

EDIT: Following change to server.go and make build should fix it (tested on WSL)
Line 16, change server := &http.Server{Addr: ":" + httpPort} to server := &http.Server{Addr: "127.0.0.1:" + httpPort}

Warning. Current source throws errors

EDIT: How to build clair-v12

#prepare src directory
mkdir -p /home/$USER/go/src

#install go 1.9.7
sudo rm -rf /usr/local/go
wget https://golang.org/dl/go1.9.7.linux-amd64.tar.gz -O - | sudo tar -xzf - -C /usr/local

#export path or add it .bashrc / .zshrc / ... -> close session / make new session or source the appropriate file
export PATH=$PATH:/usr/local/go/bin

#install dep
sudo apt install go-dep

#download and extract source
wget https://github.com/arminc/clair-scanner/archive/refs/tags/v12.tar.gz -O - | tar -xzf - -C /home/$USER/go/src

#modify file (look above) and compile
cd /home/$USER/go/src
make ensure
make build

#copy new clair-scanner
sudo cp clair-scanner-12 /usr/local/bin/clair-scanner

@YevheniiPokhvalii
Copy link

It works with Docker Desktop. Pay attention to the IP address. Here is the issue: #42

I had to indicate my gateway IP to make it work.

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

No branches or pull requests

3 participants