Getting Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed error

I am wanting to run Nextcloud within docker. My currently docker-compose.yml file is:

services:
  # Note: PostgreSQL is an external service. You can find more information about the configuration here:
  # https://hub.docker.com/_/postgres
  db:
    # Note: Check the recommend version here: https://docs.nextcloud.com/server/latest/admin_manual/installation/system_requirements.html#server
    image: postgres:alpine
    container_name: pw_cloud_db
    restart: always
    volumes:
      - db:/var/lib/postgresql/data:Z
    env_file:
      - db.env

  # Note: Redis is an external service. You can find more information about the configuration here:
  # https://hub.docker.com/_/redis
  redis:
    image: redis:alpine
    container_name: pw_cloud_redis
    restart: always

  app:
    image: nextcloud:fpm-alpine
    container_name: pw_cloud_main
    restart: always
    volumes:
      - /media/cloud_drive/pw_cloud:/var/www/html
      # NOTE: The `volumes` config of the `cron` and `app` containers must match
    environment:
      - POSTGRES_HOST=db
      - REDIS_HOST=redis
    env_file:
      - db.env
    depends_on:
      - db
      - redis

  # Note: Nginx is an external service. You can find more information about the configuration here:
  # https://hub.docker.com/_/nginx/
  web:
    image: nginx:alpine-slim
    container_name: pw_cloud_nginx
    restart: always
    ports:
      - 127.0.0.1:8080:80
    volumes:
      # https://docs.nextcloud.com/server/latest/admin_manual/installation/nginx.html
      - ./web/nginx.conf:/etc/nginx/nginx.conf:ro  
      # NOTE: The `volumes` included below should match those of the `app` container (unless you know what you're doing)
      - /media/cloud_drive/pw_cloud:/var/www/html
    depends_on:
      - app

  cron:
    image: nextcloud:fpm-alpine
    container_name: pw_cloud_cron
    restart: always
    volumes:
      - /media/cloud_drive/pw_cloud:/var/www/html
      # NOTE: The `volumes` config of the `cron` and `app` containers must match
    entrypoint: /cron.sh
    depends_on:
      - db
      - redis

volumes:
  db:
  nextcloud:

But I am running into this issue:

Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error mounting "/var/containers/pw_cloud/web/nginx.conf" to rootfs at "/etc/nginx/nginx.conf": create mountpoint for /etc/nginx/nginx.conf mount: cannot create subdirectories in "/var/lib/docker/overlay2/f999a4c7acb943347d0f1ef1488bffd6c723b3e0a7afe67ed58ac41e77386956/merged/etc/nginx/nginx.conf": 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

Not sure what I am doing wrong

Do you have the nginx.conf file on your host in the web/ folder your Compose file is located in?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.