Creating a custom image
After you have downloaded the image for the runtime that you want to customize, you can build a new custom image by adding your customizations to the downloaded image. You do this by adding your customizations to a Dockerfile.
You can build a custom image on any server or workstation running Docker, Podman or Skopeo. The custom image does not have to be created on Red Hat Enterprise Linux.
-
Add your customizations to the Dockerfile. To get started, use the provided Dockerfile sample as a basis on which to create your customized Dockerfile.
The image is built by reading the instructions from the Dockerfile. The Dockerfile takes as input the
base-image-tag
argument with the name of base image that you downloaded as its value.You should use the example commands that Dockerfile provides to add your customizations to avoid introducing a breaking change, which could prevent the new image from working in Cloud Pak for Data.
Important:
- All runtime images in Watson Studio are based on RedHat UBI minimal and use microdnf as the package manager.
-
Do not change the contents in the USER directives as they impact how the container will later run in the cluster:
- You must be
root
to install OS packages and to modify the kernel specifications - You must be
wsbuild
to modify the conda environment given by $DSX_KERNEL_CONDENV
- You must be
- You should change the display name of the kernel so that you can distinguish between custom images and those provided by Watson Studio.
- Update the Dockerfile to use the RUN commands that you need. Follow the instructions in the Dockerfile sample for how to update the RUN commands.
-
Build the new image. The command shows building a new image based on
wslocal-x86-runtime-python36:master-273
. See Accessing the registry for the value of<your_image_registry_location>
.- For Docker, enter:
docker build -t <new-image-name>:<new-image-tag> --build-arg base_image_tag= <your_image_registry_location>/wslocal-x86-runtime-python36:master-273 -f <path_to_dockerfile> .
- For Buildah, enter:
buildah bud -t <new-image-name>:<new-image-tag> --build-arg base_image_tag= <your_image_registry_location>/wslocal-x86-runtime-python36:master-273 -f <path_to_dockerfile>
Make sure that you use the correct image and directory setup.
- For Docker, enter: