[英]How to execute a shell script from Docker file
以下是我的 shell 腳本
#!/bin/bash
#shell script to execute the node js script
echo "Hello World"
這是我的 docker 文件。 我想從 docker 文件中執行這個 shell 腳本。 我正在安裝一些 nodejs 包,這些包將在以后使用,所以暫時忽略它。
FROM node:17.2.0
USER root
WORKDIR /LT
RUN apt-get update
RUN apt-get install git --yes
COPY /LT .
COPY /LT/script.sh . //this is the shell script .
RUN bash script.sh
我沒有收到任何錯誤,但腳本也沒有執行,即 Hello World 沒有打印。
有什么解決辦法?
RUN sh /LT/script.sh
最后這個命令對我有用。 感謝所有的建議
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.