Migrating ownCloud to Docker

Hi Guys,

I’m a newbie in Docker and Owncloud, and it will be great if some can help me.

So here is the thing. A few mounts ago, my colleague has migrated Owncoud to the docker swarm. Everything was working until he left, and we need it to reboot nodes on the swarm.

For me, it looks like that something is wrong with our config.php or with database,
but I can’t figure it out.

Here are you can see our config.php:

<?php
$CONFIG = array (
  'apps_paths' =>
  array (
    0 =>
    array (
      'path' => '/var/www/owncloud/apps',
      'url' => '/apps',
      'writable' => false,
    ),
    1 =>
    array (
      'path' => '/var/www/owncloud/custom',
      'url' => '/custom',
      'writable' => true,
    ),
  ),
  'trusted_domains' =>
  array (
    0 => 'my.domain.de',
  ),
  'datadirectory' => '/mnt/data/files',
  'dbtype' => 'mysql',
  'dbhost' => 'db:3306',
  'dbname' => 'owncloud',
  'dbuser' => 'owncloud',
  'dbpassword' => 'owncloud',
  'dbtableprefix' => 'oc_',
  'log_type' => 'owncloud',
  'supportedDatabases' =>
  array (
    0 => 'sqlite',
    1 => 'mysql',
    2 => 'pgsql',
  ),
  'upgrade.disable-web' => true,
  'default_language' => 'en',
  'overwrite.cli.url' => 'http://my.domain.de/',
  'htaccess.RewriteBase' => '/',
  'logfile' => '/mnt/data/files/owncloud.log',
  'loglevel' => 2,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'mysql.utf8mb4' => true,
  'filelocking.enabled' => true,
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => 'redis',
    'port' => '6379',
  ),
  'passwordsalt' => 'VexIq8EDOvkH6Uw8YtMHUHqVMAnwZy',
  'secret' => 'gtFm5fCrwNADh8lPal1napBGhfCCwsy+NHV2VkLYxOnWI/vL',
  'version' => '10.4.1.3',
  'logtimezone' => 'UTC',
  'installed' => true,
  'instanceid' => 'oc64xlydtndk',
  'maintenance' => false,
);


When I try to run:

sudo docker exec -it --user www-data owncloud_owncloud.1.ijelfbqvz0bwgb7ipm6oq4nqo /bin/sh -c “php occ config:list”

I have that output:

An unhandled exception has been thrown:
PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'owncloud.appconfig' doesn't exist in /var/www/owncloud/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:88
Stack trace:
#0 /var/www/owncloud/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php(88): PDO->query('SELECT * FROM `...')
#1 /var/www/owncloud/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(910): Doctrine\DBAL\Driver\PDOConnection->query('SELECT * FROM `...')
#2 /var/www/owncloud/lib/private/DB/Connection.php(187): Doctrine\DBAL\Connection->executeQuery('SELECT * FROM `...', Array, Array, NULL)
#3 /var/www/owncloud/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/Query/QueryBuilder.php(200): OC\DB\Connection->executeQuery('SELECT * FROM `...', Array, Array)
#4 /var/www/owncloud/lib/private/DB/QueryBuilder/QueryBuilder.php(141): Doctrine\DBAL\Query\QueryBuilder->execute()
#5 /var/www/owncloud/lib/private/AppConfig.php(301): OC\DB\QueryBuilder\QueryBuilder->execute()
#6 /var/www/owncloud/lib/private/AppConfig.php(80): OC\AppConfig->loadConfigValues()
#7 /var/www/owncloud/lib/private/AppConfig.php(278): OC\AppConfig->getApps()
#8 /var/www/owncloud/lib/private/legacy/app.php(948): OC\AppConfig->getValues(false, 'installed_versi...')
#9 /var/www/owncloud/lib/private/Server.php(439): OC_App::getAppVersions()
#10 /var/www/owncloud/lib/composer/pimple/pimple/src/Pimple/Container.php(118): OC\Server->OC\{closure}(Object(OC\Server))
#11 /var/www/owncloud/lib/private/AppFramework/Utility/SimpleContainer.php(108): Pimple\Container->offsetGet('MemCacheFactory')
#12 /var/www/owncloud/lib/private/ServerContainer.php(86): OC\AppFramework\Utility\SimpleContainer->query('MemCacheFactory')
#13 /var/www/owncloud/lib/private/Server.php(1203): OC\ServerContainer->query('MemCacheFactory')
#14 /var/www/owncloud/lib/private/Server.php(598): OC\Server->getMemCacheFactory()
#15 /var/www/owncloud/lib/composer/pimple/pimple/src/Pimple/Container.php(118): OC\Server->OC\{closure}(Object(OC\Server))
#16 /var/www/owncloud/lib/private/AppFramework/Utility/SimpleContainer.php(108): Pimple\Container->offsetGet('AppManager')
#17 /var/www/owncloud/lib/private/ServerContainer.php(86): OC\AppFramework\Utility\SimpleContainer->query('AppManager')
#18 /var/www/owncloud/lib/private/Server.php(1419): OC\ServerContainer->query('AppManager')
#19 /var/www/owncloud/lib/private/legacy/app.php(343): OC\Server->getAppManager()
#20 /var/www/owncloud/lib/private/legacy/app.php(107): OC_App::getEnabledApps()
#21 /var/www/owncloud/lib/base.php(585): OC_App::loadApps(Array)
#22 /var/www/owncloud/lib/base.php(1059): OC::init()
#23 /var/www/owncloud/console.php(74): require_once('/var/www/ownclo...')
#24 /var/www/owncloud/occ(11): require_once('/var/www/ownclo...')
#25 {main}

Next Doctrine\DBAL\Driver\PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'owncloud.appconfig' doesn't exist in /var/www/owncloud/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:90
Stack trace:
#0 /var/www/owncloud/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(910): Doctrine\DBAL\Driver\PDOConnection->query('SELECT * FROM `...')
#1 /var/www/owncloud/lib/private/DB/Connection.php(187): Doctrine\DBAL\Connection->executeQuery('SELECT * FROM `...', Array, Array, NULL)
#2 /var/www/owncloud/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/Query/QueryBuilder.php(200): OC\DB\Connection->executeQuery('SELECT * FROM `...', Array, Array)
#3 /var/www/owncloud/lib/private/DB/QueryBuilder/QueryBuilder.php(141): Doctrine\DBAL\Query\QueryBuilder->execute()
#4 /var/www/owncloud/lib/private/AppConfig.php(301): OC\DB\QueryBuilder\QueryBuilder->execute()
#5 /var/www/owncloud/lib/private/AppConfig.php(80): OC\AppConfig->loadConfigValues()
#6 /var/www/owncloud/lib/private/AppConfig.php(278): OC\AppConfig->getApps()
#7 /var/www/owncloud/lib/private/legacy/app.php(948): OC\AppConfig->getValues(false, 'installed_versi...')
#8 /var/www/owncloud/lib/private/Server.php(439): OC_App::getAppVersions()
#9 /var/www/owncloud/lib/composer/pimple/pimple/src/Pimple/Container.php(118): OC\Server->OC\{closure}(Object(OC\Server))
#10 /var/www/owncloud/lib/private/AppFramework/Utility/SimpleContainer.php(108): Pimple\Container->offsetGet('MemCacheFactory')
#11 /var/www/owncloud/lib/private/ServerContainer.php(86): OC\AppFramework\Utility\SimpleContainer->query('MemCacheFactory')
#12 /var/www/owncloud/lib/private/Server.php(1203): OC\ServerContainer->query('MemCacheFactory')
#13 /var/www/owncloud/lib/private/Server.php(598): OC\Server->getMemCacheFactory()
#14 /var/www/owncloud/lib/composer/pimple/pimple/src/Pimple/Container.php(118): OC\Server->OC\{closure}(Object(OC\Server))
#15 /var/www/owncloud/lib/private/AppFramework/Utility/SimpleContainer.php(108): Pimple\Container->offsetGet('AppManager')
#16 /var/www/owncloud/lib/private/ServerContainer.php(86): OC\AppFramework\Utility\SimpleContainer->query('AppManager')
#17 /var/www/owncloud/lib/private/Server.php(1419): OC\ServerContainer->query('AppManager')
#18 /var/www/owncloud/lib/private/legacy/app.php(343): OC\Server->getAppManager()
#19 /var/www/owncloud/lib/private/legacy/app.php(107): OC_App::getEnabledApps()
#20 /var/www/owncloud/lib/base.php(585): OC_App::loadApps(Array)
#21 /var/www/owncloud/lib/base.php(1059): OC::init()
#22 /var/www/owncloud/console.php(74): require_once('/var/www/ownclo...')
#23 /var/www/owncloud/occ(11): require_once('/var/www/ownclo...')
#24 {main}

Next Doctrine\DBAL\Exception\TableNotFoundException: An exception occurred while executing 'SELECT * FROM `appconfig`':

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'owncloud.appconfig' doesn't exist in /var/www/owncloud/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:42
Stack trace:
#0 /var/www/owncloud/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php(169): Doctrine\DBAL\Driver\AbstractMySQLDriver->convertException('An exception oc...', Object(Doctrine\DBAL\Driver\PDOException))
#1 /var/www/owncloud/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php(145): Doctrine\DBAL\DBALException::wrapException(Object(Doctrine\DBAL\Driver\PDOMySql\Driver), Object(Doctrine\DBAL\Driver\PDOException), 'An exception oc...')
#2 /var/www/owncloud/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(913): Doctrine\DBAL\DBALException::driverExceptionDuringQuery(Object(Doctrine\DBAL\Driver\PDOMySql\Driver), Object(Doctrine\DBAL\Driver\PDOException), 'SELECT * FROM `...', Array)
#3 /var/www/owncloud/lib/private/DB/Connection.php(187): Doctrine\DBAL\Connection->executeQuery('SELECT * FROM `...', Array, Array, NULL)
#4 /var/www/owncloud/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/Query/QueryBuilder.php(200): OC\DB\Connection->executeQuery('SELECT * FROM `...', Array, Array)
#5 /var/www/owncloud/lib/private/DB/QueryBuilder/QueryBuilder.php(141): Doctrine\DBAL\Query\QueryBuilder->execute()
#6 /var/www/owncloud/lib/private/AppConfig.php(301): OC\DB\QueryBuilder\QueryBuilder->execute()
#7 /var/www/owncloud/lib/private/AppConfig.php(80): OC\AppConfig->loadConfigValues()
#8 /var/www/owncloud/lib/private/AppConfig.php(278): OC\AppConfig->getApps()
#9 /var/www/owncloud/lib/private/legacy/app.php(948): OC\AppConfig->getValues(false, 'installed_versi...')
#10 /var/www/owncloud/lib/private/Server.php(439): OC_App::getAppVersions()
#11 /var/www/owncloud/lib/composer/pimple/pimple/src/Pimple/Container.php(118): OC\Server->OC\{closure}(Object(OC\Server))
#12 /var/www/owncloud/lib/private/AppFramework/Utility/SimpleContainer.php(108): Pimple\Container->offsetGet('MemCacheFactory')
#13 /var/www/owncloud/lib/private/ServerContainer.php(86): OC\AppFramework\Utility\SimpleContainer->query('MemCacheFactory')
#14 /var/www/owncloud/lib/private/Server.php(1203): OC\ServerContainer->query('MemCacheFactory')
#15 /var/www/owncloud/lib/private/Server.php(598): OC\Server->getMemCacheFactory()
#16 /var/www/owncloud/lib/composer/pimple/pimple/src/Pimple/Container.php(118): OC\Server->OC\{closure}(Object(OC\Server))
#17 /var/www/owncloud/lib/private/AppFramework/Utility/SimpleContainer.php(108): Pimple\Container->offsetGet('AppManager')
#18 /var/www/owncloud/lib/private/ServerContainer.php(86): OC\AppFramework\Utility\SimpleContainer->query('AppManager')
#19 /var/www/owncloud/lib/private/Server.php(1419): OC\ServerContainer->query('AppManager')
#20 /var/www/owncloud/lib/private/legacy/app.php(343): OC\Server->getAppManager()
#21 /var/www/owncloud/lib/private/legacy/app.php(107): OC_App::getEnabledApps()
#22 /var/www/owncloud/lib/base.php(585): OC_App::loadApps(Array)
#23 /var/www/owncloud/lib/base.php(1059): OC::init()
#24 /var/www/owncloud/console.php(74): require_once('/var/www/ownclo...')
#25 /var/www/owncloud/occ(11): require_once('/var/www/ownclo...')

[
I would be thankful for any help or hint.
Thank you!

:smiley: a story as old as time

2 Likes

You also don’t require the whole www-data thing to use occ inside the container, it has a helper script and you can just use occ. Like occ app:list when inside the container.