[英]Django Docker Image Recreation
As I have created DOCKERFILE file and docker-compose file.因为我已经创建了 DOCKERFILE 文件和 docker-compose 文件。
DOCKERFILE DOCKERFILE
FROM python:3.7-slim-buster
RUN apt-get update && apt-get install -y \
libcurl4-openssl-dev \
libssl-dev
COPY requirements.txt /app/
RUN pip install -r requirements.txt
COPY . /code
EXPOSE 8080
WORKDIR /app
CMD ["python /code/manage.py runserver"]
docker-compose.yml docker-compose.yml
version: '3'
services:
postgres:
image: postgres:12
volumes:
- dbdata:/var/lib/postgresql/data
ports:
- "5432:5432"
django_app:
build: .
tty: true
ports:
- "8080:8080"
volumes:
- .:/app
links:
- postgres
depends_on:
- postgres
volumes:
dbdata:
Once I am making any changes in django requirements file then all the time I have to delete all the images from my system then I have to recreate the whole images by downloading and installing ubuntu images rather be only installing the requirements.一旦我对 django 要求文件进行了任何更改,那么我必须始终从我的系统中删除所有图像,然后我必须通过下载和安装 ubuntu 图像来重新创建整个图像,而不仅仅是安装要求。
Currently I am using this command to run the docker docker-compose -f docker-compose.yml up
.目前我正在使用此命令运行 docker
docker-compose -f docker-compose.yml up
。
Please help me to understand where I am doing wrong in the process.请帮助我了解我在此过程中做错了什么。
the official documentation way to start a docker-compose file is with:启动 docker-compose 文件的官方文档方法是:
$ docker-compose up -d
which by default looks for that file docker-compose.yaml默认情况下查找该文件docker-compose.yaml
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.