Public | Automated Build

Last pushed: 4 months ago
Short Description
docker image for running python git based projects
Full Description


Image for running python based git projects.

python projects

Should have and structure like the following:

               +-> ...
               +-> ${SRC_DIR} + (will be added to the PYTHONPATH)
                              + (main entry point, we call this in the end)

Should expose an endpoint that will be the one that we expose in docker.

Check, is a Flask app that
exposes the api in 8888 port.

You can configure the app through the "env" property in the json file, in this

PROJECT_DIR: where everything will be installed inside the container.
GIT_REPO: the repo to download.
SRC_DIR: the source folder inside the project.
APP_FILE: entry point to python application.

sample mesos application json, let's say py-docker.json (see doc/mesos/)

          "id": "py-docker",
          "instances": 1,
          "cpus": 1,
          "mem": 100,
          "constraints": [["hostname", "UNIQUE", ""]],
          "env": {
              "PROJECT_DIR": "/usr/local/pyenv",
              "GIT_REPO": "",
              "SRC_DIR": "rest_api_demo",
              "APP_FILE": ""
          "container": {
            "type": "DOCKER",
            "docker": {
              "image": "periket2000/py_docker",
              "network": "BRIDGE",
              "portMappings": [
                  "containerPort": 8888,
                  "hostPort": 0,
                  "servicePort": 0,
                  "protocol": "tcp"
          "healthChecks": [
                "protocol": "HTTP",
                "portIndex": 0,
                "path": "/api",
                "gracePeriodSeconds": 5,
                "intervalSeconds": 20,
                "maxConsecutiveFailures": 3

Sample load on mesos

curl -X POST http://<marathon_host>:<marathon_port>/v2/apps -d @<file> -H "Content-type: application/json"
curl -X POST -d @app.json -H "Content-type: application/json"

How to run it in local (requires docker)

git clone
cd py_docker
docker build -t mytag .
docker run -p 8888:8888 mytag

and point your browser to "http://localhost:8888/api"

Docker Pull Command
Source Repository

Comments (0)