I’m a newbie using Docker Compose 1.17.1 (within a Plesk-administered VPS running Ubuntu 18.04), and I have been trying to get a container going with a Nextcloud image (15.0.4 for now) and a MariaDB image (10.4.2 for now) configured according to the following yaml file:
> version: '3' > > services: > > db: > image: mariadb:latest > container_name: nextcloud-mariadb > networks: > - nextcloud_network > volumes: > - /opt/mariadb/data:/var/lib/mysql > - /opt/mariadb/log:/var/log/mysql > - /opt/mariadb/config:/etc/mysql/conf.d > - /etc/localtime:/etc/localtime:ro > environment: > - MYSQL_ROOT_PASSWORD=secret > - MYSQL_USER=mariadb_user > - MYSQL_PASSWORD=secret > - MYSQL_DATABASE=nextcloud > restart: unless-stopped > > app: > image: nextcloud:latest > container_name: nextcloud > networks: > - nextcloud_network > depends_on: > - db > volumes: > - /opt/nextcloud/www:/var/www/html > - /opt/nextcloud/data:/var/www/html/data/ > - /opt/nextcloud/config:/var/www/html/config/ > - /opt/nextcloud/apps:/var/www/html/apps/ > - /opt/nextcloud/custom_apps:/var/www/html/custom_apps/ > - /opt/nextcloud/themes:/var/www/html/themes/ > - /etc/localtime:/etc/localtime:ro > environment: > - MYSQL_HOST=db > restart: unless-stopped > > volumes: > nextcloud: > db: > > networks: > nextcloud_network:
Each local image seems to work fine when I try a
docker run command on them separately, but when I try a
docker-compose up -d command using the above yaml file, the MariaDB server does not want to initialize properly. The log shows this problem:
> [ERROR] mysqld: File '/var/log/mysql/mariadb-bin.index' not found (Errcode: 13 "Permission denied")
When I enter
docker ps -a, MariaDB comes up as Restarting (1). Since the MariaDB image doesn’t give me this problem when I run it as a standalone docker container, my guess is that it’s not an issue with the image itself but rather it’s something I’m doing wrong with my docker-compose file.
I tried asking for help on the Nextcloud forum, and received advice to change owner & permission settings for /var/log/mysql. I did that, and did the same for /opt/mariadb/log. Those settings now look like the following:
drwxrwxr-x 2 mysql mysql 4096 Feb 25 06:33 mysql (/var/log/mysql)
drwxrwxr-x 2 mysql mysql 4096 Feb 16 23:54 log (/opt/mariadb/log)
The person helping me at the Nextcloud forum suggested that I would need to change owner & permission settings for /opt/mariadb/log from within the container itself by way of a
docker exec command. I tried
docker exec -it <container name> /bin/bash as advised, but got this response:
> Error response from daemon: Container <containerID> is restarting, wait until the container is running
I seem to be caught in a newbie Catch-22, and I’m not sure what to try next. Any insight is appreciated.