1

Openshfit details: Paid Professional version. Version Information: enter image description here

Been trying to create a build from a Dockerfile in Openshift. Its tough going. So I tried to use the existing templates in the Cluster Console. One of which is the Docker one. When i press "Try it" it generates a sample BuildConfig, when I try to then Create it, it gives me the error: enter image description here (i have now raised the above in the Origin upstream issue tracker) Anyhoo...anyone know how to specify a buildConfig an image from a Dockerfile in a git repo? I would be grateful to know.

Will Gordon
  • 3,303
  • 2
  • 11
  • 22
Beezer
  • 1,084
  • 13
  • 18

1 Answers1

0

You can see the build strategies allowed for OpenShift Online on the product website: https://www.openshift.com/products/online. Dockerfile build isn't deprecated, it's just explicitly disallowed in OpenShift Online. You can build your Dockerfile locally and push it directly to the OpenShift internal registry (commands for docker login and docker push are on your cluster's About page).

However, in other environments (not OpenShift Online), you can specify a Dockerfile build as follows and providing a Git Repo with a Dockerfile contained within (located at BuildConfig.spec.source.contextDir)

strategy:
  type: Docker

There are additional options that can be configured for a Dockerfile build as well, outlined in https://docs.okd.io/latest/dev_guide/builds/build_strategies.html#docker-strategy-options.

Will Gordon
  • 3,303
  • 2
  • 11
  • 22
  • This is of no practical use Will. Sorry to say this. I know my options in OC without this strategy. By not allowing it, as part of a buildConfig negates a whole swathe of deployment category which are core to the requirements of an container driven platform. Thanks all the same...and just in case you want a concrete example...here is one: most Docker hub images will not out of the box run on OC. ApacheMQ for instance. So I have had to create a Dockerfile that is compliant. Now, I want to use this to specify a buildConfig which only can happen at the cluster level and is not available. – Beezer Apr 24 '19 at 08:43
  • With a compliant Dockerfile, you can `docker build` it locally, and `docker push` it directly to the cluster. – Will Gordon Apr 24 '19 at 10:59
  • Thank you. I raised the issue with Openshift Origin and they have a ticket on their backlog tracking it...albeit not at the Cluster level and instead at the project level: https://trello.com/c/6CuBSnFF/733-5-add-easy-docker-automated-build-to-add-to-project-options-build-onboarding – Beezer Apr 24 '19 at 11:26
  • Also to respond to your answer about pushing the image directly...the whole idea of a buildConfig, ImageStreams and hooks into a repo, is that I can then specify my build policies for the image(s) and the cluster as a whole, so I do not have to manually do anything...or have to script stuff. Again, _this_ is the critical point for me. I can do it manually, but that is not the point. – Beezer Apr 24 '19 at 11:29
  • Finally, and i found this in the above ticket on trello, you will see (and I will try it later) that it is possible to do it with the the CLI oc command...but again, I have not tried this yet: https://github.com/openshift/origin-web-console/issues/1399 – Beezer Apr 24 '19 at 11:32