Linux系统使用Docker开发Django项目教程
  • 作者:zhijie
  • 时间:2017-08-17 19:56:03

  Docker Compose

  让我们看一看 docker-compose.yml 文件:

  web:

  restart: always

  build: 。/web

  expose:

  - “8000”

  links:

  - postgres:postgres

  - redis:redis

  volumes:

  - /usr/src/app/static

  env_file: .env

  command: /usr/local/bin/gunicorn docker_django.wsgi:application -w 2 -b :8000

  nginx:

  restart: always

  build: 。/nginx/

  ports:

  - “80:80”

  volumes:

  - /www/static

  volumes_from:

  - web

  links:

  - web:web

  postgres:

  restart: always

  image: postgres:latest

  volumes_from:

  - data

  ports:

  - “5432:5432”

  redis:

  restart: always

  image: redis:latest

  ports:

  - “6379:6379”

  data:

  restart: always

  image: postgres:latest

  volumes:

  - /var/lib/postgresql

  command: true

  在这里,我们定义了五个服务: Web、Nginx、Postgres、Redis 和 Data。

 2/4   首页 上一页 1 2 3 4 下一页 尾页
相关推荐