Docker:运行pip安装boto成功,但从结果图像中丢失

我有这个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 .构build它时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 ),它就在那里 – 尽pipe由于某种原因(从以前安装的石墨中剩下的),软件包最终会放在/opt/graphite/lib/python2.7/site-packages/

PS:还有一个类似的问题: Pip install -e软件包不会出现在Docker中