在docker-compse中复制Nginx.conf的正确方法

时间:2018-11-02 12:27:16

标签: docker nginx

我正在尝试创建一个可以在aws ec2实例上运行的Nginx容器。

这是我的docker-compose文件:

version: '3'

services:
  django: &django
    build:
      context: .
      dockerfile: ./compose/production/django/Dockerfile
    image: digital_ocean_test_production_django
    depends_on:
      - redis
    env_file:
      - ./.envs/.production/.django
    command: /start

  nginx:
    image: nginx:latest
    volumes:
      - ./compose/production/nginx/nginx.conf:/etc/nginx/nginx.conf
    depends_on:
      - django
    ports:
      - "0.0.0.0:80:80"  

  redis:
    image: redis:3.2

但是当我尝试在使用docker-machine构建的ec2实例上运行它时,出现此错误:

ERROR: for nginx_1 Cannot start service nginx: OCI runtime create failed: container_linux.go:348: starting container process caused "process_linux.go:402: container init caused \"rootfs_linux.go:58: mounting \\\"/Users/macbook/macbook_dev/website/compose/production/nginx/nginx.conf\\\" to rootfs \\\"/var/lib/docker/aufs/mnt/8fa43a9f064b21e7e602314f50fd923a51146bc2f0d6f73f6f8e9c7cfa41c18c\\\" at \\\"/var/lib/docker/aufs/mnt/8fa43a9f064b21e7e602314f50fd923a51146bc2f0d6f73f6f8e9c7cfa41c18c/etc/nginx/nginx.conf\\\" caused \\\"not a directory\\\"\"": unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type

如何正确复制Nginx.conf?

0 个答案:

没有答案