Seafile server with docker : can't connect to mysql database

Hello,

I want to install Seafile with Docker.

Here is my docker-compose.yml file

version: '3'

services:
  db:
    image: mariadb:10.11
    container_name: seafile-mysql
    environment:
      - MYSQL_ROOT_PASSWORD=mydbpassword
      - MYSQL_LOG_CONSOLE=true
    volumes:
      - mysql-data:/var/lib/mysql
    restart: unless-stopped
    networks:
      - seafile-net

  memcached:
    image: memcached:latest
    container_name: seafile-memcached
    entrypoint: memcached -m 256
    restart: unless-stopped
    networks:
      - seafile-net

  seafile:
    image: seafileltd/seafile-mc:latest
    container_name: seafile
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - /opt/seafile-data:/shared
    environment:
      - DB_HOST=db
      - DB_ROOT_PASSWD=mydbpassword
      - TIME_ZONE=Etc/UTC
      - SEAFILE_ADMIN_EMAIL=my@email.com
      - SEAFILE_ADMIN_PASSWORD=mypassword
      - SEAFILE_SERVER_LETSENCRYPT=true
      - SEAFILE_SERVER_HOSTNAME=myserver.adress.com
    depends_on:
      - db
      - memcached
    restart: unless-stopped
    networks:
      - seafile-net

networks:
  seafile-net:

volumes:
  mysql-data: {}
  seafile-data: {}

I run :
docker compose up -d

The first part of the installation is ok but there is this message error and the installation does not finish :

waiting for mysql server to be ready: %s (2003, "Can't connect to MySQL server on 'db' ([Errno 111] Connection refused)")
waiting for mysql server to be ready: %s (2003, "Can't connect to MySQL server on 'db' ([Errno 111] Connection refused)")
waiting for mysql server to be ready: %s (2003, "Can't connect to MySQL server on 'db' ([Errno 111] Connection refused)")
waiting for mysql server to be ready: %s (2003, "Can't connect to MySQL server on 'db' ([Errno 111] Connection refused)")
waiting for mysql server to be ready: %s (2003, "Can't connect to MySQL server on 'db' ([Errno 111] Connection refused)")
waiting for mysql server to be ready: %s (2003, "Can't connect to MySQL server on 'db' ([Errno 111] Connection refused)")
Traceback (most recent call last):
  File "/scripts/start.py", line 95, in <module>
    main()
  File "/scripts/start.py", line 59, in main
    init_seafile_server()
  File "/scripts/bootstrap.py", line 222, in init_seafile_server
    call(['mv', '-f', src, dst])
  File "/scripts/utils.py", line 61, in call
    args = [x.strip('"') for x in a[0].split() if '=' not in x]
AttributeError: 'list' object has no attribute 'split'

How can I solve the installation problem?

Thank you for your help :slight_smile:

I have changed

- mysql-data:/var/lib/mysql
to
- /opt/mysql-data:/var/lib/mysql

but the problem is the same

Can’t help directly but I’ve just gone through my very first docker install of Seafile Pro v11 in a lab VM and, to my surprise, it seemed to work. I’ve tested on Ubuntu (Debian) and Rocky Linux (Centos). The only major difference in my composer file is that I didn’t enable LetsEncrypt and stuck with HTTP for now.