This is a cache of https://docs.openshift.com/dedicated/3/dev_guide/migrating_applications/S2I_tool.html. It is a snapshot of the page at 2024-11-21T05:02:17.549+0000.
S2I Tool - Migrating Applications | Developer Guide | OpenShift Dedicated 3
×

Overview

The Source-to-Image (S2I) tool injects application source code into a container image and the final product is a new and ready-to-run container image that incorporates the builder image and built source code. The S2I tool can be installed on your local machine without OpenShift Dedicated from the repository.

The S2I tool is a very powerful tool to test and verify your application and images locally before using them on OpenShift Dedicated.

Creating a Container Image

  1. Identify the builder image that is needed for the application. Red Hat offers multiple builder images for different languages including Python, Ruby, Perl, PHP, and Node.js. Other images are available from the community space.

  2. S2I can build images from source code in a local file system or from a Git repository. To build a new container image from the builder image and the source code:

    $ s2i build <source-location> <builder-image-name> <output-image-name>

    <source-location> can either be a Git repository URL or a directory to source code in a local file system.

  3. Test the built image with the Docker daemon:

    $ docker run -d --name <new-name> -p <port-number>:<port-number> <output-image-name>
    $ curl localhost:<port-number>