Python 3.5 Docker image

This container image includes Python 3.5 as a S2I base image for your Python 3.5 applications. Users can choose between RHEL and CentOS based builder images. The RHEL image is available in the Red Hat Container Catalog as registry.access.redhat.com/rhscl/python-35-rhel7. The CentOS image is then available on Docker Hub as centos/python-35-centos7. The resulting image can be run using Docker.

Description

Python 3.5 available as docker container is a base platform for building and running various Python 3.5 applications and frameworks. Python is an easy to learn, powerful programming language. It has efficient high-level data structures and a simple but effective approach to object-oriented programming. Python’s elegant syntax and dynamic typing, together with its interpreted nature, make it an ideal language for scripting and rapid application development in many areas on most platforms.

Usage

To build a simple python-sample-app application using standalone S2I and then run the resulting image with Docker execute:

Accessing the application:

$ curl 127.0.0.1:8080

Environment variables

To set these environment variables, you can place them as a key value pair into a .s2i/environment file inside your source code repository.

Source repository layout

You do not need to change anything in your existing Python project’s repository. However, if these files exist they will affect the behavior of the build process:

Run strategies

The Docker image produced by s2i-python executes your project in one of the following ways, in precedence order:

Hot deploy

If you are using Django, hot deploy will work out of the box.

To enable hot deploy while using Gunicorn, make sure you have a Gunicorn configuration file inside your repository with the reload option set to true. Make sure to specify your config via the APP_CONFIG environment variable.

To change your source code in running container, use Docker’s exec command:

docker exec -it <CONTAINER_ID> /bin/bash

After you enter into the running container, your current directory is set to /opt/app-root/src, where the source code is located.

See also

Dockerfile and other sources are available on https://github.com/sclorg/s2i-python-container. In that repository you also can find another versions of Python environment Dockerfiles. Dockerfile for CentOS is called Dockerfile, Dockerfile for RHEL is called Dockerfile.rhel7.