dockerfile 做好自启动 退出的解决方法

Dockerfile

FROM insight-hadoop:1.0
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime 
    && echo "Asia/Shanghai" > /etc/timezone
WORKDIR /usr/local/hadoop-2.9.0
EXPOSE 22 50070 8088 19888
COPY start_hadoop.sh /usr/bin/start_hadoop.sh
RUN chmod +x /usr/bin/start_hadoop.sh 
CMD ["/usr/bin/start_hadoop.sh"]

 start_hadoop.sh 
#!/bin/bash
echo 'start hadoop message'
/usr/sbin/sshd && sbin/start-all.sh && sbin/mr-jobhistory-daemon.sh start historyserver && tail -f /dev/null

精华就在 tail -f /dev/null 上
原文地址:https://www.cnblogs.com/sxgaofeng/p/13115805.html