Error when spinning up docker containers after reboot

I am running seafile 12.0.7 community edition in docker containers, and after a reboot I am running in to this error:

eafile  | *** Running /etc/my_init.d/01_create_data_links.sh...
seafile  | *** Booting runit daemon...
seafile  | *** Runit started as PID 16
seafile  | *** Running /scripts/enterpoint.sh...
seafile  | 2025-03-12 20:30:33 Waiting Nginx 
seafile  | 2025-03-12 20:30:33 Nginx ready 
seafile  | 2025-03-12 20:30:33 This is an idle script (infinite loop) to keep container running. 
seafile  | [2025-03-12 20:30:33] Now running setup-seafile-mysql.py in auto mode.
seafile  | Checking python on this machine ...
seafile  | 
seafile  | 
seafile  | verifying password of user root ...  done
seafile  | 
seafile  | verifying password of user seafile ...  done
seafile  | 
seafile  | ---------------------------------
seafile  | This is your configuration
seafile  | ---------------------------------
seafile  | 
seafile  |     server name:            seafile
seafile  |     server ip/domain:       example.com
seafile  | 
seafile  |     seafile data dir:       /opt/seafile/seafile-data
seafile  |     fileserver port:        8082
seafile  | 
seafile  |     database:               create new
seafile  |     ccnet database:         ccnet_db
seafile  |     seafile database:       seafile_db
seafile  |     seahub database:        seahub_db
seafile  |     database user:          seafile
seafile  | 
seafile  | 
seafile  | Generating seafile configuration ...
seafile  | 
seafile  | done
seafile  | Generating seahub configuration ...
seafile  | 
seafile  | ----------------------------------------
seafile  | Now creating seafevents database tables ...
seafile  | 
seafile  | ----------------------------------------
seafile  | ----------------------------------------
seafile  | Now creating ccnet database tables ...
seafile  | 
seafile  | ----------------------------------------
seafile  | ----------------------------------------
seafile  | Now creating seafile database tables ...
seafile  | 
seafile  | ----------------------------------------
seafile  | ----------------------------------------
seafile  | Now creating seahub database tables ...
seafile  | 
seafile  | ----------------------------------------
seafile  | 
seafile  | Error: Failed to init seahub database: Table 'abuse_reports_abusereport' already exists
seafile  | Traceback (most recent call last):
seafile  |   File "/scripts/start.py", line 94, in <module>
seafile  |     main()
seafile  |   File "/scripts/start.py", line 59, in main
seafile  |     init_seafile_server()
seafile  |   File "/scripts/bootstrap.py", line 155, in init_seafile_server
seafile  |     call('{} auto -n seafile'.format(setup_script), env=env)
seafile  |   File "/scripts/utils.py", line 70, in call
seafile  |     return subprocess.check_call(*a, **kw)
seafile  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
seafile  |   File "/usr/lib/python3.12/subprocess.py", line 413, in check_call
seafile  |     raise CalledProcessError(retcode, cmd)
seafile  | subprocess.CalledProcessError: Command '/opt/seafile/seafile-server-12.0.7/setup-seafile-mysql.sh auto -n seafile' returned non-zero exit status 1.

I suspect the issue is with it trying to create a new database, as I am unsure why it would be doing this since setup has already been run before. I did make sure I am running the command in the director with the .env file, and the values in there have not changed.

Any guidance is appreciated.

1 Like

Same issue here. Usually, what happens is the following:

Skip running setup-seafile-mysql.py because there is existing seafile-data folder.

However, if the setup script cannot detect the seafile-data directory (e.g. it was moved, or if you’re using docker and the volume was recreated), the entire script is executed, including migrations on the database which is not necessarily relevant to the seafile-data directory.