Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error installing nextcloud with docker compose

I want to install nextcloud using the official image from the docker hub.

https://hub.docker.com/_/nextcloud/

I tried installing apache on 'Running this image with docker-compose' and copied that piece of code to yaml.

version: '2'

volumes:
  nextcloud:
  db:

services:
  db:
    image: mariadb
    command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
    restart: always
    volumes:
      - db:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=test1234
      - MYSQL_PASSWORD=test1234
      - MYSQL_DATABASE=test
      - MYSQL_USER=test

  app:
    image: nextcloud
    ports:
      - 8080:80
    links:
      - db
    volumes:
      - nextcloud:/var/www/html
    restart: always

Running that file with the docker-compose up -d command results in an error.

ERROR: create _nextcloud: "_nextcloud" includes invalid characters for a local volume name, only a-za-z0-9 a-za-z0-9_.- are allowed

I think this is a problem because the part I put in the volume is blank and I get this error when I delete the part and run it.

ERROR: Named volume "db:/var/lib/mysql:rw" is used in service "db" but no declaration was found in the volumes section

In other posts, it is said that you should specify the absolute path, but it does not seem to me.

Is this how i run it ??

like image 538
윤태일 Avatar asked Oct 31 '25 04:10

윤태일


1 Answers

I suppose your folder where the compose is located has name _nextcloud. The name of folder is prepended to all the global resources created by compose (like volumes or networks). So docker wants to create volume _nextcloud_nextcloud it's not possible to create volumes starting with underscore character as message indicates. Change the folder name and you'll be fine.

like image 174
Ondrej Bardon Avatar answered Nov 02 '25 17:11

Ondrej Bardon



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!