Chapter 4. Container images with Rust Toolset

Rust Toolset is available as container images for Red Hat Enterprise Linux 7 and Red Hat Enterprise Linux 8. Container images can be downloaded from the Red Hat Container Registry.

4.1. Image contents

The Red Hat Enterprise Linux 7 and Red Hat Enterprise Linux 8 container images provide content corresponding to the following packages:

ComponentVersionPackage

Rust

1.45.2

rust-toolset-1.45-1.45.2

4.2. Accessing the images

To pull the image, run the following command as root:

  • For the Red Hat Enterprise Linux 7 container images:
# podman pull registry.redhat.io/devtools/rust-toolset-rhel7
  • For the Red Hat Enterprise Linux 8 container images:
# podman pull registry.redhat.io/rhel8/rust-toolset

4.3. Using as builder images with Source-to-Image

The Rust Toolset container image is prepared for use as a Source-to-Image (S2I) builder image in Red Hat Enterprise Linux 7. Source-to-Image is not supported on Red Hat Enterprise Linux 8.

Example 4.1. Building a Rust application image using Source-to-Image

To build the rust-test-app from its GitHub repository, complete the following steps.

Prerequisites

  • Run the following commands to prepare the builder image:
 $ git clone https://github.com/openshift-s2i/s2i-rust.git
 $ cd s2i-rust
 $ make build

Procedure

Use the s2i tool to build the rust-test-app by running the following command:

s2i build ./examples/test-app/ devtools/rust-toolset-rhel7 rust-test-app

To run the image, type the following into the command line:

$ docker run rust-test-app

A locally available application image rust-test-app is built using the Rust Toolset container image.

To fully leverage the Rust as a S2I builder image, build custom images based on it, with modified S2I assemble scripts and further modifications to accomodate the particular application being built.

A detailed description of the Rust usage with Source-to-Image is beyond the scope of this document. For more information about Source-to-Image, see:

4.4. Additional resources