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

[BUG] Copa seems to be lost when getting the OS information #886

Open
1 task
bleal-kitmanlabs opened this issue Dec 30, 2024 · 3 comments
Open
1 task
Labels
bug Something isn't working

Comments

@bleal-kitmanlabs
Copy link

Version of copa

copa version 0.9.0

Expected Behavior

Copa should be running lsb-release and parsing the results to know what is the OS the docker image was built on top.

Actual Behavior

It seems it assumes to always look to /etc/os-release, but not all OS have it. In my case, with prometheus, its throwing the following error:

Error: open /etc/os-release: no such file or directory

Steps To Reproduce

  1. export IMAGE="prom/prometheus:v3.1.0-rc.1@sha256:de8cca5437dbb2ce9c00b139e3ca6afc6dcdc8905cedd28329f7809bc77852a3"
  2. docker pull $IMAGE
  3. copa patch -i $IMAGE --debug

output :

╰─ copa patch -i $IMAGE --debug
DEBU[0000] Trying docker driver
DEBU[0000] serving grpc connection
DEBU[0000] stopping session
DEBU[0000] serving grpc connection
#1 resolve image config for docker-image://docker.io/prom/prometheus:v3.1.0-rc.1@sha256:de8cca5437dbb2ce9c00b139e3ca6afc6dcdc8905cedd28329f7809bc77852a3
#1 DONE 1.3s
Error: open /etc/os-release: no such file or directory

#2 resolve image config for docker-image://docker.io/prom/prometheus:v3.1.0-rc.1@sha256:de8cca5437dbb2ce9c00b139e3ca6afc6dcdc8905cedd28329f7809bc77852a3

Are you willing to submit PRs to contribute to this bug fix?

  • Yes, I am willing to implement it.
@ashnamehrotra
Copy link
Contributor

@bleal-kitmanlabs Copa parses for the os-release file since that is the standard in linux distributions. I am not able to find an os-release or lsb-release file when inspecting the file structure with crane, is there anything I am missing here?

crane export prom/prometheus:latest - > prom.tar
tar -tf prom.tar | grep etc/

etc/prometheus
etc/prometheus/prometheus.yml
etc/nsswitch.conf
etc/services
etc/ssl
etc/ssl/certs
etc/ssl/certs/ca-certificates.crt
etc/group
etc/localtime
etc/network
etc/network/if-down.d
etc/network/if-post-down.d
etc/network/if-pre-up.d
etc/network/if-up.d
etc/passwd
etc/shadow

@bleal-kitmanlabs
Copy link
Author

@ashnamehrotra thanks for coming back. In a case the os-release file does not exist, is there any way I can pass as a parameter the OS the image was built on top?

Also, the command lsb_release may print some useful information.

@ashnamehrotra
Copy link
Contributor

@bleal-kitmanlabs there is no way to pass in the parameter the OS image was built on top of currently. That is something we can consider adding for the future, but we would need to pass in both os type and version.

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
Status: 🆕 New
Development

No branches or pull requests

2 participants