簡體   English   中英

使用centos / systemd作為基本映像時,如何在docker文件CMD中啟動init文件和shell腳本文件?

[英]How to launch a init file and shell script file in docker file CMD when using centos/systemd as base image?

我的基本映像是centos/systemd.so我的cmd將包含/usr/sbin/init但我也想在創建容器時運行shell腳本文件。

我的Dockerfile:

FROM centos/systemd

#RUN yum -y install dos2unix


CMD ["usr/sbin/init"]   //here i also want to launch a shell script file

使用解決方案編輯:

FROM centos/systemd 

ADD /path-to-hello/hello.sh ./ 
ENTRYPOINT ["./hello.sh"]

hola.sh的最后一行是exec /usr/sbin/init

構建docker build -t DockerImageName:1.0 .

運行docker run --name DockerName DockerImageName:1.0

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM