Seafile won't start after recreating docker image

I modified the configuration of my seafile docker image (removed a port) and re-created the image. The problem is that the server won’t start now. This is the error:

*** Running /etc/my_init.d/

*** Booting runit daemon...

*** Runit started as PID 24

*** Running /scripts/

[09/03/2021 22:23:01][upgrade]: The container was recreated, running to fix the media symlinks

[09/03/2021 22:23:01][upgrade]: Running script /opt/seafile/seafile-server-8.0.3/upgrade/

[2021-09-03 22:23:01] Skip running because there is existing seafile-data folder.

Traceback (most recent call last):

  File "/scripts/", line 86, in <module>


  File "/scripts/", line 58, in main


  File "/scripts/", line 169, in check_upgrade


  File "/scripts/", line 80, in fix_media_symlinks


  File "/scripts/", line 84, in run_minor_upgrade

    run_script_and_update_version_stamp(minor_upgrade_script, current_version)

  File "/scripts/", line 60, in run_script_and_update_version_stamp

    replace_file_pattern(script, 'read dummy', '')

  File "/scripts/", line 295, in replace_file_pattern

    with open(fn, 'r') as fp:

FileNotFoundError: [Errno 2] No such file or directory: '/opt/seafile/seafile-server-8.0.3/upgrade/'

*** /scripts/ exited with status 1.

*** Shutting down runit daemon (PID 24)...

*** Running /etc/my_init.post_shutdown.d/10_syslog-ng.shutdown...

*** Killing all processes...

I’m not sure what to do now. If I recreate the image how do I get the data back?

I’d recommend starting your container it using a different endpoint, e.g. /bin/bash
Then you can go see what’s in /opt/seafile – you can check to be sure that the seafile-server-8.0.3 directory exists: what’s the output of ls -al from /opt/seafile down to /opt/seafile/seafile-server-8.0.3/upgrade/

The default endpoint restarts seahub container over and over if anything goes wrong. If you feel like recreating it, I can give you some hints to making the command to start it set in docker-compose.yml

I would really like to know how to re-install the container and keep the data. I ended up deleting everything and re-uploading all the data that I had on a computer. But that’s not very practical.

1 Like

Thats doable, I rebuild my containers all the time without data loss, the real difficult part with the current docker (which is all derived from raw iron installs) is that so much is put in to try and guess - I’ve spent a lot of time going through and tracing the startup and upgrade scripts. IMHO it all needs rewritten… which I’ve been doing slightly for my own use. That’s less than ideal.

I use a windows host so I can backup the virtual hard disk that the docker containers reside on, but when re-building I too would like to know if there’s a way to link the new containers to the existing seafile data. I ran an export and comparison of all container data pre and post re-build. The only difference I saw in the (non-binary data) files were references to the docker container Id.

I also compared all data in the seafile / db data folders it creates on my hard drive and did notice the hashed DB password was different in each config file despite using the same pass when doing the initial build and the re-build within my docker compose.

What I observe happening is that the seafile container fails to successfully start until the existing data folders on the hard drive are removed or re-named so that the re-built container can re-create the needed data folders.

Not sure if there is a way to edit the config file database password perhaps to allow the re-built containers to work with the existing data on the hard drive.

So seafile data comes form a DB, right? So - when you update Seadfile are you updating your DB at the same time? If you do - where is your data for the DB stored? If it’s inside docker volume, you’ve got some potential of connecting to that volume with a new container (this is based on older patterns; i manage my volumes with host mounts, I don’t use the docker (i think they’e called named mounts …) So, in my seafile I have a volume to mount all my configs that I manage and version outside of the seafile instance. So those configs are always the same when I’m upgrading my software and in my db I do the same with the databases filesystem, which persists my db files outside of the docker instance and those too then are reused across version updates (which don’t happen nearly as often as a Seafile upgrade). I run my database on a different host than my Seafile instance.