docker rmi 导致后面的命令不执行问题
把ca=`docker rmi sendemail-service`
echo $ca改成docker rmi sendemail-service -f &echo 'docker rmi success'
注意:原理的echo方式单纯在后面加上 -f & 也是不行的,必须直接执行命令才行
Dockerfile设置时区 ENV TZ=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
Dockerfile
FROM java:8VOLUME /tmpADD config/ /config/ENV TZ=Asia/ShanghaiRUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezoneADD sendsms-0.0.1-SNAPSHOT.jar sendsms.jarRUN bash -c 'touch /sendsms.jar'ENTRYPOINT java -Djava.security.egd=file:/dev/./urandom -jar /sendsms.jar
run.sh
#!/bin/bashaa=`docker stop sendsms`echo $aabb=`docker rm sendsms`echo $bbdocker rmi sendsms-service -f &echo 'docker rmi success'b=`docker build -t atomintl/sendsms-service .`echo $bdocker run -d --name sendsms --restart=always sendsms-service;docker logs -f sendsms