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

Failed to detect shell correctly in container image build case #114

Open
mortyccp opened this issue Dec 12, 2024 · 3 comments
Open

Failed to detect shell correctly in container image build case #114

mortyccp opened this issue Dec 12, 2024 · 3 comments
Assignees

Comments

@mortyccp
Copy link

The shell detection will check the process of the host instead of stopping inside the container image build environment
The following is the ps output inside the container build step
It will detect the shell as bash but the image being used don't have bash

PID   USER     TIME  COMMAND
    1 root      0:00 /usr/bin/bash
   24 root      0:00 sh -c (/scripts-926-2646660/detect_shell_script /scripts-926-2646660/step_script 2>&1 | tee -a /logs-926-2646660/output.log) &
   25 root      0:00 /usr/bin/bash /scripts-926-2646660/step_script
   26 root      0:00 tee -a /logs-926-2646660/output.log
   30 root      0:00 /usr/bin/bash /scripts-926-2646660/step_script
   72 root      0:00 buildah build
   80 root      0:27 {3} buildah-in-a-user-namespace build
  367 root      0:00 {5} buildah-chroot-runtime
  375 root      0:00 {5} buildah-chroot-exec /bin/sh -c ps
  383 root      0:00 ps
@milesj
Copy link
Collaborator

milesj commented Dec 12, 2024

@mortyccp Do you have an example dockerfile I can test with?

@milesj milesj self-assigned this Dec 12, 2024
@mortyccp
Copy link
Author

@milesj
Copy link
Collaborator

milesj commented Dec 21, 2024

I've looked into this a bit, but I'm not sure what the fix would be in starbase. Since we're not "in" the docker container, the .dockerenv file doesn't exist, and /proc/self/cgroup doesn't have docker either, so I can't introduce any conditional logic.

However, adding ENV SHELL=sh to the Dockerfile fixed the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants