docker error /bin/sh: apt-get: command not found

Mixer·2024년 4월 17일
0

minthug@gimmigseoui-MacBookAir backend % docker build -t test .
[+] Building 15.6s (8/9)
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 292B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/library/openjdk:17-jdk 2.8s
=> [internal] load build context 0.1s
=> => transferring context: 2.49MB 0.1s
=> [1/5] FROM docker.io/library/openjdk:17-jdk@sha256:528707081fdb9562eb819128a9f85ae7fe000e2fbaeaf9f87662e7b3f38cb7d8 12.2s
=> => resolve docker.io/library/openjdk:17-jdk@sha256:528707081fdb9562eb819128a9f85ae7fe000e2fbaeaf9f87662e7b3f38cb7d8 0.0s
=> => sha256:416105dc84fc8cf66df5d2c9f81570a2cc36a6cae58aedd4d58792f041f7a2f5 42.02MB / 42.02MB 4.2s
=> => sha256:fe66142579ff5bb0bb5cf989222e2bc77a97dcbd0283887dec04d5b9dfd48cfa 14.29MB / 14.29MB 1.1s
=> => sha256:1250d2aa493e8744c8f6cb528c8a882c14b6d7ff0af6862bbbfe676f60ea979e 186.36MB / 186.36MB 10.7s
=> => sha256:528707081fdb9562eb819128a9f85ae7fe000e2fbaeaf9f87662e7b3f38cb7d8 1.04kB / 1.04kB 0.0s
=> => sha256:2fd12c42c12bf707f7ac0f5fa630ff9c59868dfc4428daaf34df9d82a0c5b101 954B / 954B 0.0s
=> => sha256:4717374ea615130b05563033606c237efe452e58018595092592ed35a1fb8d5e 4.46kB / 4.46kB 0.0s
=> => extracting sha256:416105dc84fc8cf66df5d2c9f81570a2cc36a6cae58aedd4d58792f041f7a2f5 0.7s
=> => extracting sha256:fe66142579ff5bb0bb5cf989222e2bc77a97dcbd0283887dec04d5b9dfd48cfa 0.2s
=> => extracting sha256:1250d2aa493e8744c8f6cb528c8a882c14b6d7ff0af6862bbbfe676f60ea979e 1.4s
=> [2/5] WORKDIR /app 0.2s
=> [3/5] COPY . . 0.1s
=> ERROR [4/5] RUN apt-get update && apt-get install -y findutils 0.2s

=> [4/5] RUN apt-get update && apt-get install -y findutils:
#8 0.160 /bin/sh: apt-get: command not found

executor failed running [/bin/sh -c apt-get update && apt-get install -y findutils]: exit code: 127

해당 오류 원인

FROM openjdk:17-jdk
WORKDIR /app
COPY . .

# 필요한 유틸리티 설치
RUN apt-get update && \
    apt-get install -y findutils

RUN ./gradlew clean build

EXPOSE 8081
ENTRYPOINT ["java", "-jar", "app.jar"]

도커 파일에 이미지가 맞지않아 발생하던 상황이다
로컬에서 사용하는 이미지와 맞게 설정하니 간단히 해결되었다.

profile
Minthug'life

0개의 댓글