Doker
Why docker
Development -> Testing -> Deploy
We need to give everything to testing team including dependency
But it is very hard becasue the entire OS need to ship to testing team
Previous
We use virtual image
What is Docker
give virtual image is too big and is wasting
Come up of containers taht runs on top of OS
Creating App on Docker
-
create docker-compose.yml
-
Dockerfile
FROM python:3
ENV PYTHONUNBUFFERED 1
RUN mkdir /app
WORKING /app
COPY requirements.txt /app/
RUN pip install -r requirements.txt -
requirements.txt
Django==2.2 -
docker-compose.yml
version: ‘3’
services:
web:
build: .
command: python manage.py runserver 0.0.0.0:8000
volumes:
- .:/app
ports:
- “8000:8000” -
docker-compose run web django-admin strartprojet mysite .
-
docker-compose up
本文探讨了Docker如何简化应用从开发到部署的过程,通过创建Dockerfile和docker-compose.yml实现依赖管理和快速启动。重点讲解了Docker容器的优势,如轻量级、环境隔离,并介绍了关键配置文件如Django示例。
1460

被折叠的 条评论
为什么被折叠?



