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

temporary file/cache location configurability #75

Closed
gergelyfabian opened this issue Nov 29, 2023 · 11 comments
Closed

temporary file/cache location configurability #75

gergelyfabian opened this issue Nov 29, 2023 · 11 comments

Comments

@gergelyfabian
Copy link

gergelyfabian commented Nov 29, 2023

I'm trying to use docker scout from a Bazel test target, that gives restricted access to a user's home directory.
Thus, docker scout fails with a similar error:

ERROR   Status: failed to write sbom: open /home/user/.docker/scout/sbom/sha256/ff26ee2d81e043488707fbfb3796ff79086cd24fb6c00fb880780c3b7386c30c/sbom.json: read-only file system, Code: 1 

Is there a way to reconfigure docker scout to write temporary files or cached files into a different location?
If this is not currently supported, could you provide some link to source code where this could be added (maybe I could contribute it).

@cdupuis
Copy link
Collaborator

cdupuis commented Nov 29, 2023

You can try setting DOCKER_SCOUT_CACHE_DIR env var to have docker scout use a different cache location. Alternatively, you can also disable caching completely with DOCKER_SCOUT_NO_CACHE.

Let me know if that works.

@gergelyfabian
Copy link
Author

Tried both:

DOCKER_SCOUT_CACHE_DIR=$TEST_TMPDIR/scout_cache docker scout cves ...
DOCKER_SCOUT_NO_CACHE=true docker scout cves ...

The error I get is (the same whether I provide these env vars or not):

ERROR   Status: failed create to sbom folder: mkdir /home/user/.docker/scout/sbom/sha256/a94bfdf20e311ab7b601639db53512dec6f3debbe10d0fdca8de3527d1e64766: read-only file system, Code: 1 
version: v1.2.0 (go1.21.3 - linux/amd64)
git commit: 4f69249fb62a3d644dbaf7d9ddb3046e3b8bd35c

@cdupuis
Copy link
Collaborator

cdupuis commented Nov 29, 2023

Thanks for reporting back. Let me take a look at this more.

@cdupuis
Copy link
Collaborator

cdupuis commented Nov 29, 2023

Opps, I see what's wrong here. Let me push a fix.

@gergelyfabian
Copy link
Author

Opps, I see what's wrong here. Let me push a fix.

Thank you so much!

@cdupuis cdupuis closed this as completed Nov 29, 2023
@gergelyfabian
Copy link
Author

How could I test the fix?

@cdupuis cdupuis reopened this Nov 29, 2023
@cdupuis
Copy link
Collaborator

cdupuis commented Nov 29, 2023

Fix pushed. Waiting for release now.

@cdupuis
Copy link
Collaborator

cdupuis commented Nov 29, 2023

Version 1.2.1 is now released.

@cdupuis cdupuis closed this as completed Nov 29, 2023
@gergelyfabian
Copy link
Author

After upgrading to 1.2.1 it works with:

export DOCKER_SCOUT_CACHE_DIR=$TEST_TMPDIR/scout_cache

It doesn't work though with:

export DOCKER_SCOUT_NO_CACHE=true

Could these env vars be added to documentation? I see it mentioned in the docker scout cache df documentation, but it's not mentioned for other commands or the general docs.
Also, I guess it would be useful to add a mention for them in the error message if the SBOM file could not be written due to file system permission errors.

@cdupuis
Copy link
Collaborator

cdupuis commented Nov 30, 2023

@gergelyfabian I've added docs about the available env vars to https://github.com/docker/scout-cli/blob/main/README.md#environment-variables. This will also be added to the official docs at docs.docker.com soon.

export DOCKER_SCOUT_NO_CACHE=true

Yes, saw that too and already pushed a fix. Previously this env var was only not reading from the cache but we were still attempting to write. This will be fixed in the next version.

@gergelyfabian
Copy link
Author

Thank you for all the fixes!

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

2 participants