本文最后更新于 2024年5月16日。
docker-compose.yml文件如下
version: '2.0'
services:
db:
image: mariadb:10.5
container_name: seafile-mysql
environment:
- MYSQL_ROOT_PASSWORD=rootpw # Requested, set the root's password of MySQL service.
- MYSQL_LOG_CONSOLE=true
volumes:
- /home/admin/volumes_seafile/mysql:/var/lib/mysql # Requested, specifies the path to MySQL data persistent store.
networks:
- seafile-net
memcached:
image: memcached:1.6
container_name: seafile-memcached
entrypoint: memcached -m 256
networks:
- seafile-net
seafile:
image: seafileltd/seafile-mc:latest
container_name: seafile
ports:
- "7000:80"
- "7443:443" # If https is enabled, cancel the comment.
#- "80:80"
#- "443:443" # If https is enabled, cancel the comment.
volumes:
- /home/admin/volumes_seafile/seafile:/shared # Requested, specifies the path to Seafile data persistent store.
- /home/admin/volumes_seafile/seafile/nginx/conf:/etc/nginx/conf.d
environment:
- DB_HOST=db
- DB_ROOT_PASSWD=password # Requested, the value shuold be root's password of MySQL service.
- TIME_ZONE=Asia/Shanghai # Optional, default is UTC. Should be uncomment and set to your local time zone.
- SEAFILE_ADMIN_EMAIL=xxxx@outlook.com # Specifies Seafile admin user, default is 'me@example.com'.
- SEAFILE_ADMIN_PASSWORD=seafilepassword # Specifies Seafile admin password, default is 'asecret'.
- SEAFILE_SERVER_LETSENCRYPT=true # Whether use letsencrypt to generate cert.
- SEAFILE_SERVER_HOSTNAME=seafile.xxx.com # Specifies your host name.
depends_on:
- db
- memcached
networks:
- seafile-net
networks:
seafile-net:
切换到yml所在目录
cd /home/admin/compose_seafile
运行如下命令,build
docker-compose build
运行如下命令,启动
docker-compose up -d
nginx总是报找不到证书文件的错误可以这么解决
使用docker容器系统中的绝对路径,并将con.d文件夹映射到主机系统中就可以了。
220919
seafile一番折腾终于成功了
总结点经验就是,如果docker-compose buid出现错误报找不到文件错误,不是python的问题,检查docker是否安装,检查docker是否启动,这次就时因为重启服务器之后docker没有启动还以为时python的问题,花费了很长事件找原因。
修改docker-compose.yml文件之后要先停止已经启动的docker-compose,然后再build才能生效。
查看seafile数据库日志
docker-compose logs -f
查看seafile日志
docker logs -f seafile
进入seafile容器
docker container exec -it seafile bash