Monday, January 3, 2022

[SOLVED] apt install in Dockefile

Issue

I have a docker file with image which contain Debian. because of vulnerabilities I tried to change version of open ssl in dockerfile. the current used version 1.1.0j-1~deb9u1 im tried to install different version using:

RUN apt-get install openssl=1.1.0l-1~deb9u1

but I keep getting -

Reading package lists...
Building dependency tree...
Reading state information...
E: Version '1.1.0l-1~deb9u1' for 'openssl' was not found

what should I do to enable installation of different stable version.


Solution

Given your selection of the package version and based on the information from the debian package repository, I assume that your debian version is stretch. The following dockerfile worked for me:

FROM debian:stretch
  
RUN apt-get update
RUN apt-get install -y openssl=1.1.0l-1~deb9u1

After docker build -t debian-openssl .the installed openssl version can be verified like this:

$ docker run -t debian-openssl openssl version
OpenSSL 1.1.0l  10 Sep 2019


Answered By - Reinier Torenbeek