linuxdockerdebiantomcat7debian-jessie

How to install Debian Jessie package in Bullseye in Docker


I am trying to install libtomcat7-java in my Debian Bullseye Docker container. The problem is that it is only available in the Debian Archives for Jessie. I tried the follow code:

FROM openjdk:8u312-bullseye
RUN echo "deb http://archive.debian.org/debian/ jessie contrib main non-free\ndeb-src http://archive.debian.org/debian/ jessie main contrib non-free" >> /etc/apt/sources.list
RUN apt-get update
RUN apt-get install libtomcat7-java -y

However it failed with the message:

GPG error: http://archive.debian.org/debian jessie Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 8B48AD6246925553 NO_PUBKEY 7638D0442B90D010 NO_PUBKEY CBF8D6FD518E17E1  
The repository 'http://archive.debian.org/debian jessie Release' is not signed.

I also tried to install the missing public keys with:

apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 8B48AD6246925553 7638D0442B90D010 CBF8D6FD518E17E1

However it also failed with the message:

apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 8B48AD6246925553 7638D0442B90D010 CBF8D6FD518E17E1:
Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
Executing: /tmp/apt-key-gpghome.NOIEOw8ziX/gpg.1.sh --keyserver keyserver.ubuntu.com --recv-keys 8B48AD6246925553 7638D0442B90D010 CBF8D6FD518E17E1
gpg: keyserver receive failed: Server indicated a failure

How can I install this package from the Debian archives or some other source?


Solution

  • Add to your Dockerfile the line to import the required keys

    RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 7638D0442B90D010
    

    Dockerfile

    FROM openjdk:8u312-bullseye
    RUN echo "deb http://archive.debian.org/debian/ jessie contrib main non-free\ndeb-src http://archive.debian.org/debian/ jessie main contrib non-free" >> /etc/apt/sources.list
    
    RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 7638D0442B90D010
    
    RUN apt-get update
    
    RUN apt-get install libtomcat7-java -y
    

    Build

    $ docker build .
    Sending build context to Docker daemon  2.048kB
    Step 1/5 : FROM openjdk:8u312-bullseye
     ---> 3bc5f7759e81
    Step 2/5 : RUN echo "deb http://archive.debian.org/debian/ jessie contrib main non-free\ndeb-src http://archive.debian.org/debian/ jessie main contrib non-free" >> /etc/apt/sources.list
     ---> Using cache
     ---> 7480c19230b5
    Step 3/5 : RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 7638D0442B90D010
     ---> Running in ac677006b426
    Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
    Executing: /tmp/apt-key-gpghome.IPXyQ9cVUQ/gpg.1.sh --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 7638D0442B90D010
    gpg: key 7638D0442B90D010: public key "Debian Archive Automatic Signing Key (8/jessie) <ftpmaster@debian.org>" imported
    gpg: Total number processed: 1
    gpg:               imported: 1
    Removing intermediate container ac677006b426
     ---> d0b97edae233
    Step 4/5 : RUN apt-get update
     ---> Running in 41493ab60868
    Get:1 http://security.debian.org/debian-security bullseye-security InRelease [44.1 kB]
    Get:2 http://deb.debian.org/debian bullseye InRelease [116 kB]
    Get:3 http://deb.debian.org/debian bullseye-updates InRelease [39.4 kB]
    Ign:4 http://archive.debian.org/debian jessie InRelease
    Get:5 http://archive.debian.org/debian jessie Release [148 kB]
    Get:6 http://archive.debian.org/debian jessie Release.gpg [2420 B]
    Get:7 http://security.debian.org/debian-security bullseye-security/main amd64 Packages [115 kB]
    Get:8 http://deb.debian.org/debian bullseye/main amd64 Packages [8183 kB]
    Get:9 http://deb.debian.org/debian bullseye-updates/main amd64 Packages [2596 B]
    Get:10 http://archive.debian.org/debian jessie/non-free Sources [99.2 kB]
    Get:11 http://archive.debian.org/debian jessie/contrib Sources [50.4 kB]
    Get:12 http://archive.debian.org/debian jessie/main Sources [7063 kB]
    Get:13 http://archive.debian.org/debian jessie/contrib amd64 Packages [49.8 kB]
    Get:14 http://archive.debian.org/debian jessie/main amd64 Packages [6818 kB]
    Get:15 http://archive.debian.org/debian jessie/non-free amd64 Packages [83.2 kB]
    Fetched 22.8 MB in 6s (3754 kB/s)
    Reading package lists...
    Removing intermediate container 41493ab60868
     ---> c0f07a3f6af9
    Step 5/5 : RUN apt-get install libtomcat7-java -y
     ---> Running in 20c3dd999c50
    Reading package lists...
    Building dependency tree...
    Reading state information...
    The following additional packages will be installed:
      libcommons-dbcp-java libcommons-pool-java libecj-java libservlet3.0-java
    Suggested packages:
      libcommons-dbcp-java-doc libgeronimo-jta-1.2-spec-java ant ecj tomcat7
    The following NEW packages will be installed:
      libcommons-dbcp-java libcommons-pool-java libecj-java libservlet3.0-java
      libtomcat7-java
    0 upgraded, 5 newly installed, 0 to remove and 0 not upgraded.
    Need to get 5997 kB of archives.
    After this operation, 7016 kB of additional disk space will be used.
    Get:1 http://deb.debian.org/debian bullseye/main amd64 libcommons-pool-java all 1.6-4 [109 kB]
    Get:2 http://deb.debian.org/debian bullseye/main amd64 libcommons-dbcp-java all 1.4-7 [157 kB]
    Get:3 http://deb.debian.org/debian bullseye/main amd64 libecj-java all 3.16.0-1 [1781 kB]
    Get:4 http://archive.debian.org/debian jessie/main amd64 libservlet3.0-java all 7.0.56-3+deb8u11 [317 kB]
    Get:5 http://archive.debian.org/debian jessie/main amd64 libtomcat7-java all 7.0.56-3+deb8u11 [3634 kB]
    debconf: delaying package configuration, since apt-utils is not installed
    Fetched 5997 kB in 0s (12.5 MB/s)
    Selecting previously unselected package libcommons-pool-java.
    (Reading database ... 12672 files and directories currently installed.)
    Preparing to unpack .../libcommons-pool-java_1.6-4_all.deb ...
    Unpacking libcommons-pool-java (1.6-4) ...
    Selecting previously unselected package libcommons-dbcp-java.
    Preparing to unpack .../libcommons-dbcp-java_1.4-7_all.deb ...
    Unpacking libcommons-dbcp-java (1.4-7) ...
    Selecting previously unselected package libecj-java.
    Preparing to unpack .../libecj-java_3.16.0-1_all.deb ...
    Unpacking libecj-java (3.16.0-1) ...
    Selecting previously unselected package libservlet3.0-java.
    Preparing to unpack .../libservlet3.0-java_7.0.56-3+deb8u11_all.deb ...
    Unpacking libservlet3.0-java (7.0.56-3+deb8u11) ...
    Selecting previously unselected package libtomcat7-java.
    Preparing to unpack .../libtomcat7-java_7.0.56-3+deb8u11_all.deb ...
    Unpacking libtomcat7-java (7.0.56-3+deb8u11) ...
    Setting up libservlet3.0-java (7.0.56-3+deb8u11) ...
    Setting up libecj-java (3.16.0-1) ...
    Setting up libcommons-pool-java (1.6-4) ...
    Setting up libcommons-dbcp-java (1.4-7) ...
    Setting up libtomcat7-java (7.0.56-3+deb8u11) ...
    Removing intermediate container 20c3dd999c50
     ---> c1fdb38567a1
    Successfully built c1fdb38567a1