docker – 使用Python的图像,添加非免费的Debian回购?

我在docker中使用Python图像,并添加了一些依赖关系,如下所示:

RUN apt-get update -y \ && apt-get install -y apt-utils libsasl2-dev python3-dev libldap2-dev libssl-dev libsnmp-dev snmp-mibs-downloader 

我收到一个错误

 E: Package 'snmp-mibs-downloader' has no installation candidate 

search后,因为我需要一个非免费的回购添加按照: http : //installion.co.uk/debian/wheezy/non-free/s/snmp-mibs-downloader/install/index.html

我相信我需要编辑/etc/apt/sources.list并添加下面的内容:

 deb http://http.us.debian.org/debian jessie main contrib non-free deb http://security.debian.org jessie/updates main contrib non-free 

但我怎么通过docker文件来做到这一点?

与将sources.list添加non-free组件的方式相同。 编辑Dockerfile中的/etc/apt/sources.list文件,并replace如下所示的行:

 deb http://http.us.debian.org/debian jessie main contrib 

通过

 deb http://http.us.debian.org/debian jessie main contrib non-free 

您可以使用类似的命令在Dockerfile中执行此操作

 sed -i "s#deb http://http.us.debian.org/debian jessie main contrib non-free#deb http://http.us.debian.org/debian jessie main contrib non-free#g" /etc/apt/sources.list 

security.debian.org