Docker:RUN pip install boto成功,但结果图像中缺少

时间:2015-04-30 10:04:55

标签: docker pip

我有这个Dockerfile:

FROM hopsoft/graphite-statsd
MAINTAINER Jakub Holy

# python dependencies
RUN pip install --global-option="--without-libyaml" PyYAML
RUN pip install boto
RUN pip install cloudwatch-to-graphite==0.5.0

EXPOSE 80 2003 8125/udp
CMD /sbin/my_init

当我使用docker build -t monitoring .构建它时,似乎已经安装了boto但是,当安装cloudwatch-to-graphite时,它的行为就像它不存在一样:

Step 0 : FROM hopsoft/graphite-statsd
 ---> 5f10f9bdc418
Step 1 : MAINTAINER Jakub Holy
 ---> Using cache
 ---> 50881b8cb83f
Step 2 : RUN pip install --global-option="--without-libyaml" PyYAML
 ---> Using cache
 ---> 47ab159111a1
Step 3 : RUN pip install boto
 ---> Using cache
 ---> b60c39c70e8a
Step 4 : RUN pip install cloudwatch-to-graphite==0.5.0
 ---> Running in 2497f672cfc9
Downloading/unpacking cloudwatch-to-graphite==0.5.0
  Downloading cloudwatch_to_graphite-0.5.0-py2.py3-none-any.whl
Downloading/unpacking Jinja2 (from cloudwatch-to-graphite==0.5.0)
  Running setup.py (path:/tmp/pip_build_root/Jinja2/setup.py) egg_info for package Jinja2

    warning: no files found matching '*' under directory 'custom_fixers'
    warning: no previously-included files matching '*' found under directory 'docs/_build'
    warning: no previously-included files matching '*.pyc' found under directory 'jinja2'
    warning: no previously-included files matching '*.pyc' found under directory 'docs'
    warning: no previously-included files matching '*.pyo' found under directory 'jinja2'
    warning: no previously-included files matching '*.pyo' found under directory 'docs'
Requirement already satisfied (use --upgrade to upgrade): PyYAML in /usr/local/lib/python2.7/dist-packages (from cloudwatch-to-graphite==0.5.0)
Downloading/unpacking docopt (from cloudwatch-to-graphite==0.5.0)
  Downloading docopt-0.6.2.tar.gz
  Running setup.py (path:/tmp/pip_build_root/docopt/setup.py) egg_info for package docopt

Downloading/unpacking boto (from cloudwatch-to-graphite==0.5.0)
Downloading/unpacking markupsafe (from Jinja2->cloudwatch-to-graphite==0.5.0)
  Downloading MarkupSafe-0.23.tar.gz
  Running setup.py (path:/tmp/pip_build_root/markupsafe/setup.py) egg_info for package markupsafe

Installing collected packages: cloudwatch-to-graphite, Jinja2, docopt, boto, markupsafe
  Running setup.py install for Jinja2

    warning: no files found matching '*' under directory 'custom_fixers'
    warning: no previously-included files matching '*' found under directory 'docs/_build'
    warning: no previously-included files matching '*.pyc' found under directory 'jinja2'
    warning: no previously-included files matching '*.pyc' found under directory 'docs'
    warning: no previously-included files matching '*.pyo' found under directory 'jinja2'
    warning: no previously-included files matching '*.pyo' found under directory 'docs'
  Running setup.py install for docopt

  Running setup.py install for markupsafe

    building 'markupsafe._speedups' extension
    x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c markupsafe/_speedups.c -o build/temp.linux-x86_64-2.7/markupsafe/_speedups.o
    x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/markupsafe/_speedups.o -o build/lib.linux-x86_64-2.7/markupsafe/_speedups.so
Successfully installed cloudwatch-to-graphite Jinja2 docopt boto markupsafe
Cleaning up...
 ---> 6cdd7b0359da
Removing intermediate container 2497f672cfc9
Step 5 : EXPOSE 80 2003 8125/udp
 ---> Running in a2caab6577ba
 ---> a002f50793ff
Removing intermediate container a2caab6577ba
Step 6 : CMD /sbin/my_init
 ---> Running in eb5da5a71c56
 ---> 7c18498e3fd3
Removing intermediate container eb5da5a71c56
Successfully built 7c18498e3fd3

当我运行生成的容器时,没有任何boto或cloudwatch-to-graphite的痕迹 - 例如PyYAML就在那里:

root@7318ed2b04d0:/usr/local/src/carbon# pip list
argparse (1.2.1)
chardet (2.0.1)
colorama (0.2.5)
Django (1.3)
django-tagging (0.3.1)
docopt (0.6.2)
flup (1.0.2)
html5lib (0.999)
Jinja2 (2.7.3)
MarkupSafe (0.23)
pip (1.5.4)
python-memcached (1.53)
PyYAML (3.11)
requests (2.2.1)
setuptools (3.3)
six (1.5.2)
Twisted (11.1.0)
txAMQP (0.6.2)
urllib3 (1.7.1)
whisper (0.9.12)
wsgiref (0.1.2)
zope.interface (4.1.2)
root@7318ed2b04d0:/usr/local/src/carbon#

 find / -iname '*boto*' | wc -l
 0

这里发生了什么?为什么它不包含这些包?

如果我在容器(pip install cloudwatch-to-graphite)中手动安装它,它就在那里 - 但由于某些原因(早期安装石墨?),包裹最终在/opt/graphite/lib/python2.7/site-packages/

PS:有一个类似的问题:Pip install -e packages don't appear in Docker

0 个答案:

没有答案