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

Syft panics in docker and mounting docker socket with some images #2010

Closed
iperalta7 opened this issue Aug 9, 2023 · 6 comments
Closed

Syft panics in docker and mounting docker socket with some images #2010

iperalta7 opened this issue Aug 9, 2023 · 6 comments
Labels
bug Something isn't working

Comments

@iperalta7
Copy link

iperalta7 commented Aug 9, 2023

What happened:

Syft image throws me a panic when trying to parse an image

$ docker run --rm -v /var/run/docker.sock:/var/run/docker.sock anchore/syft --catalogers dpkgdb --output cyclonedx-json python:latest
panic: value method github.com/anchore/syft/syft/source.StereoscopeImageSource.Close called using nil *StereoscopeImageSource pointer

goroutine 38 [running]:
github.com/anchore/syft/syft/source.(*StereoscopeImageSource).Close(0xc0000e1c40?)
	<autogenerated>:1 +0x86
github.com/anchore/syft/cmd/syft/cli/packages.execWorker.func1()
	/home/runner/work/syft/syft/cmd/syft/cli/packages/packages.go:109 +0x92a
created by github.com/anchore/syft/cmd/syft/cli/packages.execWorker
	/home/runner/work/syft/syft/cmd/syft/cli/packages/packages.go:57 +0xf7

What you expected to happen:

I am expecting this to run without error and stddout the cyclonedx-json, like I would get for some images. It should give me the output like this command would: docker run --rm anchore/syft --catalogers dpkgdb --output cyclonedx-json python:latest

Steps to reproduce the issue:

Run this command:
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock anchore/syft --catalogers dpkgdb --output cyclonedx-json docker:python:latest

This seems to not work for python:latest, ruby:latest, golang:latest and a couple other images for me, so the image name can be messed around with to show that it works for some other images.

Anything else we need to know?:

Running the command without the docker socket will work however.
docker run --rm anchore/syft --catalogers dpkgdb --output cyclonedx-json python:latest

Environment:

  • Output of syft version:
Version:            0.85.0
JsonSchemaVersion:  9.0.0
BuildDate:          2023-07-12T17:14:54Z
GitCommit:          4fc17edd146af34ab06f5b0443ef8ddac3aaf076
GitDescription:     [not provided]
Platform:           darwin/amd64
GoVersion:          go1.20.6
Compiler:           gc
  • OS (e.g: cat /etc/os-release or similar):
macOS Ventura 13.5
  • Docker Version
Client:
 Cloud integration: v1.0.33
 Version:           24.0.2
 API version:       1.43
 Go version:        go1.20.4
 Git commit:        cb74dfc
 Built:             Thu May 25 21:51:16 2023
 OS/Arch:           darwin/amd64
 Context:           desktop-linux

Server: Docker Desktop 4.20.1 (110738)
 Engine:
  Version:          24.0.2
  API version:      1.43 (minimum version 1.12)
  Go version:       go1.20.4
  Git commit:       659604f
  Built:            Thu May 25 21:52:17 2023
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.21
  GitCommit:        3dce8eb055cbb6872793272b4f20ed16117344f8
 runc:
  Version:          1.1.7
  GitCommit:        v1.1.7-0-g860f061
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
@iperalta7 iperalta7 added the bug Something isn't working label Aug 9, 2023
@iperalta7
Copy link
Author

@telday

@iperalta7 iperalta7 changed the title Using syft in docker and mounting docker socket comes with an error for some images Errors using syft in docker and mounting docker socket with some images Aug 9, 2023
@iperalta7 iperalta7 changed the title Errors using syft in docker and mounting docker socket with some images Syft panics when using docker and mounting docker socket with some images Aug 9, 2023
@iperalta7 iperalta7 changed the title Syft panics when using docker and mounting docker socket with some images Syft panics when using in docker and mounting docker socket with some images Aug 9, 2023
@iperalta7 iperalta7 changed the title Syft panics when using in docker and mounting docker socket with some images Syft panics in docker and mounting docker socket with some images Aug 9, 2023
@tgerla
Copy link
Contributor

tgerla commented Aug 9, 2023

Hey @iperalta7, thanks for the report. I'm unable to reproduce this immediately on my system. (macOS Ventura 13.4.1, Docker Desktop 4.21.1). Can you open up Docker and go to Settings -> Advanced and tell us what your settings are? For example, I've attached mine.

Screenshot 2023-08-09 at 3 22 34 PM

Thanks!

@iperalta7
Copy link
Author

iperalta7 commented Aug 9, 2023

Hey! Here is a screenshot:
image

@tgerla
Copy link
Contributor

tgerla commented Aug 10, 2023

Hmm, OK. I am not a Docker expert here but what do you see if you run the following?

ls -la /var/run/docker.sock

@iperalta7
Copy link
Author

iperalta7 commented Aug 10, 2023

With the help of an associate, I can say this is indeed more of a local issue. But even after reinstallation of both docker and syft, it still occurs.

That command gives me:
lrwxr-xr-x@ 1 root daemon 45 Aug 3 09:49 /var/run/docker.sock -> /Users/isaiah.peralta/.docker/run/docker.sock

@wagoodman
Copy link
Contributor

@iperalta7 Looks like you're on v0.85.0, try updating to at least v0.86.0 or higher, we fixed this in #1968 and released in https://github.com/anchore/syft/releases/tag/v0.86.0 . If you still see this please shout out and we can re-open it.

@wagoodman wagoodman closed this as not planned Won't fix, can't repro, duplicate, stale Aug 10, 2023
@spiffcs spiffcs moved this to Done in OSS Aug 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

No branches or pull requests

3 participants