Comments (19)
Confirmed that if entrypoint is meant to allow enabling of SCL, it isn't working on CentOS images either.
$ oc rsh wsgi-hello-world-1-rqiy2 python -V
Python 2.7.5
$ oc rsh wsgi-hello-world-1-rqiy2 bash -c 'python -V'
Python 2.7.8
I might also add that I think the nss_wrapper setup should be in an entry point script as well so that that activation is also done. This way when someone does oc rsh
and gets a bash script, the nss_wrapper stuff behaves like it would when application is running and have equivalent environment when debugging.
This is how I described it is better done in:
It works better that way.
FWIW. So far my experiments sort of showed that S2I builder wipes out any ENTRYPOINT in the base images. I need to confirm that but can't do so right now due to broken Internet.
from s2i-python-container.
Ignore this.
Is me forgetting that oc rsh
or oc exec
is not the same as docker run
in as much as rsh
and exec
bypass ENTRYPOINT
. Only run
uses the ENTRYPOINT
.
from s2i-python-container.
Does oc rsh
not run a bash shell? @mfojtik @bparees?
from s2i-python-container.
$ oc help rsh
Open a remote shell session to a container
This command will attempt to start a shell session in the specified pod. It will default to the
first container if none is specified, and will attempt to use '/bin/bash' as the default shell.
You may pass an optional command after the pod name, which will be executed instead of a login
shell. A TTY will be automatically allocated if standard input is interactive - use -t and -T
to override.
Note, some containers may not include a shell - use 'oc exec' if you need to run commands
directly.
from s2i-python-container.
Right. So that means you need to rsh, and then start python in order to get python from SCL
from s2i-python-container.
but I thought @mfojtik 's PROMPT_COMMAND magic was supposed to setup the scl enablement for cases like this... @mfojtik ?
from s2i-python-container.
@bparees my magic is weak if rsh
use something else than bash.
from s2i-python-container.
@mfojtik I would have assumed it does use bash... but likely via a /bin/sh symlink to /bin/bash, so perhaps that changes the behavior?
this is definitely an issue imho if oc rsh into our images does not scl enable the right thing.
from s2i-python-container.
@bparees I think PROMPT_COMMAND
is taken into account everytime you have interactive shell that does have PS1
set. I need to check what does rsh
do, maybe it invokes /bin/sh
which is restricted shell that does not support PROMPT_COMMAND
. Long term, we should get rid of this 'hack' and have a way to enable SCL everywhere with one simple configuration setting.
from s2i-python-container.
seems to work ok for me in the 3.4 image:
$ oc rsh django-ex-1-qenm0
bash-4.2$ python --version
Python 3.4.2
from s2i-python-container.
oc exec does not work, unsurprisingly:
$ oc exec django-ex-1-qenm0 "python --version"
exec: "python --version": executable file not found in $PATH
error: error executing remote command: Error executing command in container: Error executing in Docker Container: -1
from s2i-python-container.
so nm, i think we're ok here with a known limitation on directly running commands in the container.
from s2i-python-container.
@bparees because you invoke the binary directly, bypassing bash
from s2i-python-container.
yes i know, hence my statement of "unsurprisingly" :)
from s2i-python-container.
We could theoretically change rsh to run the command through bash -c. Not sure if that would have any risks.
from s2i-python-container.
among other things it would mean rsh would only work on images w/ bash. or would need special logic to check if bash was present.
from s2i-python-container.
Your oc exec
wouldn't have worked because you quoted the full command and so it was taking it as the actual executable to run. Use:
oc exec django-ex-1-qenm0 python --version
and it would run and use system Python and not SCL Python.
The oc rsh
is effectively equivalent when you give it a command:
oc rsh django-ex-1-qenm0 python --version
The only difference is that oc rsh
automatically attaches the tty and stdin.
from s2i-python-container.
I ran into a few use cases where scl_enable threw me off.
- Extending the s2i image and running python/pip results in the wrong version being used. A workaround is /bin/bash -c "python" but it's not immediately clear why this is needed.
- It makes a lot of sense to me to use docker for local development. IMO it's far easier and more shareable than doing development with s2i images or without docker. It's actually not so hard to reuse/extend the s2i python image and use it like this however the need to explicitly run bash again threw me off initially.
IMO the ability to run commands like a "normal" docker image would make s2i more accessible - especially so for people who are already familiar with Docker.
from s2i-python-container.
@hhorak fyi.
from s2i-python-container.
Related Issues (20)
- Streamlit Update HOT 1
- No Action Required !! Testing automation workflow HOT 1
- No Action Required !! Testing automation workflow HOT 4
- Remove verification of installed packages HOT 3
- 3.9 Readme Instructions unclear HOT 6
- Python 3.10 RHEL image missing in RHEL Container catalog? HOT 4
- Unable to build a Python image from scratch on MacOS HOT 1
- Python 3.9+ for Centos 7 docker images HOT 4
- tests: test case should fail early when the prepare function fails HOT 3
- Distgen errors HOT 11
- Incorrect py-3 image HOT 11
- Support gunicorn >=20.1.0 defaults (do not require APP_ environment variables) HOT 1
- Add RHEL images for Python 3.11 HOT 4
- ERROR: No matching distribution found for numpy==1.19.2 HOT 4
- Use PIP_INDEX_URL with pipenv HOT 1
- ubi9/python-311:latest is using python3.9-rpm HOT 2
- Publish arm64 images HOT 8
- rh-python38 failed on `'npm-virtualenv-uwsgi-test-app' run_s2i_build` & `'pin-pipenv-version-test-app' run_s2i_build` HOT 2
- python311-devel not found by microdnf in python 3.11 minimal EL8 and C9s variants HOT 1
- Documented pull example quay.io/sclorg/python-39-minimal isn't a valid URL HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from s2i-python-container.