2016-03-30 8 views
0

Ich habe eine nicht triviale Docker Umgebung für eine Python-App, die ich baue (siehe unten für vollständige Dockerfile). Auf meinem MacBook (mit Docker version 1.10.3, build 20f81dd) kann ich das Docker Image erstellen, den Container ausführen und die App funktioniert einwandfrei.Docker Bild baut auf Laptop, nicht auf Digital Ocean - mein Verständnis von Docker ist zerbrochen

Ich möchte jetzt die App auf Digital Ocean testen. Ich habe Docker bisher nur auf meinem Laptop benutzt. Ich habe ein Bild mit dem Bild Ubuntu Docker 1.10.3 on 14.04 erstellt. Ich habe mich eingeloggt, meinen Git Repo geklont, den docker build Befehl ausgeführt, aber ich habe während des Builds einen Fehler bekommen (siehe unten für die vollständige Stapelverfolgung).

Exception: Cython-generated file 'pandas/index.c' not found. 
      Cython is required to compile pandas from a development branch. 
      Please install Cython or download a release package of pandas. 

Dies ist eine gültige Ausnahme, aber meine Fragen sind: Warum wäre der gleiche Dockerfile und docker build Befehl erfolgreich auf einer Maschine bauen, aber eine Ausnahme auf einem anderen erheben? Mein Verständnis von Docker war, dass es verhindert, dass diese Art von Sache passiert, indem Sie die Umwelt von Grund auf mit nur der Dockerfile erstellen ... Ich kann einfach nicht meinen Kopf um, was diese Ausnahme auf dem einen Computer und nicht den anderen verursacht .


Dockerfile

FROM python:2.7 

ENV HOME /root 

# Install dependencies 
RUN apt-get update \ 
    && apt-get upgrade -y 
RUN apt-get install -y apt-utils 
RUN apt-get install -y gcc 
RUN apt-get install -y build-essential 
RUN apt-get install -y zlib1g-dev 
RUN apt-get install -y wget 
RUN apt-get install -y unzip 
RUN apt-get install -y cmake 
RUN apt-get install -y gfortran 
RUN apt-get install -y libatlas-base-dev 
RUN apt-get install -y python-pip 
RUN apt-get install -y python-dev 
RUN apt-get install -y subversion 
RUN apt-get install -y supervisor 
RUN apt-get install -y nginx 
RUN apt-get clean 

# Install Python packages 
RUN pip install --upgrade pip 
RUN pip install numpy 
RUN pip install pandas 
RUN pip install bottleneck 
RUN pip install boto3 
RUN pip install scipy 
RUN pip install Flask 
RUN pip install uwsgi 

# Build OpenCV and dependencies 
RUN cd && wget https://github.com/Itseez/opencv/archive/3.1.0.zip \ 
    && git clone https://github.com/Itseez/opencv_contrib.git \ 
     && unzip 3.1.0.zip \ 
     && cd opencv-3.1.0 && mkdir build && cd build \ 
     && cmake -D CMAKE_BUILD_TYPE=RELEASE \ 
      -D CMAKE_INSTALL_PREFIX=/usr/local \ 
      -D INSTALL_C_EXAMPLES=OFF \ 
      -D INSTALL_PYTHON_EXAMPLES=ON \ 
      -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules \ 
      -D BUILD_EXAMPLES=ON .. \ 
    && make -j2 && make install \ 
     && cd && rm -rf opencv-3.1.0 && rm 3.1.0.zip 

# Build HDF5 
RUN cd ; wget https://www.hdfgroup.org/ftp/HDF5/current/src/hdf5-1.8.16.tar.gz 
RUN cd ; tar zxf hdf5-1.8.16.tar.gz 
RUN cd ; mv hdf5-1.8.16 hdf5-setup 
RUN cd ; cd hdf5-setup ; ./configure --prefix=/usr/local/ 
RUN cd ; cd hdf5-setup ; make && make install 

# Cleanup 
RUN cd ; rm -rf hdf5-setup 
RUN apt-get -yq autoremove 
RUN apt-get clean 
RUN rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* 

# Install Python packages with dependencies on HDF5 
RUN pip install tables 
RUN pip install h5py 
RUN pip install -U scikit-image 

RUN rm -fr /root/.cache 

# Update environment and working directories 
ENV PYTHONUNBUFFERED 1 
WORKDIR /app 
ADD . /app 
RUN mv config ../config 

# Setup config 
RUN echo "\ndaemon off;" >> /etc/nginx/nginx.conf 
RUN rm /etc/nginx/sites-enabled/default 

RUN ln -s /config/nginx.conf /etc/nginx/sites-enabled/ 
RUN ln -s /config/supervisor.conf /etc/supervisor/conf.d/ 

EXPOSE 80 
CMD ["python", "app.py"] 

Stack Trace

creating build/lib.linux-x86_64-2.7/pandas/tseries/tests/data 
    copying pandas/tseries/tests/data/series_daterange0.pickle -> build/lib.linux-x86_64-2.7/pandas/tseries/tests/data 
    copying pandas/tseries/tests/data/frame.pickle -> build/lib.linux-x86_64-2.7/pandas/tseries/tests/data 
    copying pandas/tseries/tests/data/dateoffset_0_15_2.pickle -> build/lib.linux-x86_64-2.7/pandas/tseries/tests/data 
    copying pandas/tseries/tests/data/daterange_073.pickle -> build/lib.linux-x86_64-2.7/pandas/tseries/tests/data 
    copying pandas/tseries/tests/data/series.pickle -> build/lib.linux-x86_64-2.7/pandas/tseries/tests/data 
    copying pandas/tseries/tests/data/cday-0.14.1.pickle -> build/lib.linux-x86_64-2.7/pandas/tseries/tests/data 
    UPDATING build/lib.linux-x86_64-2.7/pandas/_version.py 
    set build/lib.linux-x86_64-2.7/pandas/_version.py to '0.18.0' 
    running build_ext 
    Traceback (most recent call last): 
     File "<string>", line 1, in <module> 
     File "/tmp/pip-build-OD55P2/pandas/setup.py", line 604, in <module> 
     **setuptools_kwargs) 
     File "/usr/local/lib/python2.7/distutils/core.py", line 151, in setup 
     dist.run_commands() 
     File "/usr/local/lib/python2.7/distutils/dist.py", line 953, in run_commands 
     self.run_command(cmd) 
     File "/usr/local/lib/python2.7/distutils/dist.py", line 972, in run_command 
     cmd_obj.run() 
     File "/usr/local/lib/python2.7/site-packages/setuptools/command/install.py", line 61, in run 
     return orig.install.run(self) 
     File "/usr/local/lib/python2.7/distutils/command/install.py", line 563, in run 
     self.run_command('build') 
     File "/usr/local/lib/python2.7/distutils/cmd.py", line 326, in run_command 
     self.distribution.run_command(command) 
     File "/usr/local/lib/python2.7/distutils/dist.py", line 972, in run_command 
     cmd_obj.run() 
     File "/usr/local/lib/python2.7/distutils/command/build.py", line 127, in run 
     self.run_command(cmd_name) 
     File "/usr/local/lib/python2.7/distutils/cmd.py", line 326, in run_command 
     self.distribution.run_command(command) 
     File "/usr/local/lib/python2.7/distutils/dist.py", line 972, in run_command 
     cmd_obj.run() 
     File "/usr/local/lib/python2.7/distutils/command/build_ext.py", line 339, in run 
     self.build_extensions() 
     File "/tmp/pip-build-OD55P2/pandas/setup.py", line 316, in build_extensions 
     self.check_cython_extensions(self.extensions) 
     File "/tmp/pip-build-OD55P2/pandas/setup.py", line 313, in check_cython_extensions 
     """ % src) 
    Exception: Cython-generated file 'pandas/index.c' not found. 
        Cython is required to compile pandas from a development branch. 
        Please install Cython or download a release package of pandas. 


    ---------------------------------------- 
Command "/usr/local/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-OD55P2/pandas/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-JQaDVa-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-OD55P2/pandas/ 
The command '/bin/sh -c pip install pandas' returned a non-zero code: 1 

Antwort

Verwandte Themen