前置条件
- 安装docker
- 安装docker-compose
docker-compose.yml 配置文件
version: '3.5'
services:
db_nextcloud:
container_name: db_nextcloud
image: mysql:5.7.35
command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
networks:
cloudnetwork:
ipv4_address: 172.18.0.10
ports:
- 3306:3306
volumes:
- "./db:/var/lib/mysql"
- "./conf/my.cnf:/etc/mysql/conf.d/my.cnf"
environment:
TZ: Asia/Shanghai
MYSQL_ROOT_PASSWORD: nextcloud!@
MYSQL_DATABASE: nextcloud
MYSQL_USER: nextcloud
MYSQL_PASSWORD: nextcloud!@
restart: always
nextcloud:
container_name: nextcloud
image: nextcloud
networks:
cloudnetwork:
ipv4_address: 172.18.0.9
ports:
- 80:80
- 443:443
depends_on:
- db_nextcloud
volumes:
- "./html:/var/www/html" #./data是数据位置,可以修改
restart: always
networks:
cloudnetwork:
ipam:
config:
- subnet: 172.18.0.0/16
创建mysql配置文件
root@alan-ubuntu:/data/docker-compose/nextcloud# mkdir conf/
root@alan-ubuntu:/data/docker-compose/nextcloud# vim conf/my.cnf
[mysqld]
user=mysql
default-storage-engine=INNODB
#character-set-server=utf8
character-set-client-handshake=FALSE
character-set-server=utf8mb4
collation-server=utf8mb4_unicode_ci
init_connect='SET NAMES utf8mb4'
sort_buffer_size=256MB
[client]
#utf8mb4字符集可以存储emoji表情字符
#default-character-set=utf8
default-character-set=utf8mb4
[mysql]
#default-character-set=utf8
default-character-set=utf8mb4
安装
# 创建nextcloud目录
mkdir /nextcloud
# 将上面yml文件复制到/nextcloud
cp docker-compose.yml /nextcloud
# 安装
docker-compose -f docker-compose.yml up -d
验证及配置
配置
机器名为docker容器名及yml中配置的名称
验证
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END
暂无评论内容