Home > Back-end >  Docker image build failure - wget
Docker image build failure - wget

Time:09-08

I have a docker file in which I do wget to copy something in the image. But the build is failing giving 'wget command not found'. WHen i googled I found suggestions to install wget like below

RUN apt update && apt upgrade
RUN apt install wget

Docker File:

FROM openjdk:17
LABEL maintainer="app"
ARG  uname
ARG  pwd

RUN useradd -ms /bin/bash -u 1000 user1

COPY . /app
WORKDIR /app

RUN ./gradlew build -PmavenUsername=$uname -PmavenPassword=$pwd

ARG YOURKIT_VERSION=2021.11
ARG POLARIS_YK_DIR=YourKit-JavaProfiler-2019.8
RUN wget https://www.yourkit.com/download/docker/YourKit-JavaProfiler-${YOURKIT_VERSION}-docker.zip --no-check-certificate -P /tmp/ && \
  unzip /tmp/YourKit-JavaProfiler-${YOURKIT_VERSION}-docker.zip -d /usr/local && \
  mv /usr/local/YourKit-JavaProfiler-${YOURKIT_VERSION} /usr/local/$POLARIS_YK_DIR && \
  rm /tmp/YourKit-JavaProfiler-${YOURKIT_VERSION}-docker.zip


EXPOSE 10001
EXPOSE 8080
EXPOSE 5005

USER 1000

ENTRYPOINT ["sh", "/docker_entrypoint.sh"]

On doing this I am getting error app-get not found. Can some one suggest any solution.

CodePudding user response:

The openjdk image you use is based on Oracle Linux which uses microdnf rather than apt as it's package manager.

To install wget (and unzip which you also need), you can add this to your Dockerfile:

RUN microdnf update \
 && microdnf install --nodocs wget unzip \
 && microdnf clean all \
 && rm -rf /var/cache/yum

The commands clean up the package cache after installing, to keep the image size as small as possible.

  • Related