在docker中运行应用程序时遇到分段错误
/path/condapy/envs/env_name/bin/python -vvvvvv manage.py runserver
# code object from
'/path/condapy/envs/env_name/lib/python3.6/site-packages/django/core/__pycache__/wsgi.cpython-36.pyc'
import 'django.core.wsgi' # <_frozen_importlib_external.SourceFileLoader object at 0x7f1919dd5a90>
import 'django.core.servers.basehttp' # <_frozen_importlib_external.SourceFileLoader object at 0x7f1919dca240>
import 'django.core.management.commands.runserver' # <_frozen_importlib_external.SourceFileLoader object at 0x7f1919dbf630>
import 'django.contrib.staticfiles.management.commands.runserver' # <_frozen_importlib_external.SourceFileLoader object at 0x7f1919db34a8>
PyThreadState_Clear: warning: thread still has a frame
Running in local mode
Performing system checks...
Segmentation fault
Dockerfile
FROM centos:latest
ENV JAVA_VERSON=1.8.0 \
JAVA_HOME=/usr/lib/jvm/java \
codepath=<>
RUN yum install -y epel-release cmake wget git python-setuptools zlib-devel openssl-devel python-devel gcc-c++ snappy-devel gcc curl bzip2 java-$JAVA_VERSON-openjdk java-$JAVA_VERSON-openjdk-devel && \
yum install -y nginx && \
easy_install supervisor && \
yum clean all && \
rm -rf /etc/localtime && \
ln -s /usr/share/zoneinfo/Asia/Kolkata /etc/localtime && \
mkdir -p /logs
RUN mkdir -p /path/condapy && \
curl -sSL https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -o /srv/miniconda.sh && \
bash /srv/miniconda.sh -bfp /path/condapy && \
/path/condapy/bin/conda install -y python=3 && \
/path/condapy/bin/conda update conda && \
/path/condapy/bin/conda clean --all --yes
EXPOSE 80
WORKDIR /app_path
ARG aws_access_key_id
ARG aws_secret_access_key
ARG env
COPY ./conda_environment.yml /app_path/conda_environment.yml
RUN /path/condapy/bin/conda config --add channels conda-forge && \
/path/condapy/bin/conda env create -f=/app_path/conda_environment.yml -n chatty && \
rm -rf /opt/conda/pkgs/*
COPY ./ $codepath
CMD ["/usr/bin/supervisord", "-n"]
数据库配置看起来不错,我们已经分配了足够的内存。有什么建议吗?
答案 0 :(得分:1)
您在构建docker映像时安装python。尝试使用预安装的python从centos映像构建映像,或从多个基本映像构建映像(由于17.05支持docker https://docs.docker.com/develop/develop-images/multistage-build/#before-multi-stage-builds,所以是这样)
您的Dockerfile看起来像这样:
# Include Base image with preinstalled python
######
FROM centos/python-35-centos7
pip install ...
######
ENV JAVA_VERSON=1.8.0 \
JAVA_HOME=/usr/lib/jvm/java \
codepath=<>
......