Dockerfile CMD instruction will exit the container just after running it

后端 未结 5 2312
伪装坚强ぢ
伪装坚强ぢ 2020-12-13 17:46

I want to setup some configuration when my container starts, for this I am using shell scripts. But my container will exits as soon as my scripts ends, I have tried with -d

5条回答
  •  伪装坚强ぢ
    2020-12-13 17:50

    At your start shell append a line code: tail -f /dev/null or /bin/bash to make sure you shell done and suspend a process in system so that docker container not shutdown.Don't forget to give "chmod +x" access to start.sh. there is demo:

    #!/bin/bash
    cp /root/supervisor/${RUN_SERVICE}.ini /etc/supervisor/conf.d/
    sleep 1
    service supervisor start
    /bin/bash
    

提交回复
热议问题