[scl.org] How to use SCL inside a container
Pavel Valena
pvalena at redhat.com
Thu Oct 8 14:15:55 UTC 2020
----- Original Message -----
> From: "jonathan mercier" <jonathan.mercier at cnrgh.fr>
> To: "Zach Huntington Meath" <zhunting at redhat.com>, "Stefan Ring" <stefanrin at gmail.com>
> Cc: sclorg at redhat.com
> Sent: Thursday, July 30, 2020 12:59:41 AM
> Subject: Re: [scl.org] How to use SCL inside a container
>
> Thanks Zach and Stefan for your help
>
> Previously repository was in private mode (now they are public, a mistake…)
>
> currently my scl_metapackage image fail on test:
> https://gitlab.com/jonathan-dlang/scl_metapackage/-/pipelines/172225000
> 1. Indeed it seems that PATH and others env vars are not loaded
> 2. scl load … do not works
Hello,
the recommended way to enable scl on commandline is (like Zach send you):
$ scl enable "$my_scl" ...
or
$ scl enable "$my_scl" -- ...
F.e. you'd run:
$ scl enable rh-ruby25 bash
Also, another way, that we use for containers is:
$ . scl_source enable "$my_scl"
or
$ source scl_source enable "$my_scl"
(You should use bash or compatible shell.)
To check, whether $my_scl is enabled, you can:
$ scl_enabled "$my_scl"
I'm not aware of any other way that works.
Also please check our containers upstream:
https://github.com/sclorg/
In s2i-ruby-container, we enable it like so:
https://github.com/sclorg/s2i-ruby-container/blob/master/2.7/root/opt/app-root/etc/scl_enable
Using that approach, the SCL is enabled inside the container, for all executed commands. This is the bit that runs the scl_enable above:
https://github.com/sclorg/s2i-base-container/blob/19a440e4ebda6734dc1ed595f2acfb9269e9b584/core/Dockerfile.rhel7#L37
Note that our containers are s2i-capable (and consumable by openshift), but can be used as usual containers.
All are based on:
https://github.com/sclorg/s2i-base-container/tree/master/core
HIH,
Pavel
>
> I have any problem with these rpm on my local computer
>
> This image extends this one: https://gitlab.com/jonathan-dlang/fedora
> which define an entrypoint in order to initialize both modules and scl
>
> I will take a closer look to your code Zach
>
> Any way your help is really appreciated.
> I would like to demonstrate that scl can replace environment module into my
> lab
>
> Thanks, best regards
>
> Jonathan
>
>
>
>
>
> Le lundi 27 juillet 2020 à 14:30 -0400, Zach Huntington Meath a écrit :
>
>
>
> Jonathan,
>
> I've had some success with containers and trying to use the SCL while the
> container is running. What I've had success with is adding the script like
> you had up there to /etc/profile.d and then it'll run when any bash instance
> is started. Something like this:
> https://github.com/theforeman/forklift/blob/master/roles/ruby_scl/tasks/main.yml#L14-L20
>
> But instead of using ansible you just have your script and copy it to
> /etc/profile.d/foo.sh when you're building the container in your Dockerfile.
>
> On Mon, Jul 27, 2020 at 1:41 PM Stefan Ring < stefanrin at gmail.com > wrote:
>
>
> On Mon, Jul 27, 2020 at 12:23 PM Jonathan MERCIER < jmercier at cng.fr > wrote:
> >
> > Dear I tried to build a container both with docker and buildah and got the
> > same message error from gitlab-ci
> >
> > ---> https://gitlab.com/jonathan-dlang/scl_metapackage/-/jobs/657306213
>
> No access rights.
>
> > $ scl load "${SCL_VENDOR}-${SCL_COLLECTION}${DLANG_VERSION}"
> > 31Missing function scl in your environment!!!
> >
> > What is those scl functions ?
> >
> > We can see too that while scl_source is calld (line 28) the list of loaded
> > collection is empty (line 29)
>
> Do you know how to use scl outside of a container? Because it does not
> actually make a difference.
>
> > I tried to use a scl_enable file as it is done by sclorg ->
> > https://github.com/sclorg/mariadb-container/blob/master/root-common/usr/share/container-scripts/mysql/scl_enable
> >
> > with the same error
>
> If it’s only one line in the CI recipe, just use scl enable {scl_name}
> -- command (line).
>
--
Pavel Valena
Software Engineer, Red Hat
Brno, Czech Republic
More information about the SCLorg
mailing list