Docker "Configuring Maintenance" takes a long time

On deploying of a new xibo docker container it takes a really long time to deploy sometimes more than half an hour to pass the point of “Configuring Maintenance” to “Setting up CMS alias”.

I have the same problem on both Ubuntu 18.04.3 LTS and CentOs7 running docker 19.03.4

For Ubuntu running:
Server Version: 19.03.4
Kernel Version: 4.15.0-69-generic
Operating System: Ubuntu 18.04.3 LTS
OSType: linux
Architecture: x86_64
CPUs: 12
Total Memory: 4.788GiB

For CentOs running:
Server Version: 19.03.4
Kernel Version: 3.10.0-957.el7.x86_64
Operating System: CentOS Linux 7 (Core)
OSType: linux
Architecture: x86_64
CPUs: 12
Total Memory: 4.637GiB

Container log:
2019-11-13T14:59:32.349412536Z == 20190315134628 AddBandwidthLimitColumnToDisplaygroupMigration: migrating
2019-11-13T14:59:32.618312135Z == 20190315134628 AddBandwidthLimitColumnToDisplaygroupMigration: migrated 0.2688s
2019-11-13T14:59:32.618338573Z
2019-11-13T14:59:32.618358795Z == 20190322162052 AddPublishedDateColumnMigration: migrating
2019-11-13T14:59:33.224632009Z == 20190322162052 AddPublishedDateColumnMigration: migrated 0.6061s
2019-11-13T14:59:33.224669459Z
2019-11-13T14:59:33.224675794Z == 20190326163016 CreateLayoutHistoryTableMigration: migrating
2019-11-13T14:59:33.616334694Z == 20190326163016 CreateLayoutHistoryTableMigration: migrated 0.3915s
2019-11-13T14:59:33.616381560Z
2019-11-13T14:59:33.616388736Z == 20190328111718 AddCampaignStatMigration: migrating
2019-11-13T14:59:33.635044619Z == 20190328111718 AddCampaignStatMigration: migrated 0.0186s
2019-11-13T14:59:33.635071178Z
2019-11-13T14:59:33.635078264Z == 20190401150256 AddScheduleNowPageMigration: migrating
2019-11-13T14:59:33.668556007Z == 20190401150256 AddScheduleNowPageMigration: migrated 0.0333s
2019-11-13T14:59:33.668589995Z
2019-11-13T14:59:33.668602066Z == 20190509101525 CreateReportScheduleTableMigration: migrating
2019-11-13T14:59:33.866027651Z == 20190509101525 CreateReportScheduleTableMigration: migrated 0.1974s
2019-11-13T14:59:33.866054720Z
2019-11-13T14:59:33.866061741Z == 20190509102648 CreateSavedReportTableMigration: migrating
2019-11-13T14:59:34.191318199Z == 20190509102648 CreateSavedReportTableMigration: migrated 0.3250s
2019-11-13T14:59:34.191353601Z
2019-11-13T14:59:34.191378376Z == 20190509113001 AddReportPageMigration: migrating
2019-11-13T14:59:34.333317520Z == 20190509113001 AddReportPageMigration: migrated 0.1418s
2019-11-13T14:59:34.333379836Z
2019-11-13T14:59:34.333390374Z == 20190510140126 TwoFactorAuthMigration: migrating
2019-11-13T14:59:35.058029137Z == 20190510140126 TwoFactorAuthMigration: migrated 0.7246s
2019-11-13T14:59:35.058053294Z
2019-11-13T14:59:35.058059576Z == 20190514134430 NullableTextFieldsMigration: migrating
2019-11-13T14:59:35.591238029Z == 20190514134430 NullableTextFieldsMigration: migrated 0.5330s
2019-11-13T14:59:35.591279932Z
2019-11-13T14:59:35.591286915Z == 20190515094133 AddHtmlDatatypeMigration: migrating
2019-11-13T14:59:35.682880466Z == 20190515094133 AddHtmlDatatypeMigration: migrated 0.0915s
2019-11-13T14:59:35.682903849Z
2019-11-13T14:59:35.682910539Z == 20190515105624 InstallAdditionalStandardModulesMigration: migrating
2019-11-13T14:59:35.741229070Z == 20190515105624 InstallAdditionalStandardModulesMigration: migrated 0.0582s
2019-11-13T14:59:35.741265706Z
2019-11-13T14:59:35.741274883Z == 20190517080033 AddForeignKeysToLktagTablesMigration: migrating
2019-11-13T14:59:36.141494881Z == 20190517080033 AddForeignKeysToLktagTablesMigration: migrated 0.4000s
2019-11-13T14:59:36.141524538Z
2019-11-13T14:59:36.141531128Z == 20190521092700 AddReportScheduleTaskMigration: migrating
2019-11-13T14:59:36.199645499Z == 20190521092700 AddReportScheduleTaskMigration: migrated 0.0580s
2019-11-13T14:59:36.199671701Z
2019-11-13T14:59:36.199679455Z == 20190521092930 AddPreviousRunDateReportScheduleMigration: migrating
2019-11-13T14:59:36.474710009Z == 20190521092930 AddPreviousRunDateReportScheduleMigration: migrated 0.2749s
2019-11-13T14:59:36.474736595Z
2019-11-13T14:59:36.474743282Z == 20190521102635 PlaylistDurationUpdateAtTimestamp: migrating
2019-11-13T14:59:36.774937607Z == 20190521102635 PlaylistDurationUpdateAtTimestamp: migrated 0.3000s
2019-11-13T14:59:36.774975314Z
2019-11-13T14:59:36.774982516Z == 20190603083836 ChangeStatTableStartEndColumnMigration: migrating
2019-11-13T14:59:36.799827645Z == 20190603083836 ChangeStatTableStartEndColumnMigration: migrated 0.0248s
2019-11-13T14:59:36.799848491Z
2019-11-13T14:59:36.799855106Z == 20190610150331 TagsWithValuesMigration: migrating
2019-11-13T14:59:38.846920217Z == 20190610150331 TagsWithValuesMigration: migrated 2.0469s
2019-11-13T14:59:38.846948201Z
2019-11-13T14:59:38.846954817Z == 20190611145607 RemoveOldVersionTableMigration: migrating
2019-11-13T14:59:38.896983283Z == 20190611145607 RemoveOldVersionTableMigration: migrated 0.0499s
2019-11-13T14:59:38.897026739Z
2019-11-13T14:59:38.897035715Z == 20190612140955 DisplayTableDatabaseSchemaAdjustmentsMigration: migrating
2019-11-13T14:59:47.832106030Z == 20190612140955 DisplayTableDatabaseSchemaAdjustmentsMigration: migrated 8.9348s
2019-11-13T14:59:47.832132528Z
2019-11-13T14:59:47.832139558Z == 20190620112611 MoveTidyStatsToStatsArchiveTaskMigration: migrating
2019-11-13T14:59:48.139160219Z == 20190620112611 MoveTidyStatsToStatsArchiveTaskMigration: migrated 0.3069s
2019-11-13T14:59:48.139186084Z
2019-11-13T14:59:48.139192912Z == 20190620142655 AddPlaylistEnableStatMigration: migrating
2019-11-13T14:59:48.463964404Z == 20190620142655 AddPlaylistEnableStatMigration: migrated 0.3245s
2019-11-13T14:59:48.464015036Z
2019-11-13T14:59:48.464023411Z == 20190626091331 WidgetHistoryMigration: migrating
2019-11-13T14:59:48.689160640Z == 20190626091331 WidgetHistoryMigration: migrated 0.2247s
2019-11-13T14:59:48.689191681Z
2019-11-13T14:59:48.689198309Z == 20190626110359 CreateStatTableMigration: migrating
2019-11-13T14:59:48.931949714Z == 20190626110359 CreateStatTableMigration: migrated 0.2416s
2019-11-13T14:59:48.932003958Z
2019-11-13T14:59:48.932010966Z == 20190628083649 AddStatsMigrationTaskMigration: migrating
2019-11-13T14:59:48.980782946Z == 20190628083649 AddStatsMigrationTaskMigration: migrated 0.0492s
2019-11-13T14:59:48.980834892Z
2019-11-13T14:59:48.980845574Z == 20190710213414 AddIsActiveReportScheduleMigration: migrating
2019-11-13T14:59:49.147338880Z == 20190710213414 AddIsActiveReportScheduleMigration: migrated 0.1663s
2019-11-13T14:59:49.147405105Z
2019-11-13T14:59:49.147412171Z == 20190717101342 NullableCommandValidationStringMigration: migrating
2019-11-13T14:59:49.263840954Z == 20190717101342 NullableCommandValidationStringMigration: migrated 0.1164s
2019-11-13T14:59:49.263867368Z
2019-11-13T14:59:49.263874096Z == 20190719074601 MissingDefaultValueMigration: migrating
2019-11-13T14:59:49.840516207Z == 20190719074601 MissingDefaultValueMigration: migrated 0.5753s
2019-11-13T14:59:49.840546139Z
2019-11-13T14:59:49.840562859Z == 20190801102042 DisplayProfileCommandLinkFixMigration: migrating
2019-11-13T14:59:49.985613399Z == 20190801102042 DisplayProfileCommandLinkFixMigration: migrated 0.1452s
2019-11-13T14:59:49.985648017Z
2019-11-13T14:59:49.985654552Z All Done. Took 56.2927s
2019-11-13T14:59:49.994597845Z Configuring Database Settings
2019-11-13T14:59:50.139606872Z Setting up Maintenance
2019-11-13T14:59:50.139648590Z Protected Maintenance
2019-11-13T14:59:50.222801453Z Importing ca-certs
2019-11-13T14:59:50.224752879Z cp: can’t stat ‘/var/www/cms/ca-certs/.pem’: No such file or directory
2019-11-13T14:59:50.225600564Z cp: can’t stat '/var/www/cms/ca-certs/
.crt’: No such file or directory
2019-11-13T14:59:50.747208067Z WARNING: ca-certificates.crt does not contain exactly one certificate or CRL: skipping
2019-11-13T14:59:50.786258928Z Configuring Maintenance
2019-11-13T15:14:25.226957593Z Removing web/install/index.php from production container
2019-11-13T15:14:25.298331401Z Starting cron
2019-11-13T15:14:25.299562105Z Starting webserver
2019-11-13T15:14:26.317170819Z AH00558: httpd: Could not reliably determine the server’s fully qualified domain name, using 172.18.0.2. Set the ‘ServerName’ directive globally to suppress this message

Any suggestions to improve the deployment time?
~Pascal

Created an issue and pull request to solve the problem: https://github.com/xibosignage/xibo/issues/2010