我在树莓派上构建了家庭服务器,并希望在其上安装带有Docker的nextcloud。
但是nextcloud找不到mariadb。
怎么了?
db:
image: jsurf/rpi-mariadb
command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW --character-set-server=utf8mb4 --collation-server=utf8mb4_general_ci
volumes:
- /media/data/mySQL:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=Foo12345
- MYSQL_PASSWORD=Foo123
- MYSQL_DATABASE=nextcloud
- MYSQL_USER=nextcloud
nextcloud:
image: nextcloud:apache
volumes:
- /media/data/nextCloud:/var/www/html/data
links:
- db
environment:
- MYSQL_ROOT_PASSWORD=Foo12345
- MYSQL_PASSWORD=Foo123
- MYSQL_DATABASE=nextcloud
- MYSQL_USER=nextcloud
- MYSQL_HOST=db
labels:
- "traefik.frontend.rule=Host:cloud.domain.com"
NextCloud启动,但是如果我尝试设置管理员用户,则会出现错误:
mariadb的容器具有IP 172.21.0.4,所以我认为链接有什么问题。但是呢
(172.21.0.5是NextCloud容器的IP)
最佳答案
为了完成安装,我必须在mysql(mariadb)CLI上执行此操作:
CREATE USER 'nextcloud'@'nextcloud-app.nextcloud_app-tier' IDENTIFIED BY 'nextcloud';
GRANT ALL PRIVILEGES ON nextcloud. * TO 'nextcloud'@'nextcloud-app.nextcloud_app-tier' WITH GRANT OPTION;
FLUSH PRIVILEGES;
哪里:它可能会帮助别人。
资料来源:
https://blog.ssdnodes.com/blog/installing-nextcloud-docker/
https://askubuntu.com/questions/763336/cannot-enter-phpmyadmin-as-root-mysql-5-7
关于docker - 为什么nextcloud在Docker中找不到数据库?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/55976099/