我正在嘗試使用以下命令在 MacOS 上創建一個 docker 映像。注意docker build不能運行任何命令,我用npm --version嘗試過,它也找不到npm。
% docker build -<<EOF
# syntax=docker/dockerfile:1
FROM ubuntu:20.04
COPY . /app
RUN make /app
CMD node /app/index.js
EOF
這是我收到的錯誤訊息:
[output clipped...]
=> ERROR [3/3] RUN make /app
------
> [3/3] RUN make /app:
#11 0.200 /bin/sh: 1: make: not found
------
executor failed running [/bin/sh -c make /app]: exit code: 127
但是,已經通過xcode-select安裝了 make :
% /bin/sh -c make /app
make: *** No targets specified and no makefile found. Stop.
有人可以幫我嗎?謝謝!
uj5u.com熱心網友回復:
Docker 無法使用安裝在主機上的軟體。您需要make像這樣安裝在 Dockerfile 中
% docker build -<<EOF
# syntax=docker/dockerfile:1
FROM ubuntu:20.04
RUN apt-get update && apt-get install -y build-essential
COPY . /app
RUN make /app
CMD node /app/index.js
EOF
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/331732.html
