Dockerfile CMD instruction will exit the container just after running it

后端 未结 5 2316
伪装坚强ぢ
伪装坚强ぢ 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 18:10

    You can also modify your first Dockerfile, replacing

    CMD /usr/local/bin/shell.sh

    by

    CMD /usr/local/bin/shell.sh ; sleep infinity

    That way, your script does not terminate, and your container stays running.

提交回复
热议问题