echo Configured to generate new fortune every $INTERVAL seconds.
while : do echo $(date) writing fortune to /var/htdocs/index.html >> /var/log/fortune/$(date +%Y-%m-%d).log /usr/games/fortune > /var/htdocs/index.html
sleep$INTERVAL done
修改Dockerfile增加默认参数
1 2 3 4 5 6
FROM ubuntu:latest RUN apt update ; apt install -y fortune ADD fortuneloop.sh /bin/fortuneloop.sh
echo Configured to generate new fortune every $INTERVAL seconds.
while : do echo $(date) writing fortune to /var/htdocs/index.html >> /var/log/fortune/$(date +%Y-%m-%d).log /usr/games/fortune > /var/htdocs/index.html
sleep$INTERVAL done
修改Dockerfile增加默认参数
1 2 3 4 5
FROM ubuntu:latest RUN apt update ; apt install -y fortune ADD fortuneloop.sh /bin/fortuneloop.sh
while : do echo $(date) writing fortune to /var/htdocs/index.html >> /var/log/fortune/$(date +%Y-%m-%d).log /usr/games/fortune > /var/htdocs/index.html
sleep 10 done
每10秒钟生成一次html文件,并记录生成日志
fortune的dockerfile
1 2 3 4 5
FROM ubuntu:latest RUN apt update ; apt install -y fortune ADD fortuneloop.sh /bin/fortuneloop.sh
如果重启提示错误可以可根据提示的命令定位错误原因。 > Job for
docker.service failed because the control process exited with error
code. > > See "systemctl status docker.service" and "journalctl
-xe" for details.