1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-05 12:46:18 +01:00
Files
openshift-docs/modules/developer-cli-odo-ref-build-images.adoc

25 lines
1.2 KiB
Plaintext

:_content-type: REFERENCE
[id="odo-build-images_{context}"]
= odo build-images
`odo` can build container images based on Dockerfiles, and push these images to their registries.
When running the `odo build-images` command, `odo` searches for all components in the `devfile.yaml` with the `image` type, for example:
[source,yaml]
----
components:
- image:
imageName: quay.io/myusername/myimage
dockerfile:
uri: ./Dockerfile <1>
buildContext: ${PROJECTS_ROOT} <2>
name: component-built-from-dockerfile
----
<1> The `uri` field indicates the relative path of the Dockerfile to use, relative to the directory containing the `devfile.yaml`. The devfile specification indicates that `uri` could also be an HTTP URL, but this case is not supported by odo yet.
<2> The `buildContext` indicates the directory used as build context. The default value is `+${PROJECTS_ROOT}+`.
For each image component, odo executes either `podman` or `docker` (the first one found, in this order), to build the image with the specified Dockerfile, build context, and arguments.
If the `--push` flag is passed to the command, the images are pushed to their registries after they are built.