Issue
Im using a python image in docker and have added some dependencies as per the below:
RUN apt-get update -y \
&& apt-get install -y apt-utils libsasl2-dev python3-dev libldap2-dev libssl-dev libsnmp-dev snmp-mibs-downloader
I'm getting an error
E: Package 'snmp-mibs-downloader' has no installation candidate
Which after searching is because I need a non-free repo adding as per: http://installion.co.uk/debian/wheezy/non-free/s/snmp-mibs-downloader/install/index.html
I believe I need to edit /etc/apt/sources.list and add the below:
deb http://http.us.debian.org/debian jessie main contrib non-free
deb http://security.debian.org jessie/updates main contrib non-free
but how do I do that via a docker file?
Solution
The same way you would do to add the non-free
component to your sources.list
. Edit the /etc/apt/sources.list
file in your Dockerfile and replace the line that looks like:
deb http://http.us.debian.org/debian jessie main contrib
by
deb http://http.us.debian.org/debian jessie main contrib non-free
You can do that in the Dockerfile with a command like
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
And same for security.debian.org
.
Answered By - Anis Answer Checked By - Mary Flores (WPSolving Volunteer)