Docker ERROR: Couldn't find env file: /home/sam/code/docker/.env.dev
14,718
You are specifying that .env file can be found in the location where your docker-compose.yml file is located.
env_file:
- ./.env.dev
Make sure that your .env file is available there. If you don't need any environment variables to be set just remove above line from the docker-compose.yml file.
Related videos on Youtube

Comments
-
Sam B. 11 months
I'm learning how to use docker with Django. So first step is you setup the
Dockerfile
and here's the content of the file.FROM python:3.8.0-alpine # set work directory WORKDIR /usr/src/app # set environment variables ENV PYTHONDONTWRITEBYTECODE 1 ENV PYTHONUNBUFFERED 1 # install dependencies RUN pip install --upgrade pip COPY ./requirements.txt /usr/src/app/requirements.txt RUN pip install -r requirements.txt # copy project COPY . /usr/src/app/
another file the
docker-compose.yml
file content belowversion: '3.7' services: web: build: ./project command: python manage.py runserver 0.0.0.0:8000 volumes: - ./project/:/usr/src/app/ ports: - 8000:8000 env_file: - ./.env.dev
now these two files are in the folder
docker
which also has my django project folder calledproject
keeping it simple :)When I run
docker-compose build
I get back the errorERROR: Couldn't find env file: /home/sam/code/docker/.env.dev
-
Sam B. about 3 yearsfound a tutorial that explains more on the good side also this works
-
friartuck over 2 yearscare to share this tutorial?