Create and use custom images

Overview

The developer images provided with OpenShift Dev Spaces are examples that comprise typical stacks of development tools which cover common development scenarios. However, no development organization or project is the same and there is always a need to add, swap out, or remove tools for different teams and project. The idea is that the teams can take the images, provide it as base images and modify or even copy the dockerfiles used to build them and adjust them.

The core developer image provided by Red Hat is called Red Hat OpenShift Dev Spaces - Universal Developer Image (UDI)open in new window. It is designed with common purpose in mind, that contains many programming languages and development technologies. It can be used as is, combined with other images running as sidecar container in parallel, or used as a base image for customization.

There are also other images available, either provided by Red Hat or the Eclipse Che community that are built for special purposes. One example is the Ansible Development Toolsopen in new window image that provides support for developing Ansible playbooks. This image is used by the Ansible stack available in the OpenShift Dev Spaces dashboard.

IBM also provides a sample image based on the UDI that adds content for z/OS development such as Zowe CLI, IBM's plugins for Zowe CLI, it's Red Hat Ansible Certified Content for IBM Z and others. The dockerfile for this image is available at https://github.com/IBM/wazi-devspaces-imagesopen in new window, so that you can see all the modifications applied. You can use it and modify it further. This same Git repository also contains an examples for a sidecar that is in parallel to the UDI, that only provides Zowe CLI and IBM's plugins. It could be combined with the UDI and the Ansible image mentioned above.

Build the sample images

To build the sample images of the https://github.com/IBM/wazi-devspaces-imagesopen in new window repository. You require an account with Red Hat that entitles you to pull base images from their registry, which you should have received with your purchase of OpenShift. Perform the following steps:

  • Create a development environment that has Docker or Podman installed and configured.

  • Clone the Git repository.

  • Log on to your Red Hat account using

    docker login registry.redhat.io
    
  • To build the full image that is based on the UDI execute

    docker build -f devspaces-sidecar/wazi.Dockerfile -t your-registry.com/your-namespace/idzee-devspaces-sidecar:5.1.0 ./devspaces-sidecar
    
  • To build the minimal image that you can use in parallel to the UDI execute

    docker build -f devspaces-sidecar-minimal/wazi.Dockerfile -t your-registry.com/your-namespace/idzee-devspaces-sidecar:5.1.0 ./devspaces-sidecar-minimal
    

Once you are able to build these sample, start to modify them by adding the tools that you need in addition to what they already provide.

Deploy the sample images

Once you have your image built, you can deploy it to your personal image registry. Follow the instructions provided. For example, if you are using OpenShift in an IBM Cloud VPC, follow these base steps:

Configure OpenShift Dev Spaces to use your personal registry

Dev Spaces users can configure a personal container registry directly from the Dev Spaces dashboard.

  1. Log on to the Dev Spaces Dashboard.
  2. In the tool bar, select your user name menu and choose "User Preferences".
  3. The first tab of the User Preferences page is label "Container Registries".
  4. Click the "Add Container Registry" button and fill in the form.
  5. For IBM Cloud registries, provide the name of your registry, "iamapikey" for the Username value, and a valid IAM api key associated with your registry account as the password.

Create a devfile with your personal image

To create a Dev Spaces workspace with your personal image, create a devfile in your Git repository that lists your image. For example,

schemaVersion: 2.3.0
metadata:
  name: idzee-devspaces

components:
  - name: zowe
    volume:
      size: 100Mi
  - name: wazi-terminal
    container:
      image: your-registry.com/your-namespace/idzee-devspaces-sidecar@sha256:your-sha
      memoryLimit: 3072Mi
      mountSources: true
      volumeMounts:
        - name: zowe
          path: /home/user/.zowe

Then you can create a workspace by providing the URL to your Git repository in the Dashboard's "Import from Git" text field.

Last Updated:
Contributors: Esther M, PETER HAUMER