LoginSignup
0
0

More than 5 years have passed since last update.

minishift V1.28.0でDjango2を動かす①:テンプレートの確認

Last updated at Posted at 2018-12-27

はじめに

minishift V1.28.0にRed Hat Container Catalog(RHCC)にあるPython3.6のイメージを観察しつつ
S2IでDjango2のプロジェクトを動作させることを目的に試行錯誤します。

Red Hat Container Catalog(RHCC)Pythonイメージを勉強する

Red Hat Container Catalog(RHCC)にアクセスしPythonで検索
10.png
Tagsタブを表示します。
11.png
TagNameで最新版をクリックしDockerfileを確認します。
12.png

Dockerfileを覗く

Dockerfile
# This image provides a Python 3.6 environment you can use to run your Python
# applications.
FROM rhscl/s2i-base-rhel7:1

EXPOSE 8080

ENV PYTHON_VERSION=3.6 \
    PATH=$HOME/.local/bin/:$PATH \
    PYTHONUNBUFFERED=1 \
    PYTHONIOENCODING=UTF-8 \
    LC_ALL=en_US.UTF-8 \
    LANG=en_US.UTF-8 \
    PIP_NO_CACHE_DIR=off

ENV SUMMARY="Platform for building and running Python $PYTHON_VERSION applications" \
    DESCRIPTION="Python $PYTHON_VERSION available as container is a base platform for \
building and running various Python $PYTHON_VERSION 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."

LABEL summary="$SUMMARY" \
      description="$DESCRIPTION" \
      io.k8s.description="$DESCRIPTION" \
      io.k8s.display-name="Python 3.6" \
      io.openshift.expose-services="8080:http" \
      io.openshift.tags="builder,python,python36,rh-python36" \
      com.redhat.component="rh-python36-container" \
      name="rhscl/python-36-rhel7" \
      version="1" \
      usage="s2i build https://github.com/sclorg/s2i-python-container.git --context-dir=3.6/test/setup-test-app/ rhscl/python-36-rhel7 python-sample-app" \
      maintainer="SoftwareCollections.org <sclorg@redhat.com>"

RUN INSTALL_PKGS="rh-python36 rh-python36-python-devel rh-python36-python-setuptools rh-python36-python-pip nss_wrapper \
        httpd24 httpd24-httpd-devel httpd24-mod_ssl httpd24-mod_auth_kerb httpd24-mod_ldap \
        httpd24-mod_session atlas-devel gcc-gfortran libffi-devel libtool-ltdl enchant" && \
    yum install -y yum-utils && \
    prepare-yum-repositories rhel-server-rhscl-7-rpms && \
    yum -y --setopt=tsflags=nodocs install $INSTALL_PKGS && \
    rpm -V $INSTALL_PKGS && \
    # Remove redhat-logos (httpd dependency) to keep image size smaller.
    rpm -e --nodeps redhat-logos && \
    yum -y clean all --enablerepo='*'

# Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH.
COPY ./s2i/bin/ $STI_SCRIPTS_PATH

# Copy extra files to the image.
COPY ./root/ /

# - Create a Python virtual environment for use by any application to avoid
#   potential conflicts with Python packages preinstalled in the main Python
#   installation.
# - In order to drop the root user, we have to make some directories world
#   writable as OpenShift default security model is to run the container
#   under random UID.
RUN source scl_source enable rh-python36 && \
    virtualenv ${APP_ROOT} && \
    chown -R 1001:0 ${APP_ROOT} && \
    fix-permissions ${APP_ROOT} -P && \
    rpm-file-permissions

USER 1001

# Set the default CMD to print the usage of the language image.
CMD $STI_SCRIPTS_PATH/usage

usageを確認するとGitのURLが書いてありました。

usage="s2i build https://github.com/sclorg/s2i-python-container.git --context-dir=3.6/test/setup-test-app/ rhscl/python-36-rhel7 python-sample-app" \

https://github.com/sclorg/s2i-python-container.git

15.png
3.6のディレクトリを進みます。
16.png
あやしいフォルダがありましたね。s2i/binを覗きます。
17.png

s2i/bin/assembleを覗く

セットアップ時つまりBuild時は

3.6/s2i/bin/assemble
#!/bin/bash

function is_django_installed() {
  python -c "import django" &>/dev/null
}

function should_collectstatic() {
  is_django_installed && [[ -z "$DISABLE_COLLECTSTATIC" ]]
}

function virtualenv_bin() {
  if head "/etc/redhat-release" | grep -q "^Fedora"; then
    virtualenv-${PYTHON_VERSION} $1
  else
    virtualenv $1
  fi
}

# Install pipenv to the separate virtualenv to isolate it
# from system Python packages and packages in the main
# virtualenv. Executable is simlinked into ~/.local/bin
# to be accessible. This approach is inspired by pipsi
# (pip script installer).
function install_pipenv() {
  echo "---> Installing pipenv packaging tool ..."
  VENV_DIR=$HOME/.local/venvs/pipenv
  virtualenv_bin "$VENV_DIR"
  $VENV_DIR/bin/pip --isolated install -U pipenv
  mkdir -p $HOME/.local/bin
  ln -s $VENV_DIR/bin/pipenv $HOME/.local/bin/pipenv
}

set -e

shopt -s dotglob
echo "---> Installing application source ..."
mv /tmp/src/* "$HOME"

if [[ ! -z "$UPGRADE_PIP_TO_LATEST" ]]; then
  echo "---> Upgrading pip to latest version ..."
  pip install -U pip setuptools wheel
fi

if [[ ! -z "$ENABLE_PIPENV" ]]; then
  install_pipenv
  echo "---> Installing dependencies via pipenv ..."
  if [[ -f Pipfile ]]; then
    pipenv install --deploy
  elif [[ -f requirements.txt ]]; then
    pipenv install -r requirements.txt
  fi
  # pipenv check
elif [[ -f requirements.txt ]]; then
  echo "---> Installing dependencies ..."
  pip install -r requirements.txt
fi

if [[ -f setup.py && -z "$DISABLE_SETUP_PY_PROCESSING" ]]; then
  echo "---> Installing application ..."
  pip install .
fi

if should_collectstatic; then
  (
    echo "---> Collecting Django static files ..."

    APP_HOME=$(readlink -f "${APP_HOME:-.}")
    # Change the working directory to APP_HOME
    PYTHONPATH="$(pwd)${PYTHONPATH:+:$PYTHONPATH}"
    cd "$APP_HOME"

    # Look for 'manage.py' in the current directory
    manage_file=./manage.py

    if [[ ! -f "$manage_file" ]]; then
      echo "WARNING: seems that you're using Django, but we could not find a 'manage.py' file."
      echo "'manage.py collectstatic' ignored."
      exit
    fi

    if ! python $manage_file collectstatic --dry-run --noinput &> /dev/null; then
      echo "WARNING: could not run 'manage.py collectstatic'. To debug, run:"
      echo "    $ python $manage_file collectstatic --noinput"
      echo "Ignore this warning if you're not serving static files with Django."
      exit
    fi

    python $manage_file collectstatic --noinput
  )
fi

# set permissions for any installed artifacts
fix-permissions /opt/app-root

関係ありそうな大筋を辿ると
$UPGRADE_PIP_TO_LATESTが定義されていたら
 pip install -U pip setuptools wheel
requirements.txtがあったら
 pipenv install -r requirements.txt
djangoがあれば(?)
 python manage.py collectstatic --noinput

s2i/bin/runを覗く

実行時つまりPod起動時はちょっと長そうですね(笑)

3.6/s2i/bin/run
#!/bin/bash
source /opt/app-root/etc/generate_container_user

set -e

function is_gunicorn_installed() {
  hash gunicorn &>/dev/null
}

function is_django_installed() {
  python -c "import django" &>/dev/null
}

function should_migrate() {
  is_django_installed && [[ -z "$DISABLE_MIGRATE" ]]
}

# Guess the number of workers according to the number of cores
function get_default_web_concurrency() {
  limit_vars=$(cgroup-limits)
  local $limit_vars
  if [ -z "${NUMBER_OF_CORES:-}" ]; then
    echo 1
    return
  fi

  local max=$((NUMBER_OF_CORES*2))
  # Require at least 43 MiB and additional 40 MiB for every worker
  local default=$(((${MEMORY_LIMIT_IN_BYTES:-MAX_MEMORY_LIMIT_IN_BYTES}/1024/1024 - 43) / 40))
  default=$((default > max ? max : default))
  default=$((default < 1 ? 1 : default))
  # According to http://docs.gunicorn.org/en/stable/design.html#how-many-workers,
  # 12 workers should be enough to handle hundreds or thousands requests per second
  default=$((default > 12 ? 12 : default))
  echo $default
}

APP_HOME=$(readlink -f "${APP_HOME:-.}")
# Change the working directory to APP_HOME
PYTHONPATH="$(pwd)${PYTHONPATH:+:$PYTHONPATH}"
cd "$APP_HOME"

app_script_check="${APP_SCRIPT-}"
APP_SCRIPT="${APP_SCRIPT-app.sh}"
if [[ -f "$APP_SCRIPT" ]]; then
  echo "---> Running application from script ($APP_SCRIPT) ..."
  if [[ "$APP_SCRIPT" != /* ]]; then
    APP_SCRIPT="./$APP_SCRIPT"
  fi
  exec "$APP_SCRIPT"
else
  test -n "$app_script_check" && (>&2 echo "ERROR: file '$app_script_check' not found.") && exit 1
fi

app_file_check="${APP_FILE-}"
APP_FILE="${APP_FILE-app.py}"
if [[ -f "$APP_FILE" ]]; then
  echo "---> Running application from Python script ($APP_FILE) ..."
  exec python "$APP_FILE"
else
  test -n "$app_file_check" && (>&2 echo "ERROR: file '$app_file_check' not found.") && exit 1
fi

# Look for 'manage.py' in the current directory
manage_file=./manage.py

if should_migrate; then
  if [[ -f "$manage_file" ]]; then
    echo "---> Migrating database ..."
    python "$manage_file" migrate --noinput
  else
    echo "WARNING: seems that you're using Django, but we could not find a 'manage.py' file."
    echo "Skipped 'python manage.py migrate'."
  fi
fi

if is_gunicorn_installed; then
  setup_py=$(find "$HOME" -maxdepth 2 -type f -name 'setup.py' -print -quit)
  # Look for wsgi module in the current directory
  if [[ -z "$APP_MODULE" && -f "./wsgi.py" ]]; then
    APP_MODULE=wsgi
  elif [[ -z "$APP_MODULE" && -f "$setup_py" ]]; then
    APP_MODULE="$(python "$setup_py" --name)"
  fi

  if [[ "$APP_MODULE" ]]; then
    export WEB_CONCURRENCY=${WEB_CONCURRENCY:-$(get_default_web_concurrency)}

    echo "---> Serving application with gunicorn ($APP_MODULE) ..."
    exec gunicorn "$APP_MODULE" --bind=0.0.0.0:8080 --access-logfile=- --config "$APP_CONFIG"
  fi
fi

if is_django_installed; then
  if [[ -f "$manage_file" ]]; then
    echo "---> Serving application with 'manage.py runserver' ..."
    echo "WARNING: this is NOT a recommended way to run you application in production!"
    echo "Consider using gunicorn or some other production web server."
    exec python "$manage_file" runserver 0.0.0.0:8080
  else
    echo "WARNING: seems that you're using Django, but we could not find a 'manage.py' file."
    echo "Skipped 'python manage.py runserver'."
  fi
fi

>&2 echo "ERROR: don't know how to run your application."
>&2 echo "Please set either APP_MODULE, APP_FILE or APP_SCRIPT environment variables, or create a file 'app.py' to launch your application."
exit 1

APP_SCRIPTに定義があれば
 exec "$APP_SCRIPT"
APP_FILEに定義があれば
 exec python "$APP_FILE"
djangoがあれば(?) && DISABLE_MIGRATEが定義されていなければ
 python manage.py migrate --noinput
gunicornがインストールされており
 wsgi.pyがあれば
  gunicorn wsgi.py
 setup.pyがあれば、それが指し示すpyを使って
  gnuicorn setup.pyの中身
なければdjangoのrunserverで実行
といった感じでしょうか

minishift v1.28.0にバンドルされているPythonイメージで確認

20.png
ここにdjangoのサンプルgitがあるので参照します。

Sample Repository: https://github.com/openshift/django-ex.git

openshift/django-ex.gitを覗く

21.png
22.png

割とシンプルな構成ですね。
これをgit cloneしてdjango2に対応させることにしました。

openshift/templates/django.jsonを覗く

minishiftのテンプレート用jsoneはこんな感じ
ベースのイメージはpython:${PYTHON_VERSION}のようですね。

/sclorg/django-ex/master/openshift/templates/django.json
{
  "kind": "Template",
  "apiVersion": "v1",
  "metadata": {
    "name": "django-example",
    "annotations": {
      "openshift.io/display-name": "Django",
      "description": "An example Django application with no database. For more information about using this template, including OpenShift considerations, see https://github.com/sclorg/django-ex/blob/master/README.md.",
      "tags": "quickstart,python,django",
      "iconClass": "icon-python",
      "openshift.io/long-description": "This template defines resources needed to develop a Django based application, including a build configuration and application deployment configuration.  It does not include a database.",
      "openshift.io/provider-display-name": "Red Hat, Inc.",
      "openshift.io/documentation-url": "https://github.com/sclorg/django-ex",
      "openshift.io/support-url": "https://access.redhat.com",
      "template.openshift.io/bindable": "false"
    }
  },
  "labels": {
      "template": "django-example",
      "app": "django-example"
  },
  "message": "The following service(s) have been created in your project: ${NAME}.\n\nFor more information about using this template, including OpenShift considerations, see https://github.com/sclorg/django-ex/blob/master/README.md.",
  "objects": [
    {
      "kind": "Secret",
      "apiVersion": "v1",
      "metadata": {
        "name": "${NAME}"
      },
      "stringData" : {
        "django-secret-key" : "${DJANGO_SECRET_KEY}"
      }
    },
    {
      "kind": "Service",
      "apiVersion": "v1",
      "metadata": {
        "name": "${NAME}",
        "annotations": {
          "description": "Exposes and load balances the application pods"
        }
      },
      "spec": {
        "ports": [
          {
            "name": "web",
            "port": 8080,
            "targetPort": 8080
          }
        ],
        "selector": {
          "name": "${NAME}"
        }
      }
    },
    {
      "kind": "Route",
      "apiVersion": "v1",
      "metadata": {
        "name": "${NAME}"
      },
      "spec": {
        "host": "${APPLICATION_DOMAIN}",
        "to": {
          "kind": "Service",
          "name": "${NAME}"
        }
      }
    },
    {
      "kind": "ImageStream",
      "apiVersion": "v1",
      "metadata": {
        "name": "${NAME}",
        "annotations": {
          "description": "Keeps track of changes in the application image"
        }
      }
    },
    {
      "kind": "BuildConfig",
      "apiVersion": "v1",
      "metadata": {
        "name": "${NAME}",
        "annotations": {
          "description": "Defines how to build the application",
          "template.alpha.openshift.io/wait-for-ready": "true"
        }
      },
      "spec": {
        "source": {
          "type": "Git",
          "git": {
            "uri": "${SOURCE_REPOSITORY_URL}",
            "ref": "${SOURCE_REPOSITORY_REF}"
          },
          "contextDir": "${CONTEXT_DIR}"
        },
        "strategy": {
          "type": "Source",
          "sourceStrategy": {
            "from": {
              "kind": "ImageStreamTag",
              "namespace": "${NAMESPACE}",
              "name": "python:${PYTHON_VERSION}"
            },
            "env": [
              {
                  "name": "PIP_INDEX_URL",
                  "value": "${PIP_INDEX_URL}"
              }
            ]
          }
        },
        "output": {
          "to": {
            "kind": "ImageStreamTag",
            "name": "${NAME}:latest"
          }
        },
        "triggers": [
          {
            "type": "ImageChange"
          },
          {
            "type": "ConfigChange"
          },
          {
            "type": "GitHub",
            "github": {
              "secret": "${GITHUB_WEBHOOK_SECRET}"
            }
          }
        ],
        "postCommit": {
          "script": "./manage.py test"
        }
      }
    },
    {
      "kind": "DeploymentConfig",
      "apiVersion": "v1",
      "metadata": {
        "name": "${NAME}",
        "annotations": {
          "description": "Defines how to deploy the application server",
          "template.alpha.openshift.io/wait-for-ready": "true"
        }
      },
      "spec": {
        "strategy": {
          "type": "Rolling"
        },
        "triggers": [
          {
            "type": "ImageChange",
            "imageChangeParams": {
              "automatic": true,
              "containerNames": [
                "django-example"
              ],
              "from": {
                "kind": "ImageStreamTag",
                "name": "${NAME}:latest"
              }
            }
          },
          {
            "type": "ConfigChange"
          }
        ],
        "replicas": 1,
        "selector": {
          "name": "${NAME}"
        },
        "template": {
          "metadata": {
            "name": "${NAME}",
            "labels": {
              "name": "${NAME}"
            }
          },
          "spec": {
            "containers": [
              {
                "name": "django-example",
                "image": " ",
                "ports": [
                  {
                    "containerPort": 8080
                  }
                ],
                "readinessProbe": {
                  "timeoutSeconds": 3,
                  "initialDelaySeconds": 3,
                  "httpGet": {
                    "path": "/",
                    "port": 8080
                  }
                },
                "livenessProbe": {
                  "timeoutSeconds": 3,
                  "initialDelaySeconds": 30,
                  "httpGet": {
                    "path": "/",
                    "port": 8080
                  }
                },
                "env": [
                  {
                    "name": "APP_CONFIG",
                    "value": "${APP_CONFIG}"
                  },
                  {
                    "name": "DJANGO_SECRET_KEY",
                    "valueFrom": {
                      "secretKeyRef" : {
                        "name" : "${NAME}",
                        "key" : "django-secret-key"
                      }
                    }
                  }
                ],
                "resources": {
                  "limits": {
                    "memory": "${MEMORY_LIMIT}"
                  }
                }
              }
            ]
          }
        }
      }
    }
  ],
  "parameters": [
    {
      "name": "NAME",
      "displayName": "Name",
      "description": "The name assigned to all of the frontend objects defined in this template.",
      "required": true,
      "value": "django-example"
    },
    {
      "name": "NAMESPACE",
      "displayName": "Namespace",
      "required": true,
      "description": "The OpenShift Namespace where the ImageStream resides.",
      "value": "openshift"
    },
    {
      "name": "PYTHON_VERSION",
      "displayName": "Version of Python Image",
      "description": "Version of Python image to be used (3.6 or latest).",
      "value": "3.6",
      "required": true
    },
    {
      "name": "MEMORY_LIMIT",
      "displayName": "Memory Limit",
      "required": true,
      "description": "Maximum amount of memory the container can use.",
      "value": "512Mi"
    },
    {
      "name": "SOURCE_REPOSITORY_URL",
      "displayName": "Git Repository URL",
      "required": true,
      "description": "The URL of the repository with your application source code.",
      "value": "https://github.com/sclorg/django-ex.git"
    },
    {
      "name": "SOURCE_REPOSITORY_REF",
      "displayName": "Git Reference",
      "description": "Set this to a branch name, tag or other ref of your repository if you are not using the default branch."
    },
    {
      "name": "CONTEXT_DIR",
      "displayName": "Context Directory",
      "description": "Set this to the relative path to your project if it is not in the root of your repository."
    },
    {
      "name": "APPLICATION_DOMAIN",
      "displayName": "Application Hostname",
      "description": "The exposed hostname that will route to the Django service, if left blank a value will be defaulted.",
      "value": ""
    },
    {
      "name": "GITHUB_WEBHOOK_SECRET",
      "displayName": "GitHub Webhook Secret",
      "description": "Github trigger secret.  A difficult to guess string encoded as part of the webhook URL.  Not encrypted.",
      "generate": "expression",
      "from": "[a-zA-Z0-9]{40}"
    },
    {
      "name": "APP_CONFIG",
      "displayName": "Application Configuration File Path",
      "description": "Relative path to Gunicorn configuration file (optional)."
    },
    {
      "name": "DJANGO_SECRET_KEY",
      "displayName": "Django Secret Key",
      "description": "Set this to a long random string.",
      "generate": "expression",
      "from": "[\\w]{50}"
    },
    {
      "name": "PIP_INDEX_URL",
      "displayName": "Custom PyPi Index URL",
      "description": "The custom PyPi index URL",
      "value": ""
    }
  ]
}

python:${PYTHON_VERSION}のDockerfileを覗く

上の記事につづく...と思ってましたが、RHCCのPython36イメージとminishiftのPythonテンプレートは異なるようでした。
まずはローカルにあるdocker imageを確認します。

[tak@centos76 ~]$ minishift ssh
[docker@minishift ~]$ docker images
REPOSITORY                                                 TAG                 IMAGE ID            CREATED             SIZE
172.30.1.1:5000/django2/django2-example                    latest              5aace67fd4ac        5 minutes ago       714 MB
172.30.1.1:5000/django2/django2-example                    <none>              2b1a23ccd1fd        22 minutes ago      714 MB
172.30.1.1:5000/django2/django2-example                    <none>              ea7cbd73ae20        5 hours ago         714 MB
172.30.1.1:5000/django2/django2-example                    <none>              f2a8d5980d0f        5 hours ago         714 MB
<none>                                                     <none>              29600d17397e        5 hours ago         714 MB
172.30.1.1:5000/django2/django2-example                    <none>              76372cfdd9a2        6 hours ago         714 MB
172.30.1.1:5000/django2/django2-example                    <none>              c26d1f15b033        6 hours ago         714 MB
172.30.1.1:5000/django2/django2-example                    <none>              9d0b29ca7adb        7 hours ago         714 MB
temp.builder.openshift.io/django2/django2-example-1        5974cab5            ec5193c72d6a        7 hours ago         714 MB
172.30.1.1:5000/django2/sample                             latest              f804ece50a51        14 hours ago        714 MB
172.30.1.1:5000/django2/sample                             <none>              0838efeee68d        14 hours ago        714 MB
172.30.1.1:5000/django2/sample                             <none>              d77e49caa741        15 hours ago        714 MB
172.30.1.1:5000/django2/sample                             <none>              f0e22d3f4915        15 hours ago        714 MB
172.30.1.1:5000/django2/django-example                     latest              98fb365c52e3        41 hours ago        714 MB
<none>                                                     <none>              7b2bd8dbce2b        42 hours ago        714 MB
172.30.1.1:5000/django2/django-example                     <none>              ecc540ed1a4a        2 days ago          714 MB
172.30.1.1:5000/django2/django-example                     <none>              1e2213f62c12        2 days ago          714 MB
172.30.1.1:5000/django2/django-example                     <none>              0fecb96f565e        2 days ago          714 MB
<none>                                                     <none>              2133ca89d999        2 days ago          714 MB
docker.io/openshift/origin-node                            v3.11.0             438d61da63d1        7 days ago          1.16 GB
docker.io/openshift/origin-control-plane                   v3.11.0             00f980c345c1        7 days ago          825 MB
docker.io/openshift/origin-hyperkube                       v3.11.0             d65ee3cc9874        7 days ago          506 MB
docker.io/openshift/origin-docker-builder                  v3.11.0             320e0c77623c        7 days ago          458 MB
docker.io/openshift/origin-haproxy-router                  v3.11.0             316c2621011d        7 days ago          407 MB
docker.io/openshift/origin-pod                             v3.11.0             045ddf827c75        7 days ago          258 MB
docker.io/openshift/origin-deployer                        v3.11.0             d05e619aac21        7 days ago          380 MB
docker.io/openshift/origin-hypershift                      v3.11.0             a777d85d24b9        7 days ago          546 MB
docker.io/openshift/origin-cli                             v3.11.0             83d7b0b2f011        7 days ago          380 MB
172.30.1.1:5000/openshift/python                           <none>              8c84620ebb62        2 weeks ago         686 MB
registry.access.redhat.com/rhscl/mariadb-101-rhel7         latest              a4deee8ed5a5        4 weeks ago         455 MB
registry.access.redhat.com/rhscl/python-36-rhel7           latest              8c2f91ba249e        4 weeks ago         627 MB
registry.connect.redhat.com/bitnami/wordpress-nginx-php7   latest              2892cd4d344e        6 weeks ago         580 MB
docker.io/openshift/origin-web-console                     v3.11.0             be30b6cce5fa        2 months ago        339 MB
docker.io/openshift/origin-docker-registry                 v3.11.0             a0d5ad164395        2 months ago        305 MB
docker.io/openshift/origin-service-serving-cert-signer     v3.11               47dadf9d43b6        2 months ago        276 MB

だいぶんゴミイメージが残ってます(笑)お掃除しなきゃですね。
172.30.1.1:5000/openshift/pythonがターゲットのイメージです。
Docker Imageの詳細を確認します。

[docker@minishift ~]$ docker inspect 8c84620ebb62
[
    {
        "Id": "sha256:8c84620ebb6246f82050006a743490af7a2a023dc1dac5287e5cbc203594fa34",
        "RepoTags": [],
        "RepoDigests": [
            "172.30.1.1:5000/openshift/python@sha256:091d56e3ab03d52ef0ffac4b88e7e1fa24ea0243bfd05297882c12ff8a0ba1df"
        ],
        "Parent": "",
        "Comment": "",
        "Created": "2018-12-11T06:41:53.712643695Z",
        "Container": "bef4ea715a2be038a5a28dd081047c73cf270fdd0bde291d59c66160d3e74b47",
        "ContainerConfig": {
            "Hostname": "201167546b69",
            "Domainname": "",
            "User": "1001",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "ExposedPorts": {
                "8080/tcp": {}
            },
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "PATH=/opt/app-root/src/.local/bin/:/opt/app-root/src/bin:/opt/app-root/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
                "SUMMARY=Platform for building and running Python 3.6 applications",
                "DESCRIPTION=Python 3.6 available as container is a base platform for building and running various Python 3.6 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.",
                "STI_SCRIPTS_URL=image:///usr/libexec/s2i",
                "STI_SCRIPTS_PATH=/usr/libexec/s2i",
                "APP_ROOT=/opt/app-root",
                "HOME=/opt/app-root/src",
                "BASH_ENV=/opt/app-root/etc/scl_enable",
                "ENV=/opt/app-root/etc/scl_enable",
                "PROMPT_COMMAND=. /opt/app-root/etc/scl_enable",
                "NODEJS_SCL=rh-nodejs8",
                "PYTHON_VERSION=3.6",
                "PYTHONUNBUFFERED=1",
                "PYTHONIOENCODING=UTF-8",
                "LC_ALL=en_US.UTF-8",
                "LANG=en_US.UTF-8",
                "PIP_NO_CACHE_DIR=off"
            ],
            "Cmd": [
                "/bin/sh",
                "-c",
                "#(nop) ",
                "LABEL io.openshift.builder-version=\"89e5d59\""
            ],
            "ArgsEscaped": true,
            "Image": "sha256:4373473a7559d5de3558d8457474afec7833c892038bdc5720c5c5f01e28b9e0",
            "Volumes": null,
            "WorkingDir": "/opt/app-root/src",
            "Entrypoint": [
                "container-entrypoint"
            ],
            "OnBuild": [],
            "Labels": {
                "com.redhat.component": "python36-container",
                "description": "Python 3.6 available as container is a base platform for building and running various Python 3.6 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.",
                "io.k8s.description": "Python 3.6 available as container is a base platform for building and running various Python 3.6 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.",
                "io.k8s.display-name": "Python 3.6",
                "io.openshift.builder-version": "\"89e5d59\"",
                "io.openshift.expose-services": "8080:http",
                "io.openshift.s2i.scripts-url": "image:///usr/libexec/s2i",
                "io.openshift.tags": "builder,python,python36,rh-python36",
                "io.s2i.scripts-url": "image:///usr/libexec/s2i",
                "maintainer": "SoftwareCollections.org <sclorg@redhat.com>",
                "name": "centos/python-36-centos7",
                "org.label-schema.build-date": "20181006",
                "org.label-schema.license": "GPLv2",
                "org.label-schema.name": "CentOS Base Image",
                "org.label-schema.schema-version": "1.0",
                "org.label-schema.vendor": "CentOS",
                "summary": "Platform for building and running Python 3.6 applications",
                "usage": "s2i build https://github.com/sclorg/s2i-python-container.git --context-dir=3.6/test/setup-test-app/ centos/python-36-centos7 python-sample-app",
                "version": "1"
            }
        },
        "DockerVersion": "1.13.1",
        "Author": "",
        "Config": {
            "Hostname": "201167546b69",
            "Domainname": "",
            "User": "1001",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "ExposedPorts": {
                "8080/tcp": {}
            },
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "PATH=/opt/app-root/src/.local/bin/:/opt/app-root/src/bin:/opt/app-root/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
                "SUMMARY=Platform for building and running Python 3.6 applications",
                "DESCRIPTION=Python 3.6 available as container is a base platform for building and running various Python 3.6 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.",
                "STI_SCRIPTS_URL=image:///usr/libexec/s2i",
                "STI_SCRIPTS_PATH=/usr/libexec/s2i",
                "APP_ROOT=/opt/app-root",
                "HOME=/opt/app-root/src",
                "BASH_ENV=/opt/app-root/etc/scl_enable",
                "ENV=/opt/app-root/etc/scl_enable",
                "PROMPT_COMMAND=. /opt/app-root/etc/scl_enable",
                "NODEJS_SCL=rh-nodejs8",
                "PYTHON_VERSION=3.6",
                "PYTHONUNBUFFERED=1",
                "PYTHONIOENCODING=UTF-8",
                "LC_ALL=en_US.UTF-8",
                "LANG=en_US.UTF-8",
                "PIP_NO_CACHE_DIR=off"
            ],
            "Cmd": [
                "/bin/sh",
                "-c",
                "$STI_SCRIPTS_PATH/usage"
            ],
            "ArgsEscaped": true,
            "Image": "sha256:4373473a7559d5de3558d8457474afec7833c892038bdc5720c5c5f01e28b9e0",
            "Volumes": null,
            "WorkingDir": "/opt/app-root/src",
            "Entrypoint": [
                "container-entrypoint"
            ],
            "OnBuild": [],
            "Labels": {
                "com.redhat.component": "python36-container",
                "description": "Python 3.6 available as container is a base platform for building and running various Python 3.6 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.",
                "io.k8s.description": "Python 3.6 available as container is a base platform for building and running various Python 3.6 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.",
                "io.k8s.display-name": "Python 3.6",
                "io.openshift.builder-version": "\"89e5d59\"",
                "io.openshift.expose-services": "8080:http",
                "io.openshift.s2i.scripts-url": "image:///usr/libexec/s2i",
                "io.openshift.tags": "builder,python,python36,rh-python36",
                "io.s2i.scripts-url": "image:///usr/libexec/s2i",
                "maintainer": "SoftwareCollections.org <sclorg@redhat.com>",
                "name": "centos/python-36-centos7",
                "org.label-schema.build-date": "20181006",
                "org.label-schema.license": "GPLv2",
                "org.label-schema.name": "CentOS Base Image",
                "org.label-schema.schema-version": "1.0",
                "org.label-schema.vendor": "CentOS",
                "summary": "Platform for building and running Python 3.6 applications",
                "usage": "s2i build https://github.com/sclorg/s2i-python-container.git --context-dir=3.6/test/setup-test-app/ centos/python-36-centos7 python-sample-app",
                "version": "1"
            }
        },
        "Architecture": "amd64",
        "Os": "linux",
        "Size": 685991088,
        "VirtualSize": 685991088,
        "GraphDriver": {
            "Name": "overlay2",
            "Data": {
                "LowerDir": "/var/lib/docker/overlay2/e71352c9e4432d1f3162bf1a9c8663053722ef7dba6eb42736b2024be9d90fed/diff:/var/lib/docker/overlay2/f94d5e63e0704b37c4e911f1ca51512513b74aae3c4d0ec72f3d31d402c52976/diff:/var/lib/docker/overlay2/8c14893e5d266a21ee2f1d849a8b5d8f75d40580e43b24689950359a542c0668/diff:/var/lib/docker/overlay2/96c152b6972818de0cd157a403cfd5eb7b04e82d68fae73993deabf9178cad11/diff:/var/lib/docker/overlay2/2e8b9ebb80329f176d42192f6ccf0e3080a2d3dbc241ae23b535352414913912/diff:/var/lib/docker/overlay2/1a35f38af1d964f92fcbfbd1694255942eb5977c12bb765722417400722a65a8/diff:/var/lib/docker/overlay2/afaa961a72ca812f4866a945a8567822293ed801882a14c04b7bcfe55feca568/diff:/var/lib/docker/overlay2/f228247fb75f8942154afc2a0f42315bf1ebd36a4d709bb9e48f6ecf6bd13d40/diff",
                "MergedDir": "/var/lib/docker/overlay2/9be06b4a5c7bb5896cc27a04136a48217bed94b45ea34c4a46b4070acf029a5f/merged",
                "UpperDir": "/var/lib/docker/overlay2/9be06b4a5c7bb5896cc27a04136a48217bed94b45ea34c4a46b4070acf029a5f/diff",
                "WorkDir": "/var/lib/docker/overlay2/9be06b4a5c7bb5896cc27a04136a48217bed94b45ea34c4a46b4070acf029a5f/work"
            }
        },
        "RootFS": {
            "Type": "layers",
            "Layers": [
                "sha256:f972d139738dfcd1519fd2461815651336ee25a8b54c358834c50af094bb262f",
                "sha256:5e884d4e3b68029324ec90f6ccf274a9f5b3d954d3715c9fc78f4cc231fe4351",
                "sha256:6593d9ef5bb787d7fc78b91cf449305fb29db474b46fd3a14f6b7d5d27312fa7",
                "sha256:79c4057dbfa8001aa0ae8f8d8f4abb0f81c692267ab9dc59af0339d023afa4f2",
                "sha256:b737e1b974e2ff5c702c643e3c46f328646e83bdb5f37ee5342f854dfc921272",
                "sha256:fa4b61ed85f327d7949b6b4746889c9e75a151bd27c3a5b77175ca36352f2469",
                "sha256:373b5f73f9800172d3583b2d69a1d0776368f20ab47a64637094ca957592fdce",
                "sha256:540b53534b1500c29838fa5494da22b1ae51ebe1b65b83af748b105992f027bf",
                "sha256:da4b2ee8233918e517e6c642619dbe61ace96dbefdd8b8c832d19c9ca5e4fbda"
            ]
        }
    }
]

https://github.com/sclorg/s2i-python-container.git
centos/python-36-centos7を確認する必要があるみたいですね。
って事で上の記事に戻る感じです(笑)

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0