version: '3.3'
volumes:
nextcloud: /root/nextcloud/data
db: /tmp/mariadbData
services:
db:
image: mariadb:10.6
restart: always
command: --transaction-isolation=READ-COMMITTED --log-bin=binlog --binlog-format=ROW
volumes:
- /tmp/mariadbData:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=rootnextcloudpass
- MYSQL_PASSWORD=nextcloudpass
- MYSQL_DATABASE=nextcloud
- MYSQL_USER=nextcloud
app:
image: nextcloud
restart: always
ports:
- 8080:80
links:
- db
volumes:
- /root/nextcloud/data:/var/www/html
environment:
- MYSQL_PASSWORD=nextcloudpass
- MYSQL_DATABASE=nextcloud
- MYSQL_USER=nextcloud
- MYSQL_HOST=db
进入容器mariadb
docker exec -it db_nextcloud /bin/bash
mysql登录
mysql -u root -p
set global innodb_read_only_compressed=off;
BOOTPROTO=static #dhcp改为static(修改)
ONBOOT=yes #开机启用本配置,一般在最后一行(修改)
IPADDR=192.168.31.210 #静态IP(增加)
GATEWAY=192.168.31.1 #默认网关,如果是虚拟机桥接模式,就填路由器的网关即可,一般都是.1
NETMASK=255.255.255.0 #子网掩码(增加)
DNS1=192.168.31.1 #DNS 配置,一般和网关相同