运行docker-compose up(卷设备问题)后,Nginx容器将无法构建]]

问题描述 投票:0回答:1

我目前正在编写Docker Compose YAML文件,以运行诸如Node.js应用程序,MongoDB和Nginx之类的服务。在构建应用程序和数据库时,Web服务器给我错误:

错误:对于Web服务器,无法启动服务Web服务器:b'安装被拒绝:\ r \ n路径/ User / alan / test \ r \ nis未从OS X共享,并且Docker不知道。\ r \ n您可以配置共享Docker的路径->首选项...->文件S

我不太确定为什么会给我这个错误,但是我知道它与volumes/web-root/driver_opts/device卷有关。

有人能指出我正确的方向吗?

docker-compose.yml

version: '3'

services:
  nodejs:
    build: 
      context: .
      dockerfile: Dockerfile
    image: nodejs
    container_name: nodejs
    restart: unless-stopped
    env_file: .env
    environment:
      - MONGO_USERNAME=$MONGO_USERNAME
      - MONGO_PASSWORD=$MONGO_PASSWORD
      - MONGO_HOSTNAME=db
      - MONGO_PORT=$MONGO_PORT
      - MONGO_DB=$MONGO_DB 
    ports:
      - "81:8080"
    depends_on: 
      - db
    volumes:
      - .:/home/node/app
      - node_modules:/home/node/app/node_modules
    networks:
      - app-network
    command: ./wait-for.sh db:27017 -- /home/node/app/node_modules/.bin/nodemon index.js

  db:
    image: mongo:4.1.8-xenial
    container_name: db
    restart: unless-stopped
    env_file: .env
    environment:
      - MONGO_INITDB_ROOT_USERNAME=$MONGO_USERNAME
      - MONGO_INITDB_ROOT_PASSWORD=$MONGO_PASSWORD
    volumes:  
      - dbdata:/data/db   
    networks:
      - app-network  
    ports:
      - "27017:27017"

  webserver:
    image: nginx:mainline-alpine
    container_name: webserver
    restart: unless-stopped
    ports:
      - "80:80"
    volumes:
      - web-root:/var/www/html
      - ./nginx.conf:/etc/nginx/conf.d/nginx.conf
      - certbot-etc:/etc/letsencrypt
      - certbot-var:/var/lib/letsencrypt
    depends_on:
      - nodejs
      - db
    networks:
      - app-network

  certbot:
    image: certbot/certbot
    container_name: certbot
    volumes:
      - certbot-etc:/etc/letsencrypt
      - certbot-var:/var/lib/letsencrypt
      - web-root:/var/www/html
    depends_on:
      - webserver
    command: certonly --webroot --webroot-path=/var/www/html --email [email protected] --agree-tos --no-eff-email --staging -d bittap.io  -d www.bittap.io

volumes:
  certbot-etc:
  certbot-var:
  web-root:
    driver: local
    driver_opts:
      type: none
      device: /User/alan/test
      o: bind
  dbdata:
  node_modules:  

networks:
  app-network:
    driver: bridge

我目前正在编写Docker Compose YAML文件,以运行诸如Node.js应用程序,MongoDB和Nginx之类的服务。在构建应用程序和数据库时,Web服务器给我错误:ERROR:对于Web服务器...

docker nginx certbot
1个回答
0
投票

根据您的错误消息,您正在运行macOS和Docker 4 Mac。

© www.soinside.com 2019 - 2024. All rights reserved.