|
|
85f65ff |
OpenShift base images (core variant)
|
|
|
85f65ff |
========================================
|
|
|
a544bcc |
|
|
|
85f65ff |
This repository contains Dockerfiles for images which can be used as base images
|
|
|
85f65ff |
to add support for [source-to-image](https://github.com/openshift/source-to-image)
|
|
|
85f65ff |
without installing several development libraries.
|
|
|
85f65ff |
|
|
|
85f65ff |
|
|
|
85f65ff |
Description
|
|
|
85f65ff |
--------------------------------
|
|
|
85f65ff |
OpenShift S2I images use [Software Collections](https://www.softwarecollections.org/en/)
|
|
|
85f65ff |
packages to provide the latest versions of various software.
|
|
|
85f65ff |
The SCL packages are released more frequently than the RHEL or CentOS systems,
|
|
|
85f65ff |
which are unlikely to change for several years.
|
|
|
85f65ff |
We rely on RHEL and CentOS for base images, on the other hand,
|
|
|
85f65ff |
because those are stable, supported, and secure platforms.
|
|
|
85f65ff |
|
|
|
85f65ff |
Normally, SCL requires manual operation to enable the collection you want to use.
|
|
|
85f65ff |
This is burdensome and can be prone to error.
|
|
|
85f65ff |
The OpenShift S2I approach is to set Bash environment variables that
|
|
|
85f65ff |
serve to automatically enable the desired collection:
|
|
|
85f65ff |
|
|
|
85f65ff |
* `BASH_ENV`: enables the collection for all non-interactive Bash sessions
|
|
|
85f65ff |
* `ENV`: enables the collection for all invocations of `/bin/sh`
|
|
|
85f65ff |
* `PROMPT_COMMAND`: enables the collection in interactive shell
|
|
|
85f65ff |
|
|
|
85f65ff |
Two examples:
|
|
|
85f65ff |
* If you specify `BASH_ENV`, then all your `#!/bin/bash` scripts
|
|
|
85f65ff |
do not need to call `scl enable`.
|
|
|
85f65ff |
* If you specify `PROMPT_COMMAND`, then on execution of the
|
|
|
85f65ff |
`docker exec ... /bin/bash` command, the collection will be automatically enabled.
|
|
|
85f65ff |
|
|
|
85f65ff |
*Note*:
|
|
|
85f65ff |
Executables in Software Collections packages (e.g., `ruby`)
|
|
|
85f65ff |
are not directly in a directory named in the `PATH` environment variable.
|
|
|
85f65ff |
This means that you cannot do:
|
|
|
85f65ff |
|
|
|
85f65ff |
$ docker exec <cid> ... ruby
|
|
|
85f65ff |
|
|
|
85f65ff |
but must instead do:
|
|
|
85f65ff |
|
|
|
85f65ff |
$ docker exec <cid> ... /bin/bash -c ruby
|
|
|
85f65ff |
|
|
|
85f65ff |
The `/bin/bash -c`, along with the setting the appropriate environment variable,
|
|
|
85f65ff |
ensures the correct `ruby` executable is found and invoked.
|
|
|
85f65ff |
|
|
|
85f65ff |
|
|
|
85f65ff |
Usage
|
|
|
85f65ff |
------------------------
|
|
|
85f65ff |
Choose either the CentOS7 or RHEL7 base image:
|
|
|
85f65ff |
* **RHEL7 base image**
|
|
|
85f65ff |
|
|
|
85f65ff |
To build a RHEL7 based image, you need to build it on properly subscribed RHEL machine.
|
|
|
85f65ff |
|
|
|
85f65ff |
```
|
|
|
85f65ff |
$ git clone --recursive https://github.com/sclorg/s2i-base-container.git
|
|
|
85f65ff |
$ cd s2i-base-container
|
|
|
85f65ff |
$ make build VERSIONS=core TARGET=rhel7
|
|
|
85f65ff |
```
|
|
|
85f65ff |
|
|
|
85f65ff |
* **CentOS7 base image**
|
|
|
85f65ff |
|
|
|
85f65ff |
This image is available on DockerHub. To download it run:
|
|
|
85f65ff |
|
|
|
85f65ff |
```console
|
|
|
85f65ff |
docker pull sclorg/s2i-core-centos7
|
|
|
85f65ff |
```
|
|
|
85f65ff |
|
|
|
85f65ff |
To build a Base image from scratch run:
|
|
|
85f65ff |
|
|
|
85f65ff |
```
|
|
|
85f65ff |
$ git clone --recursive https://github.com/sclorg/s2i-base-container.git
|
|
|
85f65ff |
$ cd s2i-base-container
|
|
|
85f65ff |
$ make build VERSIONS=core
|
|
|
85f65ff |
```
|
|
|
85f65ff |
|
|
|
85f65ff |
**Notice: By omitting the `VERSION` parameter, the build/test action will be performed
|
|
|
85f65ff |
on all provided versions of s2i image.**
|
|
|
85f65ff |
|
|
|
85f65ff |
|
|
|
85f65ff |
See also
|
|
|
85f65ff |
--------
|
|
|
85f65ff |
Dockerfile and other sources are available on https://github.com/sclorg/s2i-base-container.
|
|
|
85f65ff |
In that repository you also can find another variants of S2I Base Dockerfiles.
|
|
|
85f65ff |
Dockerfile for CentOS is called Dockerfile, Dockerfile for RHEL is called Dockerfile.rhel7.
|