jde*_*vio 0 python docker digital-ocean dockerfile
Docker对于我正在构建的Python应用程序,我有一个非平凡的环境(请参阅下面的完整版Dockerfile).在我的MacBook(with Docker version 1.10.3, build 20f81dd)上,我能够构建Docker图像,运行容器,应用程序运行正常.
我现在想在Digital Ocean上测试应用程序.到目前为止,我只在笔记本电脑上使用过Docker.我使用Ubuntu Docker 1.10.3 on 14.04图像创建了一个Droplet .我在SSH中,克隆了我的git repo,执行了docker build命令,但是我在构建过程中遇到了一个错误(参见完整堆栈跟踪的底部).
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.
Run Code Online (Sandbox Code Playgroud)
这是一个有效的例外,但我的问题是:为什么相同的命令Dockerfile和docker build命令在一台机器上成功构建,但在另一台机器上引发异常?我的码头工人的理解是,它阻止这样的事情,从通过建立只用Dockerfile ......我只是不能换我周围是什么原因造成一台机器上此异常头从无到有的环境,而不是其他事情.
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"]
Run Code Online (Sandbox Code Playgroud)
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
Run Code Online (Sandbox Code Playgroud)
我不知道你的具体问题,但回答你的一般问题:
为什么同一个Dockerfile和docker构建命令在一台机器上成功构建,但在另一台机器上引发异常?
机器可能正在使用不同的python:2.7图像.许多图像(特别是官方的)经常被重修,并在python标签页说,2.7在去年建成5天前.如果您刚刚创建了DigitalOcean实例,它将使用最新版本python:2.7,但如果您在六天前拉出该图像,则会使用过时的图像.如果您docker pull python:2.7在本地计算机上运行并尝试重建,则应该得到与您在DigitalOcean上看到的相同的错误.
另一个相关的可能原因可能是构建缓存:如果Dockerfile安装的许多软件包中的一个最近发生了变化,但是你最近没有编辑Dockerfile的那一行或它上面的任何一行,那么本地的Docker实例就是机器将在构建时继续使用旧版本.您可以通过将--no-cache选项传递给本地计算机来关闭构建缓存的使用docker build.
对于泊坞窗其他可能的原因建立在一台机器上的成功和失败的另一个包括使用不同版本的泊坞窗或一台机器和其他不同的代理(或无代理)上下载包时,使用HTTP代理.
| 归档时间: |
|
| 查看次数: |
352 次 |
| 最近记录: |