docker初步: build,run,exec

 

1 # build镜像
2 docker build -t zctest6 .
3 # run镜像
4 docker run --name zctest6-1 -itd zctest6
5 # run时载入host文件夹
6 docker run -v /root/zhouchen:/home/wwwroot/zhouchen/ --name zctest6-1 -itd zctest6
7 # 进入container
8 docker exec -it zctest6-1 bash

 

Dockerfile

 1 from keyan-base:1.0.1
 2 
 3 COPY ./dadmin /root/dadmin
 4 COPY ./dserver /root/dserver
 5 COPY ./anno/ /root/ds/anno
 6 COPY ./startup_all.sh /root/startup_all.sh
 7 
 8 #容器入口
 9 ENTRYPOINT ["bash","/root/startup_all.sh"]
10 #CMD ["/bin/sh"]
11 #CMD ["sh","/root/startup_all.sh"]

 

startup_all.sh

/bin/bash /root/ds/shutdown.sh
/bin/bash /root/ds/startup.sh


/bin/bash /root/ds/anno/configure.sh
#等待键盘输入值,防止自动关闭
read -n 1

 

posted @ 2022-05-06 15:06  imoon22  阅读(212)  评论(0编辑  收藏  举报