Code Monkey home page Code Monkey logo

Comments (10)

pwalecha avatar pwalecha commented on July 18, 2024 1

@davidguidali,
Can you try below CLI command? You can refer other SBOM generation CLI tools like Trivy as well, given example is for Syft which is also used by docker for now, per their documentation.
az acr run --registry --cmd 'docker.io/anchore/syft myimage' /dev/null

from acr.

davidguidali avatar davidguidali commented on July 18, 2024

@davidguidali, Can you try below CLI command? You can refer other SBOM generation CLI tools like Trivy as well, given example is for Syft which is also used by docker for now, per their documentation. az acr run --registry --cmd 'docker.io/anchore/syft myimage' /dev/null

Cool thanks, that works! I did:

az acr run --registry myregistry --cmd 'docker.io/anchore/syft myregistry/myimage -o cyclonedx-json' /dev/null

However, I'm a little bit confused, how does the syft container know about 'myimage'`? Does he pull it? And if so, how does he get the credentials to pull it?

from acr.

pwalecha avatar pwalecha commented on July 18, 2024

@davidguidali, Can you try below CLI command? You can refer other SBOM generation CLI tools like Trivy as well, given example is for Syft which is also used by docker for now, per their documentation. az acr run --registry --cmd 'docker.io/anchore/syft myimage' /dev/null

Cool thanks, that works! I did:

az acr run --registry myregistry --cmd 'docker.io/anchore/syft myregistry/myimage -o cyclonedx-json' /dev/null

However, I'm a little bit confused, how does the syft container know about 'myimage'`? Does he pull it? And if so, how does he get the credentials to pull it?

Syft image is pulled within the container post the registry login is successful. Then, the ACR task uses the downloaded Syft CLI to execute the command over the authenticated registry's referred image.
image

from acr.

davidguidali avatar davidguidali commented on July 18, 2024

Yeah I got this part, but doesnt the Syft CLI run within the Syft container? So how does this syft container know about the ACR?
I mean, if I am within a container usually I don't know anything about the environment where its running on, so is configuration somehow magically mounted into the Syft container? So how does the syft cli within the container know the credentials of the ACR?

from acr.

sajayantony avatar sajayantony commented on July 18, 2024

maybe @northtyphoon or @juliusl know more. But might be because the syft CLI is able to pick up the docker creds from the home mount - https://github.com/Azure/acr-builder/blob/18cda98fd073203ca070835bc04e4672eef31ee0/builder/context.go#L91C11-L91C11

from acr.

yizha1 avatar yizha1 commented on July 18, 2024

@davidguidali Do you still have questions on this issue? I would like to understand more about your scenarios. Feel free to contact me by mail at [email protected] if you want to have further discussions.

from acr.

davidguidali avatar davidguidali commented on July 18, 2024

@davidguidali Do you still have questions on this issue? I would like to understand more about your scenarios. Feel free to contact me by mail at [email protected] if you want to have further discussions.

Hi @yizha1
Thanks. I'm still not 100% sure how syft CLI is able to the docker CLI from within the container without explicitly mounting some sockets etc. (or use docker in docker), or does syft CLI not need to access docker explicitly to scan images? However, since my solution works, these questions are based more on my personal curiosity and not that important. :)

For the scenario: We have a CI/CD pipeline in GitLab where we use multiple Linux runners to build our code, run tests etc.
However, none of these runners have docker installed. Instead, we build our images using az acr build. Now we want to create SBOM files for our images and upload them to our instance of Dependency Track. However, we tried to find a solution where we don't need to install Docker or Syft on our agents, so we thought it would be nice to just be able to create the SBOM files by using the ACR capabilities. We solved it now by calling az acr run --registry myregistry --cmd 'docker.io/anchore/syft myregistry/myimage -o cyclonedx-json' /dev/null, parsing the resulting output, extracting the SBOM Json and storing it as a file.
Works like a charm so far.

from acr.

northtyphoon avatar northtyphoon commented on July 18, 2024

The containers launched in cmd (eg, docker.io/anchore/syft in your case --cmd 'docker.io/anchore/syft myregistry/myimage -o cyclonedx-json') automatically have docker daemon socket mounted.

from acr.

yizha1 avatar yizha1 commented on July 18, 2024

@davidguidali Did previous comment answer your question? Feel free to drop me a mail if you would like to discuss more about SBOM, and other secure supply chain related artifacts or solutions. Here is Containers Secure Supply Chain Framework document you may be interested in. Thanks.

from acr.

davidguidali avatar davidguidali commented on July 18, 2024

@davidguidali Did previous comment answer your question? Feel free to drop me a mail if you would like to discuss more about SBOM, and other secure supply chain related artifacts or solutions. Here is Containers Secure Supply Chain Framework document you may be interested in. Thanks.

Yes thanks, everything is clear now. However, it would be useful to use "docker sbom" directly, so I guess the feature request stays valid.

from acr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.