Skip to content

[FIXED] ISPConfig container does not survive restarts (Ìf using volumes for mysql: ERROR: Stopped: Database already contains some tables.,) #24

@MarsWarrior

Description

@MarsWarrior

Fixed!

The Docker file contains the next volumes: "/var/www/","/var/mail/","/var/backup/","/var/lib/mysql","/var/log/"

You have to add the following to, to make the installation script recognize an existing installation, and skip the installation of everything during the restarts of the container:

    volumes:
      - ispconfig_usr:/usr/local/
      - ispconfig_etc:/etc/

Note that bind mounts won't work as they don't copy the existing data to the host folder!

So with the following volumes, ISPConfig seems to survive restarts of the container/service:

version: '3'
services:
  ispconfig:
    container_name: ispconfig
    hostname: YOUR.DOMAIN.COM
    restart: unless-stopped
    image: jerob/docker-ispconfig
    volumes:
      - ispconfig_www:/var/www/
      - ispconfig_mail:/var/mail/
      - ispconfig_backup:/var/backup/
      - ispconfig_mysql:/var/lib/mysql/
      - ispconfig_log:/var/log/
      - ispconfig_usr:/usr/local/
      - ispconfig_etc:/etc/
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    environment:
      - MAILMAN_EMAIL_HOST=YOURMAIL.DOMAIN.COM
      - MAILMAN_EMAIL=TEST@YOURMAIL.DOMAIN.COM
      - MAILMAN_PASS=pass
    network_mode: bridge
    ports:
      - "20:20"
      - "21:21"
      - "30000-30009:30000-30009"
      - "80:80"
      - "444:443"
      - "8080:8080"
      - "53:53"
      - "22:22"
volumes:
  ispconfig_www:
  ispconfig_mail:
  ispconfig_mysql:
  ispconfig_log:
  ispconfig_backup:
  ispconfig_usr:
  ispconfig_etc:

Context

I use your Docker container in a Docker Swarm as a service that is deployed a single time.

If I deploy the ISPConfig service for the first time, everything is ok. If i redeploy the service, the container breaks (well, ISPConfig breaks):
"ERROR: Stopped: Database already contains some tables.,".

As if ISPConfig thinks I'm building a multiserver environment.
https://www.howtoforge.com/community/threads/error-stopped-database-already-contains-some-tables.77574/

Is it because /usr/local/ispconfig is not persisted, ie is empty, BUT the ispconfig database is already there in the mysql database??

Installing MariaDB/MySQL system tables in '/var/lib/mysql' ...,
2019-06-01 17:26:09 139701624802688 [Note] /usr/sbin/mysqld (mysqld 10.1.37-MariaDB-0+deb9u1) starting as process 30 ...,
OK,
Filling help tables...,
2019-06-01 17:26:12 140665441004928 [Note] /usr/sbin/mysqld (mysqld 10.1.37-MariaDB-0+deb9u1) starting as process 61 ...,
OK,
Creating OpenGIS required SP-s...,
2019-06-01 17:26:15 139898439572864 [Note] /usr/sbin/mysqld (mysqld 10.1.37-MariaDB-0+deb9u1) starting as process 90 ...,
OK,
,
To start mysqld at boot time you have to copy,
support-files/mysql.server to the right place for your system,
,
PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER !,
To do so, start the server, then issue the following commands:,
,
'/usr/bin/mysqladmin' -u root password 'new-password',
'/usr/bin/mysqladmin' -u root -h ares.zoefdehaas.com password 'new-password',
,
ternatively you can run:,
'/usr/bin/mysql_secure_installation',
,
which will also give you the option of removing the test,
databases and anonymous user created by default.  This is,
strongly recommended for production servers.,
,
See the MariaDB Knowledgebase at http://mariadb.com/kb or the,
MySQL manual for more instructions.,
,
You can start the MariaDB daemon with:,
cd '/usr' ; /usr/bin/mysqld_safe --datadir='/var/lib/mysql',
,
You can test the MariaDB daemon with mysql-test-run.pl,
cd '/usr/mysql-test' ; perl mysql-test-run.pl,
,
Please report any problems at http://mariadb.org/jira,
,
The latest information about MariaDB is available at http://mariadb.org/.,
You can find additional information about the MySQL part at:,
http://dev.mysql.com,
Consider joining MariaDB's strong and vibrant community:,
https://mariadb.org/get-involved/,
,
Starting MariaDB database server: mysqld.,
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO),
Starting MariaDB database server: mysqld already running.,
,
,
--------------------------------------------------------------------------------,
 _____ ___________   _____              __ _         ____,
|_   _/  ___| ___ \ /  __ \            / _(_)       /__  \,
  | | \ `--.| |_/ / | /  \/ ___  _ __ | |_ _  __ _    _/ /,
  | |  `--. \  __/  | |    / _ \| '_ \|  _| |/ _` |  |_ |,
 _| |_/\__/ / |     | \__/\ (_) | | | | | | | (_| | ___\ \,
 \___/\____/\_|      \____/\___/|_| |_|_| |_|\__, | \____/,
                                              __/ |,
                                             |___/ ,
--------------------------------------------------------------------------------,
,
,
 Initial configuration  ,
,
Operating System: Debian 9.0 (Stretch) or compatible,
,
    Following will be a few questions for primary configuration so be careful.,
    Default values are in [brackets] and can be accepted with <ENTER>.,
    Tap in "quit" (without the quotes) to stop the installer.,
,
,
,
,
,
,
,
,
,
,
,
ERROR: Stopped: Database already contains some tables.,
mkdir: cannot create directory '/var/www/html': File exists,
         _,met$$$$$gg.           @ares.zoefdehaas.com,
      ,g$$$$$$$$$$$$$$$P.        OS: Debian 9.8 stretch,
    ,g$$P""       """Y$$.".      Kernel: x86_64 Linux 4.15.0-50-generic,
   ,$$P'              `$$$.      Uptime: 2d 56m,
  ',$$P       ,ggs.     `$$b:    Packages: 739,
  `d$$'     ,$P"'   .    $$$     Shell: start.sh,
   $$P      d$'     ,    $$P     CPU: Intel Celeron CPU J3455 @ 2.3GHz,
   $$:      $$.   -    ,d$$'     RAM: 1932MiB / 7826MiB,
   $$\;      Y$b._   _,d$P'     ,
   Y$$.    `.`"Y$$$$P"'         ,
   `$$b      "-.__              ,
    `Y$$                        ,
     `Y$$.                      ,
       `$$b.                    ,
         `Y$$b.                 ,
            `"Y$b._             ,
                `""""           ,
                                ,
2019-06-01 17:26:21,970 CRIT Set uid to user 0,
``

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions