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

前端 未结 2 797
长发绾君心
长发绾君心 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:45

    I have the same problem, but tty : true doesn't resolve the problem for me.

    This is my docker-compose file :

    ---
    version: "3"
    services :
      data:
        container_name: data
        environment:
          - MYSQL_ROOT_PASSWORD=0283
        image: mysql:5.7
        restart: always
        volumes:
          - "./database:/var/lib/mysql"
        ports:
          - "3306:3306"
      mail:
        container_name: mail
        image: djfarrelly/maildev
        ports:
          - "1080:80"
          - "1025:25"
      web:
        container_name: web
        image: "web:php7.1a"
        links:
          - mail
          - data
        ports:
          - "80:80"
        volumes:
          - "./www:/var/www/html"
        working_dir : /var/www/html
        tty: true
        command:
          echo "test"
          #bash -c "php composer.phar self-update"
    

    After command, Docker return me : "the container is exited (0)" If I comment these lines, the container starts fine.

    Windows 10 Pro
    Docker version 18.09.2, build 6247962
    Docker-compose version 1.23.2, build 1110ad01
    

    Thanks,

提交回复
热议问题