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:8 VOLUME /tmp ADD config/ /config/ ENV TZ=Asia/Shanghai RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone ADD sendsms-0.0.1-SNAPSHOT.jar sendsms.jar RUN bash -c 'touch /sendsms.jar' ENTRYPOINT java -Djava.security.egd=file:/dev/./urandom -jar /sendsms.jar
run.sh
#!/bin/bash aa=`docker stop sendsms` echo $aa bb=`docker rm sendsms` echo $bb docker rmi sendsms-service -f & echo 'docker rmi success' b=`docker build -t atomintl/sendsms-service .` echo $b docker run -d --name sendsms --restart=always sendsms-service;docker logs -f sendsms