How to resolve docker-compose error: `Error response from daemon: No command specified`

Viewed 382

I'm trying to use docker-compose to run two services: Flask and MySQL.

Here is what I got when I used docker-compose up --build:

[+] Running 1/1
 ⠿ Container myproj-mysql-1     Created                                                     2.4s
 ⠋ Container myproj-web-1  Creating                                                        0.0s
Error response from daemon: No command specified

Any idea what's wrong here?

Here is my docker-compose:

version: '2.5'
services:
  web:
    build:
      context: .
    ports:
      - "8000:5000"
    volumes:
      - ./app:/app
    env_file: .env
    restart: always
    links:
      - mysql:localhost
  mysql:
    image: "mysql:5.7"
    ports:
      - "32000:3306"
    environment:
      MYSQL_RANDOM_ROOT_PASSWORD: yes
    restart: always

And here is the Dockerfile I'm trying to build for the web container:

FROM python:3.7-alpine

COPY . /home

WORKDIR /home

RUN python -m pip install --upgrade pip
RUN pip install -r requirements.txt

ENTRYPOINT [ "python" ]
CMD [ "app.py" ]
1 Answers

I suggest trying CMD [ "python", "app.py" ] without the ENTRYPOINT line.
I typically don't see both CMD and ENTRYPOINT in a dockerfile.

Related