-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
osc exec, Docker images and Software Collections #2001
Comments
osc exec uses the container's configured path, which I'm guessing in this case doesn't include the SCL locations. We'll have to think about ways to handle this. Sent from my iPhone
|
And I would also guess you'll see the same behavior with docker exec - can you try and report back? Sent from my iPhone
|
@ncdc yes yes, it's the very same thing with You're also right to the point with SCL. Enabling it changes the PATH, making new binaries available or take precedence over others from I don't know what would be the best way to do that, but one possibility I see would be appending the path to the appropriate SCL binaries in |
sclorg/s2i-base-container#35 solved this partially. SCL now is automatically enabled as long as you wrap commands with
|
In https://github.com/ncoghlan/rf-apitest/blob/master/Dockerfile (which installs the upstream SCL directly) I handled this for the main command by using ENTRYPOINT to always enable the SCL, and then CMD to run the desired operation. This handles |
@ncoghlan any reason you preferred that over the approach in sti-base? In sti-base we set a few env vars that are picked up by bash to make it enable SCL by sourcing a file.
|
Why would I do that when ENTRYPOINT natively handles the use case? I'm OK with needing to enable the SCL manually under exec, since that lets me choose whether to access the system Python or the SCL one. |
Still today we need to be aware of SCL and whether it is enabled or not. This issue has driven us to implement mechanisms to give a better user experience. Today, wrapping commands through I don't think we can do much better than that unless there would be a way to enable SCL globally and permanently. Before I close this, @hhorak would it be reasonable to have SCLs globally enabled as a feature request? |
There are ways (that are sometimes risky and thus not recommended officially) to enable Software Collections globally by having a file in However, as you can expect, this mechanism depends on the same apparatus as we use already -- shell needs to read Going one step back, the software collections is a concept that is build on this basic thing: we need to change environment variables by some logic (the variables content is not static). So, enabling a collection permanently in container means being able to change environment in the image by some logic. If we can make something like this to work:
... then we would do make it happen. However, something like that doesn't work in Dockerfile. Anyway, the all above was to explain why I don't see anything we can do better right now. That doesn't mean somebody else can't find a better way though :) |
Summarizing my brainstorming with @hhorak on IRC earlier today:
With the lack of much viable improvements in the short term, I'm closing this. |
tl;dr: Couldn't we somehow build the images in such a way that the appropriate Software Collections that it uses are enabled globally?
I noticed that the Docker images we use that leverage SCL have a shortcoming when trying to use what might be the main software binaries the image was meant for.
After setting up a working environment with the sample-app, one might want to run a command in a container. Running a simple command like
date
works just fine:$ osc exec -p frontend-1-8zeyh -c ruby-helloworld -- date Thu Apr 30 09:09:54 UTC 2015
But to run
ruby
in a Ruby Image:The same for databases:
Couldn't we somehow build the images in such a way that the appropriate Software Collections that it uses are enabled globally?
As a consequence, this would enable us to simplify our
.sti/*
scripts, removing the need to enable SCL in each script, and, most importantly, would make it easier for users to customize their scripts, focusing on functionality rather than having to know and care about SCL.For instance, a
.sti/run
script for a Python project could be as simple as:As a reference, the behavior I'm looking for matches that of the official Ruby image from Docker Hub:
The text was updated successfully, but these errors were encountered: