我想创建正确安装了selenium
和chrome
的docker镜像,因此我选择具有这些属性的基本镜像。因此,Dockerfile
的第一行如下:
FROM selenium/node-chrome:3.7.1-argon
然后下一个命令是
RUN apt-get update
在创建docker镜像时创建了以下错误:
Step 4/19 : RUN apt-get update
---> Running in af08ae07cbf3
Reading package lists...
E: List directory /var/lib/apt/lists/partial is missing. - Acquire (13: Permission denied)
The command '/bin/sh -c apt-get update' returned a non-zero code: 100
如何能够在此docker镜像中安装
python
? 最佳答案
RUN sudo apt-get update -y
RUN sudo apt-get install -y python
如提示:
我相信这是由于您的基本形象:
https://github.com/SeleniumHQ/docker-selenium/blob/master/NodeChrome/Dockerfile
如您所见,它从默认的用户上下文“root”交换为“seluser”。
您可以:
USER root
在可能的情况下,最好在Dockerfiles中避免使用
sudo
,因此最好选择选项#2或#3,而不是#1。希望能帮助交配。
关于python - 如何在Docker镜像中安装python?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/47216784/