简体   繁体   English

Docker在运行docker-compose时退出代码0

[英]Docker exited with Code 0 on running docker-compose

Below are my files. 以下是我的文件。

DOckerFile DOckerFile

    # Python support can be specified down to the minor or micro version
    # (e.g. 3.6 or 3.6.3).
    # OS Support also exists for jessie & stretch (slim and full).
    # See https://hub.docker.com/r/library/python/ for all supported Python
    # tags from Docker Hub.
    FROM python:3.7.3

    LABEL Name=mindsdb Version=0.0.1

    WORKDIR /app
    ADD . /app

    RUN  pip install mindsdb

**Docker Compose**

version: '3'

services:
  app:
    container_name: mindsdb
    image: mindsdb
    build:
      context: ./
    volumes:
      - /path/to/mindsdb:/app/
    # tty: true

When I enable tty: true it shows the following and gets stuck 当我启用tty: true它显示以下内容并被卡住

Creating mindsdb ... done
Attaching to mindsdb
mindsdb | Python 3.7.3 (default, May  8 2019, 05:28:42) 
mindsdb | [GCC 6.3.0 20170516] on linux
mindsdb | Type "help", "copyright", "credits" or "license" for more information.

By enabling verbose in docker-compose up shoes below: 通过在docker-compose up shoes中启用详细信息:

compose.cli.verbose_proxy.proxy_callable: docker attach -> <generator object socket_raw_iter at 0x104116f68>
compose.cli.verbose_proxy.proxy_callable: docker start <- ('4511f48c4370b53c2f0cbe9f9c6479ebd9f76ad9426f315ef288dbdea947ed5f')
compose.parallel.feed_queue: Pending: set()
compose.parallel.feed_queue: Pending: set()
compose.parallel.feed_queue: Pending: set()
compose.parallel.feed_queue: Pending: set()
compose.parallel.feed_queue: Pending: set()
compose.parallel.feed_queue: Pending: set()
compose.parallel.feed_queue: Pending: set()
compose.parallel.feed_queue: Pending: set()
compose.parallel.feed_queue: Pending: set()
compose.parallel.feed_queue: Pending: set()
urllib3.connectionpool._make_request: http://localhost:None "POST /v1.25/containers/4511f48c4370b53c2f0cbe9f9c6479ebd9f76ad9426f315ef288dbdea947ed5f/start HTTP/1.1" 204 0
compose.cli.verbose_proxy.proxy_callable: docker start -> None
Starting mindsdb ... done
compose.parallel.feed_queue: Pending: set()
compose.parallel.parallel_execute_iter: Finished processing: <Service: app>
compose.parallel.feed_queue: Pending: set()
Attaching to mindsdb
compose.cli.verbose_proxy.proxy_callable: docker events <- (filters={'label': ['com.docker.compose.project=mindsdb', 'com.docker.compose.oneoff=False']}, decode=True)
mindsdb | Python 3.7.3 (default, May  8 2019, 05:28:42) 
mindsdb | [GCC 6.3.0 20170516] on linux
mindsdb | Type "help", "copyright", "credits" or "license" for more information.
urllib3.connectionpool._make_request: http://localhost:None "GET /v1.25/events?filters=%7B%22label%22%3A+%5B%22com.docker.compose.project%3Dmindsdb%22%2C+%22com.docker.compose.oneoff%3DFalse%22%5D%7D HTTP/1.1" 200 None
compose.cli.verbose_proxy.proxy_callable: docker events -> <generator object APIClient._stream_helper at 0x1041913b8>

I don't get why is it getting inside Python shell. 我不知道为什么它进入Python shell。 Even docker run -v /path/to/mindsdb:/app/ -i -t python:3.7.3 is doing similar. 甚至docker run -v /path/to/mindsdb:/app/ -i -t python:3.7.3也在做类似的事情。

This is because you don't have a " CMD " or " ENTRYPOINT " set in your Dockerfile. 这是因为您的Dockerfile中没有设置“ CMD ”或“ ENTRYPOINT ”。

Those two commands will tell the Docker what to execute when entering the docker. 这两个命令将告诉Docker在进入docker时要执行什么。 The reason you're seeing the python shell is probably because that's the default ENTRYPOINT or CMD for the "python:3.7.3" docker that you are inheriting at the start of your Dockerfile.. 您看到python shell的原因可能是因为这是您在Dockerfile开头继承的“python:3.7.3”docker的默认ENTRYPOINT或CMD。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM