我无法安装特定版本(1.0.2g)的openssl在docker

mwyxok5s  于 2023-04-29  发布在  Docker
关注(0)|答案(2)|浏览(222)

我想安装openssl版本1。0.2g,所以我写了Dockerfile

RUN apt-get update
RUN apt-get install -y build-essential cmake zlib1g-dev libcppunit-dev git subversion && rm -rf /var/lib/apt/lists/*
RUN wget https://www.openssl.org/source/openssl-1.0.2g.tar.gz -O - | tar -xz
WORKDIR /openssl_1.0.2g
RUN ./config --prefix=/usr/local/openssl --openssldir=/usr/local/openssl

并试图建立它:

Removing intermediate container 0666b2c5021f
 ---> e92f7ed1e3a0
Step 11/14 : WORKDIR /openssl_1.0.2g
Removing intermediate container c8e083d9a453
 ---> 112f18273e8f
Step 12/14 : RUN ./config --prefix=/usr/local/openssl --openssldir=/usr/local/openssl
 ---> Running in 4871c00e5c35
/bin/sh: 1: ./config: not found
The command '/bin/sh -c ./config --prefix=/usr/local/openssl --openssldir=/usr/local/openssl' returned  a non-zero code: 127

但它不起作用..
我该怎么解决?

e4yzc0pl

e4yzc0pl1#

您使用什么基础映像来构建映像?
使用ubuntu:16.04基本镜像和您提供的相同Dockerfile时,它工作得很好:

FROM ubuntu:16.04
RUN apt-get update
RUN apt-get install -y build-essential cmake zlib1g-dev libcppunit-dev git subversion wget && rm -rf /var/lib/apt/lists/*

RUN wget https://www.openssl.org/source/openssl-1.0.2g.tar.gz -O - | tar -xz
WORKDIR /openssl-1.0.2g
RUN ./config --prefix=/usr/local/openssl --openssldir=/usr/local/openssl && make && make install
gywdnpxw

gywdnpxw2#

要在docker上安装最新版本的OPENSSL(版本3+),请执行以下操作(在ubuntu 20上测试)。Debian 10:

RUN apt-get update &&\
    apt-get -y remove openssl &&\
    apt-get -y install build-essential zlib1g-dev &&\
    apt-get -q update && apt-get -qy install wget make &&\
    wget https://www.openssl.org/source/openssl-3.0.5.tar.gz &&\
    tar -xzvf openssl-3.0.5.tar.gz &&\
    cd openssl-3.0.5 &&\
    ./config --prefix=/usr/local/ssl --openssldir=/usr/local/ssl shared zlib &&\
    make &&\
    make install

RUN cat <<'EOT' | tee /etc/ld.so.conf.d/openssl-3.0.5.conf
/usr/local/ssl/lib64
EOT

RUN ldconfig -v &&\
    mv /usr/bin/openssl /usr/bin/openssl.bak &&\
    mv /usr/bin/c_rehash /usr/bin/c_rehash.bak &&\
    update-alternatives --install /usr/bin/openssl openssl /usr/local/ssl/bin/openssl 1 &&\
    update-alternatives --install /usr/bin/c_rehash c_rehash /usr/local/ssl/bin/c_rehash 1

相关问题