Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

how to use Dockerfile to install openssl?

I am creating a docker image for an application that required OpenSSL 1.1.1 instead of the default 3.0

I added the following command in the Dockerfile

RUN wget -O - https://www.openssl.org/source/openssl-1.1.1u.tar.gz | tar zxf -
RUN cd openssl-1.1.1u 
RUN ./config --prefix=/usr/local

However, the line RUN ./config --prefix=/usr/local throw the following error during building the image.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Error: buildx failed with: ERROR: failed to solve: process "/bin/sh -c ./config –prefix=/usr/local" did not complete successfully: exit code: 127

How can I fix this error?

>Solution :

Each RUN command is separate, so the cd doesn’t persist across them; you’ll need to do something like:

RUN wget -O - https://www.openssl.org/source/openssl-1.1.1u.tar.gz | tar zxf -
RUN cd openssl-1.1.1u; ./config --prefix=/usr/local

In addition, each RUN command creates a new layer in the resulting docker image; if you want to end up with slim images, and especially if you want to clean up files, you may want to combine them even further:

RUN wget -O - https://www.openssl.org/source/openssl-1.1.1u.tar.gz | tar zxf -; \
    cd openssl-1.1.1u; \
    ./config --prefix=/usr/local

(cleaning up files only really removes them if it’s done in the same layer; otherwise, the files are still there, just marked as deleted)

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading