1

Trying to install nextcloud with docker on windows (Docker version: 19.03.13) and I'm starting windows powershell with admin rights, and using docker-compose up -d.

my compose yaml looks like this:

version: '3'  

services:

  proxy:
    image: jwilder/nginx-proxy:alpine
    labels:
      - "com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy=true"
    container_name: nextcloud-proxy
    networks:
      - nextcloud_network
    ports:
      - 80:80
      - 443:443
    volumes:
      - ./proxy/conf.d:/etc/nginx/conf.d:rw
      - ./proxy/vhost.d:/etc/nginx/vhost.d:rw
      - ./proxy/html:/usr/share/nginx/html:rw
      - ./proxy/certs:/etc/nginx/certs:ro
      - /etc/localtime:/etc/localtime:ro
      - /var/run/docker.sock:/tmp/docker.sock:ro
    restart: unless-stopped
    
  letsencrypt:
    image: jrcs/letsencrypt-nginx-proxy-companion
    container_name: nextcloud-letsencrypt
    depends_on:
      - proxy
    networks:
      - nextcloud_network
    volumes:
      - ./proxy/certs:/etc/nginx/certs:rw
      - ./proxy/vhost.d:/etc/nginx/vhost.d:rw
      - ./proxy/html:/usr/share/nginx/html:rw
      - /etc/localtime:/etc/localtime:ro
      - /var/run/docker.sock:/var/run/docker.sock:ro
    restart: unless-stopped
    
  db:
    image: mariadb
    container_name: nextcloud-mariadb
    networks:
      - nextcloud_network
    volumes:
      - db:/var/lib/mysql
      - /etc/localtime:/etc/localtime:ro
    environment:
      - MYSQL_ROOT_PASSWORD=1984cstr
      - MYSQL_PASSWORD=cstrike
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
    restart: unless-stopped
    
  app:
    image: nextcloud:latest
    container_name: nextcloud-app
    networks:
      - nextcloud_network
    depends_on:
      - letsencrypt
      - proxy
      - db
    volumes:
      - nextcloud:/var/www/html
      - ./app/config:/var/www/html/config
      - ./app/custom_apps:/var/www/html/custom_apps
      - ./app/data:/var/www/html/data
      - ./app/themes:/var/www/html/themes
      - /etc/localtime:/etc/localtime:ro
    environment:
      - VIRTUAL_HOST=nextcloud.example.de
      - LETSENCRYPT_HOST=nextcloud.example.de
      - LETSENCRYPT_EMAIL=realmail@gmail.com
    restart: unless-stopped
    
volumes:
  nextcloud:
  db:

networks:
  nextcloud_network:

But I'm getting the following errors:

ERROR: for nextcloud-mariadb Cannot start service db: OCI runtime create failed: container_linux.go:349: starting container process caused "process_linux.go:449: container init caused "rootfs_linux.go:58: mounting \"/etc/localtime\" to rootfs \"/var/lib/docker/overlay2/5111ae9606906d7a02c039fc8ea7987272d4b2738dabd763fde72bdf56c8bb59/merged\" at \"/var/lib/docker/overlay2/5111ae9606906d7a02c039fc8ea7987272d4b2738dabd763fde72bdf56c8bb59/merged/usr/share/zoneinfo/Etc/UTC\" caused \"not a directory\""": unknown: Are you trying to mount a directory onto a file (or vice-versa)? ChCreating nextcloud-proxy ... done Creating nextcloud-letsencrypt ... done

ERROR: for db Cannot start service db: OCI runtime create failed: container_linux.go:349: starting container process caused "process_linux.go:449: container init caused "rootfs_linux.go:58: mounting \"/etc/localtime\" to rootfs \"/var/lib/docker/overlay2/5111ae9606906d7a02c039fc8ea7987272d4b2738dabd763fde72bdf56c8bb59/merged\" at \"/var/lib/docker/overlay2/5111ae9606906d7a02c039fc8ea7987272d4b2738dabd763fde72bdf56c8bb59/merged/usr/share/zoneinfo/Etc/UTC\" 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 ERROR: Encountered errors while bringing up the project.

What is wrong? Or what additional Information do I need to provide so that the problem can be found?

J. Scott Elblein
  • 4,013
  • 15
  • 58
  • 94
alloisxp
  • 175
  • 3
  • 16

1 Answers1

1

Since you are on a Windows host, the mount paths like /etc/localtime won’t work because they don’t exist on your system. The configuration you are using is for a Linux-based host.

Although, it’s recommended, you can remove those mounts from your services. But, keep in mind that you need to keep the docker socket mount, and you will need to adjust it for a Windows host (since the one you have is also for a Linux host). You can try some solution from here.

Milan Markovic
  • 1,250
  • 13
  • 18