On Wed, Feb 7, 2018 at 6:59 AM, Dan Pungă <dan.pu...@gmail.com> wrote:
> Hello all! > I've recently discovered and join this mailing list; hope I'm in the right > place. > I'm new to the OShift ecosystem, currently trying to develop a > configuration to containerize some apps. I'm using minishift local cluster > on a Ubuntu 16.04 machine (details below). > > I want to write a parametrized yaml template to configure the build > process for my layers (those with a dockerStrategy) with using(or, better > said connecting to ) the arguments defined in my Dockerfiles. I have found > that OShift doesn't support ARG instructions prior to the FROM one when it > reads the Dockerfile. > you sure even docker supports that? It's not working for me: this works (just using an arg generically and echoing it out): $ cat Dockerfile FROM centos ARG OS_name="centos" RUN echo $OS_name RUN exit 1 $ docker build --build-arg OS_name=centos . Sending build context to Docker daemon 2.048 kB Step 1/4 : FROM centos ---> ff426288ea90 Step 2/4 : ARG OS_name="centos" ---> Using cache ---> 59f6494cb002 Step 3/4 : RUN echo $OS_name ---> Running in 092e2600490e *centos* ---> 8a3f570a033c Removing intermediate container 092e2600490e Step 4/4 : RUN exit 1 ---> Running in 543cefc9eab8 The command '/bin/sh -c exit 1' returned a non-zero code: 1 This does not (not even referencing the arg in my FROM, just putting the ARG before FROM): $ cat Dockerfile ARG OS_name="centos" FROM centos RUN echo $OS_name RUN exit 1 $ docker build --build-arg OS_name=centos . Sending build context to Docker daemon 2.048 kB Step 1/4 : ARG OS_name="centos" Please provide a source image with `from` prior to commit So i think this is a docker restriction, not an openshift one. So, even if a docker build would run successfully with something like: > > ARG OS_name="centos" > ARG OS_version="6.8" > > FROM ${OS_name}:${OS_version} > #....rest of Dockerfile instructions... > > if I try to define in my yaml config > strategy: > dockerStrategy: > buildArgs: > - name: OS_name > value: "7" > > the build process does not work. > > Has anyone else come across this issue and how did you get around it? What > I'm trying to achieve is single configuration structure for multiple > versions, so I wouldn't have to write separate Docker configs for different > app versions. For example building a Java JRE layer on top of different OSs > with one file. > Thank you, > Dan > > PS: The closest thread regarding this issue that I've found in the archive > is https://lists.openshift.redhat.com/openshift-archives/ > users/2017-January/msg00104.html > > Running env details: > > oc version > oc v3.6.0+c4dd4cf > kubernetes v1.6.1+5115d708d7 > features: Basic-Auth GSSAPI Kerberos SPNEGO > > Server https://192.168.99.100:8443 > openshift v3.6.0+c4dd4cf > kubernetes v1.6.1+5115d708d7 > ========= > > docker@minishift:~$ docker version > Client: > Version: 1.12.3 > API version: 1.24 > Go version: go1.6.3 > Git commit: 6b644ec > Built: Wed Oct 26 23:26:11 2016 > OS/Arch: linux/amd64 > > Server: > Version: 1.12.3 > API version: 1.24 > Go version: go1.6.3 > Git commit: 6b644ec > Built: Wed Oct 26 23:26:11 2016 > OS/Arch: linux/amd64 > > > _______________________________________________ > users mailing list > users@lists.openshift.redhat.com > http://lists.openshift.redhat.com/openshiftmm/listinfo/users > > -- Ben Parees | OpenShift
_______________________________________________ users mailing list users@lists.openshift.redhat.com http://lists.openshift.redhat.com/openshiftmm/listinfo/users