Linux-批处理命令
linux循环执行命令脚本1.新建批处理⽂件,⽂件后缀名为".sh" -- 新建⼀个docker批处理的⽂件
touch docker_batch_test.sh
2.在批处理⽂件中添加执⾏脚本
#!/bin/sh
echo "====================images - remove===================="
docker rmi -f {your_image_name}
echo "====================images - build===================="
docker build -t {your_image_name} /root/release/{your_image_path}
echo "====================container - remove===================="
docker rm -f {your_container_name}
echo "====================container - run===================="
docker run --name {your_container_name} -p 8081:8081 -itd -v /etc/localtime:/etc/localtime:ro -v /ect/timezone:/etc/timezone:ro {your_image_path}
//注意事项:
批处理⽂件第⼀⾏必须是#!/bin/sh
3.执⾏
sh docker_batch_test.sh
附加.脚本添加执⾏权限
chmod 777 docker_batch_test.sh

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。