托pipe虚拟机添加到PATH

在Google App Engine的Managed VMS的Python运行时 ,我想安装Splinter (selenium)Chromedriver。 根据Linux的文档,我有我的dockerfile中的以下内容:

# Dockerfile extending the generic Python image with application files for a # single application. FROM gcr.io/google_appengine/python-compat RUN apt-get update && apt-get install -y apt-utils zip unzip wget ADD requirements.txt /app/ RUN pip install -r requirements.txt RUN cd $HOME/ RUN wget https://chromedriver.googlecode.com/files/chromedriver_linux64_20.0.1133.0.zip RUN unzip chromedriver_linux64_20.0.1133.0.zip RUN mkdir -p $HOME/bin RUN mv chromedriver /bin ENV PATH "$PATH:$HOME/bin" ADD . /app 

我无法让web应用程序使用chrome webdriver启动Splinter,因为它在PATH中找不到它。

WebDriverException:消息:'chromedriver'可执行文件需要
可用的path。 请看
http://docs.seleniumhq.org/download/#thirdPartyDrivers
并在阅读
http://code.google.com/p/selenium/wiki/ChromeDriver

如果我运行docker exec -it <container id> chromedriver ,正如所料,它不起作用。

另外,用Python打印的环境variables是:

 ➜ ~ docker exec -it f4d9541c4ba6 python Python 2.7.3 (default, Mar 13 2014, 11:03:55) [GCC 4.7.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import os >>> print os.environ {'GAE_MODULE_NAME': 'parsers', 'API_HOST': '10.0.2.2', 'GAE_SERVER_PORT': '8082', 'MODULE_YAML_PATH': 'parsers.yaml', 'HOSTNAME': 'f4d9541c4ba6', 'SERVER_SOFTWARE': 'Development/2.0', 'GAE_MODULE_INSTANCE': '0', 'DEBIAN_FRONTEND': 'noninteractive', 'GAE_MINOR_VERSION': '580029170989395749', 'API_PORT': '59768', 'GAE_PARTITION': 'dev', 'GAE_LONG_APP_ID': 'utix-app', 'PATH': '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', 'GAE_MODULE_VERSION': 'parsers-0-0-1', 'HOME': '/root'} 

什么是正确的方式,使路由器或任何解决方法的路由器铬?

非常感谢

您需要检查与该图像相关的ENTRYPOINTCMD (对您启动的容器进行docker inspect

如果图像设置为打开新的bash会话,则与运行该会话的帐户关联的profile.bashrc可能会重新定义$PATH ,覆盖Dockerfile ENV PATH "$PATH:$HOME/bin"指令。

如果是这种情况,确保profile.bashrc定义正确的PATH更容易(例如一个自定义的.bashrc COPY )修改ENV