I've been trying to comprehend the difference between command: and command:- in my docker compose file:
Here is my dockerfile:
ENV PYTHONUNBUFFERED=1
COPY requirements.txt .
COPY dbenv .
RUN python3 -m pip install pymysql
RUN pip install mysql-connector-python
RUN pip install openpyxl
RUN pip install lxml
RUN pip install -r requirements.txt
RUN pip install pandas
RUN pip install requests
RUN pip install beautifulsoup4
COPY . .
WORKDIR /MY_DATABASE
And here is my docker compose file:
version: '3.6'
services:
  db:
    image: mysql:latest
    environment: 
      - MYSQL_ROOT_PASSWORD=postgres
      - MYSQL_DATABASE=webscrape
      - MYSQL_USER=django
      - MYSQL_PASSWORD=djangodb
    ports: 
      - 3306:3306
    restart: always
    # cap_add:
    #   - SYS_NICE
  scraper:
    build:
      context: .
      dockerfile: dockerfile
    environment: 
      - MYSQL_ROOT_PASSWORD=postgres
      - MYSQL_DATABASE=webscrape
      - MYSQL_USER=django
      - MYSQL_PASSWORD=djangodb
      - MYSQL_PORT=3306
      - MYSQL_HOST=db
    # working_dir: /MY_DATABASE
    restart: always
    depends_on: 
      - db
    # command: python Security_table/initialize_securities_table.py
    working_dir: /MY_DATABASE
    command: 
      - python Security_table/initialize_securities_table.py
Now if comment the last 2 lines and I uncomment the 3rd last line like below
command: python Security_table/initialize_securities_table.py
Everything will work just as exepected. But if I try to put it in a list format, it won't work.
command: 
  - python Security_table/initialize_securities_table.py
It will tell "no such files or directory: unknown"
What I am missing here?
 
     
    