试图在Docker镜像上安装selenium python3软件包

我试过用selenium python包重新构build一个Docker镜像失败。 我不知道如何继续。

这是我的dockerfile:

FROM selenium/standalone-chrome:latest WORKDIR /usr/local/bin RUN sudo apt-get update RUN sudo apt-get install software-properties-common RUN sudo apt-add-repository universe RUN sudo apt-get install python-pip RUN pip3 install -r requirements.txt RUN pip3 install . RUN pip3 install -e . COPY ./* ./ 

我相当确定这是我的dockerfile是错误的,但尝试各种安装点的方法后,我画了一个空白。

在任何情况下,我然后调用:docker build -t webdriver。

其中输出以下内容:

 Sending build context to Docker daemon 4.608kB Step 1/10 : FROM selenium/standalone-chrome:latest ---> 11258d1f9aba Step 2/10 : WORKDIR /usr/local/bin ---> Using cache ---> 9297517083f6 Step 3/10 : RUN sudo apt-get update ---> Using cache ---> f9004a85fc1a Step 4/10 : RUN sudo apt-get install software-properties-common ---> Running in bb2336c4ae46 Reading package lists... Building dependency tree... Reading state information... The following additional packages will be installed: apt-utils cron gir1.2-glib-2.0 iso-codes libapt-inst2.0 libcurl3-gnutls libgirepository-1.0-1 librtmp1 python-apt-common python3-apt python3-dbus python3-gi python3-pycurl python3-software-properties unattended-upgrades xz-utils Suggested packages: anacron logrotate checksecurity exim4 | postfix | mail-transport-agent isoquery python3-apt-dbg python-apt-doc python-dbus-doc python3-dbus-dbg libcurl4-gnutls-dev python-pycurl-doc python3-pycurl-dbg bsd-mailx mail-transport-agent The following NEW packages will be installed: apt-utils cron gir1.2-glib-2.0 iso-codes libapt-inst2.0 libcurl3-gnutls libgirepository-1.0-1 librtmp1 python-apt-common python3-apt python3-dbus python3-gi python3-pycurl python3-software-properties software-properties-common unattended-upgrades xz-utils 0 upgraded, 17 newly installed, 0 to remove and 5 not upgraded. Need to get 3615 kB of archives. After this operation, 22.6 MB of additional disk space will be used. Do you want to continue? [Y/n] Abort. The command '/bin/sh -c sudo apt-get install software-properties-common' returned a non-zero code: 1 

我猜测“你想继续吗?[Y / N]中止。” 需要回答“是”,但我不知道该怎么做。 我怀疑我错过了更多。

不用说,我的Python脚本仍然不运行,因为它需要selenium:

 Traceback (most recent call last): File "web-test.py", line 3, in <module> from selenium import webdriver 

谁能告诉我我哪里出了错?