<div dir="ltr">Hello Charles,<div><br></div><div>I've tried it before and failed too, because minishift/Openshift uses an older version of Docker that does not support multi-stage builds:</div><div><br></div><div>````</div><div>$ eval $(minishift docker-env)</div><div><span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">$</span> docker version</div><div>Client:</div><div> Version:      18.03.1-ce</div><div> API version:  1.24 (downgraded from 1.37)</div><div> Go version:   go1.9.5</div><div> Git commit:   9ee9f40</div><div> Built:        Thu Apr 26 07:13:02 2018</div><div> OS/Arch:      darwin/amd64</div><div> Experimental: false</div><div> Orchestrator: swarm</div><div><br></div><div>Server:</div><div> Engine:</div><div>  Version:      <b>1.12.6</b></div><div>  API version:  1.24 (minimum version )</div><div>  Go version:   go1.6.4</div><div>  Git commit:   78d1802</div><div>  Built:        Wed Jan 11 00:23:16 2017</div><div>  OS/Arch:      linux/amd64</div><div>  Experimental: false </div><div>````</div><div><br></div><div>I have not tried it yet, but maybe <a href="https://github.com/projectatomic/buildah">https://github.com/projectatomic/buildah</a> could help since it supports multi-stage builds since V1.0 (<a href="https://github.com/projectatomic/buildah/releases/tag/V1.0">https://github.com/projectatomic/buildah/releases/tag/V1.0</a> / <span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><a href="https://github.com/projectatomic/buildah/pull/495">https://github.com/projectatomic/buildah/pull/495</a>)</span>. So you may be able to build and push with Buildah without having to use the Docker daemon running on OpenShift (again, this is just assumptions, it needs to be verified)</div><div><br></div><div>Also, I found this PR (<a href="https://github.com/openshift/imagebuilder/pull/59">https://github.com/openshift/imagebuilder/pull/59</a>), so you may want to give a try to <a href="https://github.com/openshift/imagebuilder">https://github.com/openshift/imagebuilder</a> - although it's still apparently in beta for now.</div><div><br></div><div>HTH.</div><div><br></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jun 21, 2018 at 11:31 AM, Charles Moulliard <span dir="ltr"><<a href="mailto:cmoullia@redhat.com" target="_blank">cmoullia@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi<div><br></div><div>Is there a trick to be able to do a multi stages build using docker 17.x running in minishift [1] ?</div><div><br></div><div>E.g. Dockerfile to be processed</div><div><br></div><div><div>FROM golang:1.9.4 as builder</div><div>..</div><div># Build and test the API code</div><div>RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o controller-manager ./cmd/controller-manager/main.<wbr>go</div><div>RUN go test ./pkg/... ./cmd/...</div><div><br></div><div># Copy the controller-manager into a thin image</div><div>FROM ubuntu:latest</div><div>WORKDIR /root/<br></div><div>COPY --from=builder /go/src/<a href="http://github.com/cmoulliard/my-controller/controller-manager" target="_blank">github.com/cmoulliard/<wbr>my-controller/controller-<wbr>manager</a> .</div><div><br></div><div>Docker reports this error :</div><div><br></div><div><div>docker build . -f Dockerfile.controller -t <a href="http://gcr.io/kubeships/controller-manager:v1" target="_blank">gcr.io/kubeships/controller-<wbr>manager:v1</a></div><div>Sending build context to Docker daemon    246MB</div><div>Step 1/23 : FROM golang:1.9.4 as builder</div><div>Error parsing reference: "golang:1.9.4 as builder" is not a valid repository/tag: invalid reference format</div></div><div><br></div></div><div>[1] <a href="https://docs.docker.com/develop/develop-images/multistage-build/" target="_blank">https://docs.docker.com/<wbr>develop/develop-images/<wbr>multistage-build/</a></div><div><br></div><div>Regards</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>Charles<br><div><div class="m_-735616381368348509gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div style="color:rgb(0,0,0);font-family:overpass,sans-serif;font-size:10px"><div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>
</div></font></span></div>
<br>______________________________<wbr>_________________<br>
Container-tools mailing list<br>
<a href="mailto:Container-tools@redhat.com">Container-tools@redhat.com</a><br>
<a href="https://www.redhat.com/mailman/listinfo/container-tools" rel="noreferrer" target="_blank">https://www.redhat.com/<wbr>mailman/listinfo/container-<wbr>tools</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Best regards,<div>/Xavier</div></div></div>
</div>