On Fri, Mar 4, 2016 at 5:03 AM, Candide Kemmler <[email protected]>
wrote:

> Thanks, I'm still pulling my hair with this. I have at least tried a dozen
> combinations without success.
>
> So what I'm trying to do is to put a modified version of one of the xPaas
> images on the registry. All this translates to is actually copying a file
> to a container and make it so that the result is accessible from the local
> registry again.
>
> The closest I got to succeeding was with the following BuildConfig:
>
> - apiVersion: v1
>   kind: BuildConfig
>   metadata:
>     creationTimestamp: null
>     labels:
>       app: flx-container
>     name: flx-container
>   spec:
>     output:
>       to:
>         kind: ImageStreamTag
>         name: flx-container:latest
>     resources: {}
>     source:
>       type: Dockerfile
>       dockerfile: "FROM
> registry.access.redhat.com/jboss-webserver-3/webserver30-tomcat7-openshift:1.2\nRUN
> <http://registry.access.redhat.com/jboss-webserver-3/webserver30-tomcat7-openshift:1.2%5CnRUN>
> mkdir /home/jboss/flx\nCOPY GeoLiteCity.dat /home/jboss/flx"
>     strategy:
>       type: Docker
>
> But it's failing as it can't find the file I want to copy:
>
> ```
> Step 2 : COPY GeoLiteCity.dat /home/jboss/flx
> F0304 09:42:04.559326 1 builder.go:59] Build error: GeoLiteCity.dat: no
> such file or directory
> ```
>
>
​The build is not performed on your local machine, so if you are going to
reference files in your Dockerfile definition, you need to somehow provide
them to openshift at build time.  Your options for doing that are:

1) provide a git repository that contains them
2) provide an image source input that contains them
3) use a binary type build and stream the files in when you start the
build.​



> This has thus become my problem: how do I make this file available to my
> build. Really, this should not be so difficult and I don't understand why
> it's not seeing the file that's in the directory where the command is
> executing. I don't understand why you are not providing a way to just
> specify a Dockerfile in a file either: inlining with \n's is kind of
> cumbersome. Also I noticed that the yaml | (pipe) syntax, which would at
> least allow for having newlines and a more legible result, is not supported
> by oc's yaml parser.
>
> So I checked the other two available source types, namely Binary Source
> and Image Source:
>
> 1/ Binary Source
>
> First the documentation here is really confusing:
>
> > the *asFile* field specifies the name of a file that will be created
> with the binary contents.
>
> ??? what does that mean? that the binary content (which?) will somehow
> create a file?
>

> > If the optional *dockerfile* field is provided, it should be a string
> containing an inline Dockerfile that potentially replaces one within the
> contents of the binary archive.
>
> OK so that seems to indicate that it is possible to specify a dockerfile
> inside the archive, right?
>
>
​yes, but you don't want to set "asFile" to true.  asFile means we won't
attempt to extract the content you provided even if it's an archive.

You want to create a BuildConfig w/ strategy Docker and source type binary,
and then invoke "oc start-build --from-dir ." where directory "." contains
your Dockerfile and your file.

​



> So I tried to create a zip archive with both my Dockerfile and the file I
> would like to be copied and to specify this as the asFile parameter...
>
> However, the process just hung saying that it was trying to get input from
> STDIN using my zip as input which, again, makes no sense to me:
>
> `Receiving source from STDIN as file arc.zip`
>
> 2/ Image Source
> OK so again, my goal is simply to copy a file to to the container. You
> tell me that I can use an existing image and the build will copy files from
> one image to another. So I did that, created a centos image with my file in
> it and pushed that to dockerhub. Only it looks like the build can only use
> images that are in the local registry:
>
> > from:
> >      kind: ImageStreamTag
> >      name: myotherinputimage:latest
> >      namespace: myothernamespace
>
>

​no, you can use dockerhub images, but the "kind" will be "DockerImage" and
the name will be the dockerhub pull spec.

Or you can create an ImageStream for the dockerhub image and then reference
it via an ImageStreamTag.
​



> And now I am stuck with figuring out how to get my docker image to the
> local registry.
>
> Giving up for now.
>
>
>
> On 04 Mar 2016, at 01:40, Ben Parees <[email protected]> wrote:
>
>
>
> On Thu, Mar 3, 2016 at 2:49 PM, Candide Kemmler <[email protected]>
> wrote:
>
>> Thank you for the help. I have tried to build a new docker image. After
>> much trials and errors, I'm hitting a road bump:
>>
>> Here's my template:
>>
>> https://gist.github.com/ckemmler/7397b12a5dd67635cd0a
>>
>> When I run it I get:
>>
>> Error from server: resource: required value
>>
>> I can't figure out what this means.
>>
>> hint: it would be nice to have complete examples of the different types
>> of build in the documentation - it is generally great but it's sometimes
>> frustrating to have to reassemble the puzzle from various parts of the docs
>> when a working example would be a lot more straightforward
>>
>
> ​There's a full buildconfig defined in the docs, along w/ the specific
> bits for each strategy:
>
> https://docs.openshift.org/latest/dev_guide/builds.html#defining-a-buildconfig
>
> producing full buildconfigs for each strategy would be lengthy and
> redundant.
>
> we also have examples in the origin repo:
>
> https://github.com/openshift/origin/tree/master/examples/sample-app
>
> in your case, you are missing the Strategy section in your buildconfig.
> I'm not sure why the error message is not clearer, we'll have to check into
> that.
>
> ​
>
>
>>
>> On 03 Mar 2016, at 15:35, Ben Parees <[email protected]> wrote:
>>
>> (sorry I said EAP a few times in there, I realize you're using the JWS
>> image at the moment.  doesn't change the response though)
>>
>>
>> On Thu, Mar 3, 2016 at 9:34 AM, Ben Parees <[email protected]> wrote:
>>
>>>
>>>
>>> On Thu, Mar 3, 2016 at 9:20 AM, Candide Kemmler <[email protected]
>>> > wrote:
>>>
>>>> Mainly I have a multi-gb file that needs to be available to my webapp.
>>>> Copying it over with each build is a lot of unnecessary bandwidth use and
>>>> considerably slows down the process. Other binaries include a custom
>>>> datastore <https://github.com/BodyTrack/datastore>.
>>>>
>>>>
>>> ​you could certainly add a layer to the EAP image that includes this
>>> binary file.  You can do that using a docker-type build in openshift, which
>>> will (by default) push the resulting image to the openshift registry.  Then
>>> you can reference your customized EAP builder image from the openshift
>>> registry, thus avoiding the redistribution question.
>>> ​
>>>
>>>
>>>
>>>> I'm suddenly nervous that deploying our code with the provided xPaas
>>>> images would/is subject to a license agreement (and we have none so far).
>>>> My assumption was that since it comes with Openshift Origin it would be
>>>> free to use just like the platform it runs on...
>>>>
>>>
>>> If you prefer to avoid this issue (which is still evolving), you can use
>>> our wildfly image instead:
>>>
>>> https://github.com/openshift/sti-wildfly/
>>> ​
>>>
>>>
>>>
>>>>
>>>> On 03 Mar 2016, at 15:13, Kevin Conner <[email protected]> wrote:
>>>>
>>>>
>>>> On 2 Mar 2016, at 09:53, Ben Parees <[email protected]> wrote:
>>>>
>>>> Is there a central place where Dockerfile for those images can be
>>>> found, or alternatively are these images available to serve as a base image
>>>> to start off from?
>>>>
>>>> It is unclear to me where Openshift Origin is fetching the containers
>>>> from (e.g. jboss-webserver30-tomcat7-openshift) and if it is possible to
>>>> fetch them from that same source to expand on them and push them to e.g.
>>>>  docker.io.
>>>>
>>>>
>>>> We do not yet publish the source for these images since they contain
>>>> information related to our build environment but this is something we are
>>>> working on addressing.  You shouldn’t need the docker source to achieve
>>>> what you are after, everything would be in the image that you download from
>>>> the registry.  We already support the addition on various binaries through
>>>> the S2I process, can I ask what binaries you are wanting to include and why
>>>> you prefer to create your own image?
>>>>
>>>> As for the ability to push the images to dockerhub I would imagine that
>>>> would be covered by any licensing agreement you have with us and
>>>> redistribution may not be allowed.  I’m not a lawyer so cannot  provide a
>>>> definitive answer, I would suggest you raise this question through the
>>>> support channels so that they can provide you with an official, documented
>>>> response.
>>>>
>>>> Kev
>>>>
>>>> --
>>>> JBoss by Red Hat
>>>>
>>>>
>>>>
>>>
>>>
>>> --
>>> Ben Parees | OpenShift
>>>
>>>
>>
>>
>> --
>> Ben Parees | OpenShift
>>
>>
>>
>
>
> --
> Ben Parees | OpenShift
>
>
>


-- 
Ben Parees | OpenShift
_______________________________________________
users mailing list
[email protected]
http://lists.openshift.redhat.com/openshiftmm/listinfo/users

Reply via email to