dockercurl

How to install a newer version of curl on a Docker base image shipped with an old version of curl please?


Small question regarding how to install a newer version of curl on an image pre-sipped with an old version of curl

I cannot touch or modify the base image. Currently, the Dockerfile starts with:

FROM customdocker.com/my-organization/must/use/jdk/11:latest as BUILDER

And going inside the container, simple curl version will show a very old curl version.

I just want to use a newer one. I don't want to change anything else. Hence, very naive, I went to change the Dockerfile by adding:

RUN yum install -y curl

While it is building, when I run the image, and execute a curl, I am left with the same old version of curl.

How to install, override the old version with a newer of my choice please?

Thank you!


Solution

  • RUN sudo wget -O /usr/local/bin/curl https://github.com/moparisthebest/static-curl/releases/download/v8.11.0/curl-amd64
    RUN sudo chmod 0555 /usr/local/bin/curl
    

    but don't just blindly copy the url from this post, instead find the newest release url from https://github.com/moparisthebest/static-curl/releases (which, as of writing, is v8.11.0/curl-amd64 )