如何在Docker映像中安装python? [英] How to install python in a docker image?

查看:80
本文介绍了如何在Docker映像中安装python?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用正确安装的 selenium chrome 创建一个docker镜像,所以我选择了一个带有这些属性。因此, Dockerfile 的第一行如下:

I want to create a docker image with selenium and chrome correctly installed, so I choose a base image with these properties. Therefore, the first line of the Dockerfile is as follows:

FROM selenium/node-chrome:3.7.1-argon

然后下一个命令是

RUN apt-get update

在创建docker映像时创建了以下错误:

which created the following error while creating the docker image:

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

How to be able to install python in this docker image?

推荐答案

运行sudo apt-get更新

运行sudo apt-get install python

提示:


获取(13:权限被拒绝)

Acquire (13: Permission denied)

我相信这是由于您的基本图片造成的:

I believe this is due to your base image:

https:/ /github.com/SeleniumHQ/docker-selenium/blob/master/NodeChrome/Dockerfile

如您所见,它与默认用户上下文

As you can see it swaps from the default user context of 'root' to 'seluser'.

您可以:


  • 穿上它由于基本映像(即使用sudo)

  • 交换回去: USER root

  • ,或考虑创建自己的docker映像,避免一开始就进行交换

希望有助于交配。

这篇关于如何在Docker映像中安装python?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆