Is there a list anywhere of what needs to be prese...
# general
l
Is there a list anywhere of what needs to be present in an image to use it as a
docker_environment
? I’m building out some smoke tests for one of our images and want to do it by running my
python_tests
within the container as a
docker_environment
. So far it’s choked on lacking
/bin/sh
which I fixed by adding in a busybox shell, but now it’s looking for
bash
as well. Is there anything else that I’ll need to put in?
Copy code
pants test ::
14:17:30.27 [INFO] Initialization options changed: reinitializing scheduler...
14:17:34.89 [INFO] Scheduler initialized.
14:17:36.00 [ERROR] 1 Exception encountered:

Engine traceback:
  in `test` goal

ProcessExecutionFailure: Process 'Searching for `bash` on PATH=/usr/bin:/bin:/usr/local/bin' failed with exit code 126.
stdout:
OCI runtime exec failed: exec failed: unable to start container process: exec ./find_binary.sh: no such file or directory: unknown

stderr:



Use `--keep-sandboxes=on_failure` to preserve the process chroot for inspection.
b
It seems like https://www.pantsbuild.org/docs/environments and https://www.pantsbuild.org/docs/reference-docker_environment doesn't list it, and I don't know where else it'd be... so, maybe it doesn't exist. If you happen to be able to work through it and have a list, could you either open an issue with it and/or a pull request expanding https://github.com/pantsbuild/pants/blob/main/docs/markdown/Using%20Pants/environments.md or the text in https://github.com/pantsbuild/pants/blob/924076eea027a9078c87e1e519caa0c612cab173/src/python/pants/core/util_rules/environments.py#L263-L276 ? Thanks!
l
Yep, will do! I’ve got
bash
installed in the container now and am getting another error that I’m having trouble diagnosing:
Copy code
ProcessExecutionFailure: Process 'Searching for `bash` on PATH=/usr/bin:/bin:/usr/local/bin' failed with exit code 126.
stdout:
OCI runtime exec failed: exec failed: unable to start container process: exec ./find_binary.sh: no such file or directory: unknown
I’ve seen
no such file or directory
before on files that are definitely there when there are shared libs missing, but I don’t think that’s the case here. I’m able to get a bash shell in the container, and I symlinked
/usr/bin/env
as well since the shebang at the top of
find_binary.sh
relies on it.
Okay, well this time it was my own fault because I typo’d symlinking to /usr/bin/env.
😅 1
Aha, I’ve got it working. The full list of what you need is: •
bash
/bin/sh
-> can be symlinked to either bash or busybox •
/usr/bin/env
-> can by symlinked to busybox •
tar
-> can be anywhere on $PATH (although oddly pants checks for my local path, not those in the container). Can be symlinked from busybox.
👍 1
🎉 1
PR up, I added it to the help text for the
image
field itself since that feels like the most likely place to look: https://github.com/pantsbuild/pants/pull/20231
🙏 1
b
Thank you!