我服务器上已有一个mysql,希望能通过docker的方式连接这个已有的mysql。但是看了官方文档,docker-compose里面的那种方式不太适合我。请问下有办法实现吗?
可以按照文档部署 然后将 docker 数据库的导出到宿主机的mysql。然后修改配置文件里的用户密码和host
自问自答一下,使用的的unraid,有提前准备好的mysql. 只能使用root 账号,不能自定义账号 (或者有我没找到?)。docker-compose 通过外部链接访问mysql, 网络类型br0.
version: '2.0'
services:
seafile:
image: docker.seafile.top/seafileltd/seafile-pro-mc:latest
container_name: seafile
ports:
- "80:80"
- "8082:8082"
# - "443:443" # If https is enabled, cancel the comment.
volumes:
- /mnt/user/nas/seafile:/shared # Requested, specifies the path to Seafile data persistent store.
environment:
- DB_HOST=mariadb
- DB_ROOT_PASSWD=****** # 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=***@***.com # Specifies Seafile admin user, default is 'me@example.com'.
- SEAFILE_ADMIN_PASSWORD=****** # Specifies Seafile admin password, default is 'asecret'.
- SEAFILE_SERVER_LETSENCRYPT=false # Whether use letsencrypt to generate cert.
- SEAFILE_SERVER_HOSTNAME=****.com # Specifies your host name.
external_links:
- mariadb
- memcached
- elasticsearch
networks:
br0:
ipv4_address: 10.10.10.10
networks:
br0:
external: true