Motivated by [a problem on stackoverflow](), where the user's Dockerfile had CMD exec gunicorn .... The Python debug launcher does not strip out the exec and so the launch fails.
Normally this is somewhat self-evident from the logs:
Waiting for deployments to stabilize...
- pods: waiting for init container install-python-debug-support to start
- pod/python3: waiting for init container install-python-debug-support to start
- pods: container python3-web terminated with exit code 1
- pod/python3: container python3-web terminated with exit code 1
> [python3 python3-web] time="2022-03-08T15:24:02Z" level=warning msg="unable to determine launcher: could not find launcher \"exec\": exec: \"exec\": executable file not found in $PATH"
> [python3 python3-web] time="2022-03-08T15:24:02Z" level=fatal msg="error launching python debugging: exec: \"exec\": executable file not found in $PATH"
- pods failed. Error: container python3-web terminated with exit code 1.
But the logs are more hit-and-miss with the Cloud Run emulator in Cloud Code, where I usually see logs like:
Waiting for deployments to stabilize...
Deploy completed in 2.538 seconds
- deployment/t: waiting for init container install-python-debug-support to start
- pod/t-7677684866-kbrlx: waiting for init container install-python-debug-support to start
- deployment/t: container t-container terminated with exit code 1
- pod/t-7677684866-kbrlx: container t-container terminated with exit code 1
> Error retrieving logs for pod t-7677684866-kbrlx: exit status 1.
Try `kubectl logs t-7677684866-kbrlx -n default -c t-container`
- deployment/t failed. Error: container t-container terminated with exit code 1.
Strategy
We have some command-line rewriting for the Buildpacks case. This could be generalized into a set of transformations, one of which would strip off exec, and another of which might handle env A=B ... too? Or maybe recognize and error on patterns that won't work, like sh -c '...' or ... && ...
This is probably associated because people like me uses the quickstart documentation Dockerfile with that exec.
thanks @briandealwis for creating the issue
Motivated by [a problem on stackoverflow](), where the user's Dockerfile had
CMD exec gunicorn ...
. The Python debug launcher does not strip out theexec
and so the launch fails.Normally this is somewhat self-evident from the logs:
But the logs are more hit-and-miss with the Cloud Run emulator in Cloud Code, where I usually see logs like:
Strategy
We have some command-line rewriting for the Buildpacks case. This could be generalized into a set of transformations, one of which would strip off
exec
, and another of which might handleenv A=B ...
too? Or maybe recognize and error on patterns that won't work, likesh -c '...'
or... && ...