docker-compose up is starting the container and immediately stopping them

前端 未结 2 796
长发绾君心
长发绾君心 2021-02-20 08:27

I am trying to build services using docker-compose but containers started using docker-compose is stopping immediately as compose script is over. But when i am creating containe

2条回答
  •  北恋
    北恋 (楼主)
    2021-02-20 08:41

    If you use bash as the command, but without a terminal, it will exit immediately. This is because when bash starts up, if there is no terminal attached, and it has no script or other command to execute, it has nothing to do, so it exits (by design).

    You can either use a different command, or attach a terminal with tty: true as part of the definition of this service.

    services:
      composetestdb:
        tty: true
        ...
    

提交回复
热议问题