Search code examples
dockerdebianapt-getdocker-containerdebian-jessie

Cannot retrieve latest version of Debian package inside Docker container


Inside a docker container (created from a node:9 image) I am trying to install stress-ng package using apt-get. However, for some reason an old version of the package is retrieved everytime I try to install it. For installing the package I use the commands:

root@7e7a683bf288:/usr/src/app# apt-get update
root@7e7a683bf288:/usr/src/app# apt-get install stress-ng

I get the following version:

root@7e7a683bf288:/usr/src/app# stress-ng --version
stress-ng, version 0.01.32

However, I would like to get the latest version if possible, 0.09.42-1 (https://packages.ubuntu.com/cosmic/stress-ng). I have tried some of the solutions in similar questions but was not able to get this to work.

Additional info:

root@7e7a683bf288:/usr/src/app# cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 8 (jessie)"
NAME="Debian GNU/Linux"
VERSION_ID="8"
VERSION="8 (jessie)"
ID=debian
HOME_URL="http://www.debian.org/"
SUPPORT_URL="http://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

root@7e7a683bf288:/usr/src/app# cat /etc/apt/sources.list
deb http://deb.debian.org/debian jessie main
deb http://security.debian.org/debian-security jessie/updates main
deb http://deb.debian.org/debian jessie-updates main

root@7e7a683bf288:/usr/src/app# add-apt-repository 
bash: add-apt-repository: command not found

Solution

  • You have to add the unstable repo to your sources.list. When I did that, I still couldn't install stress-ng as it stated:

    root@096865e3637f:/# apt-get install stress-ng
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    Some packages could not be installed. This may mean that you have
    requested an impossible situation or if you are using the unstable
    distribution that some required packages have not yet been created
    or been moved out of Incoming.
    The following information may help to resolve the situation:
    
    The following packages have unmet dependencies:
     libc6-dev : Breaks: binutils (< 2.26) but 2.25-5+deb8u1 is to be installed
    E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.
    

    So before installing I had to remove binutils.

    Maybe that is an option for you.

    The complete Dockerfile looks like:

    FROM node:9
    RUN echo "deb http://http.us.debian.org/debian unstable main non-free contrib" >> /etc/apt/sources.list && \
    echo "deb-src http://http.us.debian.org/debian unstable main non-free contrib" >> /etc/apt/sources.list && \
    apt-get remove binutils -y && \
    apt-get update && \
    apt-get install stress-ng -y
    CMD stress-ng --version
    

    stress-ng --version:

    stress-ng, version 0.09.50 💻🔥

    So, it is not 0.09.42, but the latest (unstable) version - as requested.