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

How to use Dive in gitlab CI Securely? #493

Closed
baojingh opened this issue Jan 16, 2024 · 3 comments
Closed

How to use Dive in gitlab CI Securely? #493

baojingh opened this issue Jan 16, 2024 · 3 comments
Labels
enhancement Add a new feature

Comments

@baojingh
Copy link

Issue:
My understand to dive is that dive has to pull the image to his local docker engine and then dive could scan the docker image layer.
I use dive in .gitlab-ci.yml.
I have to mount the docker.sock file to my container such as "-v /var/run/docker.sock:/var/run/docker.sock", which is not secure I think.

My question is that how could I use dive in gitlab-ci.yml without "-v /var/run/docker.sock:/var/run/docker.sock"?

@baojingh baojingh added the enhancement Add a new feature label Jan 16, 2024
@mark2185
Copy link
Contributor

You could supply an image as an archive to circumvent the need for docker, just invoke it with --source docker-archive <path-to-image.tar> and it will read from the file.

How you get the file where you need it is up to you and your CI.

@baojingh
Copy link
Author

Yes, Thanks and I got your point.

@aarongoldenthal
Copy link

If anyone's looking for a more complete GitLab CI example for saving the archive file:

dive:
  image:
    name: wagoodman/dive:latest
    entrypoint: ['']
  script:
    - apk add --no-cache skopeo
    - skopeo copy docker://${IMAGE_NAME}:${IMAGE_TAG} docker-archive:archive.tar
    - dive --source docker-archive archive.tar

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

No branches or pull requests

3 participants