$ docker pull registry.access.redhat.com/openshift3/python-33-rhel7
OpenShift Enterprise provides s2i enabled Python images for building and running Python applications. The Python s2i builder image assembles your application source with any required dependencies to create a new image containing your Python application. This resulting image can be run either by OpenShift Enterprise or by Docker.
This image comes in two flavors, depending on your needs:
RHEL 7
CentOS 7
RHEL 7 Based Image
The RHEL 7 image is available through Red Hat’s subscription registry using:
$ docker pull registry.access.redhat.com/openshift3/python-33-rhel7
CentOS 7 Based Image
This image is available on DockerHub. To download it:
$ docker pull openshift/python-33-centos7
To use these images, you can either access them directly from these image registries, or push them into your OpenShift Enterprise Docker registry. Additionally, you can create an image stream that points to the image, either in your Docker registry or at the external location. Your OpenShift Enterprise resources can then reference the ImageStream. You can find example image stream definitions for all the provided OpenShift Enterprise images.
The Python image supports a number of environment variables which can be set to control the configuration and behavior of the Python runtime.
To set these environment variables, you can place them into
a .sti/environment file
inside your source code repository, or define them in
the environment
section of the build configuration’s sourceStrategy
definition.
Variable name | Description |
---|---|
|
This variable specifies the file name passed to the python interpreter which is responsible for launching the application. This variable is set to app.py by default. |
|
This variable specifies the WSGI callable. It follows the pattern
|
|
This variable indicates the path to a valid Python file with a gunicorn configuration. |
|
Set it to a nonempty value to inhibit the execution of |
|
Set it to a nonempty value to inhibit the execution of |
Hot deployment allows you to quickly make and deploy changes to your application without having to generate a new s2i build. If you are using Django, hot deployment works out of the box.
To enable hot deployment while using Gunicorn, ensure you have a Gunicorn
configuration file inside your repository with
the
reload
option set to true. Specify your configuration file using the
APP_CONFIG
environment variable. For example, see the
oc new-app
command. You can use the
oc env
command to update environment variables of existing objects.
You should only use this option while developing or debugging; it is not recommended to turn this on in your production environment. |
To change your source code in a running pod, use the
oc rsh
command to enter the container:
$ oc rsh <pod_id>
After you enter into the running container, your current directory is set to /opt/app-root/src, where the source code is located.