Docker文件不起作用!
Dockerfile
# Pull base image
FROM python 3.8
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
# Set work directory
WORKDIR /Django/bookstore/
#Install dependencies
COPY Pipfile Pipfile.lock /Django/
RUN pip install pipenv && pipenv install --system
#COPY project
COPY . /Django/bookstore/
Docker-compose.yml 版本:“ 3.8”
services:
web:
build: .
command: python /Django/manage.py runserver 0.0.0.0:8000
volumes:
- .:/Django
ports:
- 8000:8000
depends_on:
- db
db:
image: postgres:11
volumes:
- postgres_data:/var/lib/postgresql/data/
volumes:
postgres_data:
关于Django 我的目录为 / Django / bookstore / Python版本 3.8.5
当我在cmd上编码Docker时
我看到一个错误
docker-compose up -d --build
Building web
ERROR: Dockerfile parse error line 2: FROM requires either one or three arguments
答案 0 :(得分:1)
请参阅official python Docker image page,这是指定Docker基本映像的方式:
return variable ? "Do something if True" : "Do something if False"