Closed 0x9394 closed 9 years ago
Theoretically yes, I designed it to be able to be run like that. When the otrs container boots it will check if there's already an 'otrs' database and if true then it will use that one instead of loading a default sql file or a backup, unless OTRS_DROP_DATABASE="yes"
, in that case if the database exists it will be dropped and recreated and loaded by the otrs container.
The other issue is the database host, currently the database container name is hardcoded as 'mariadb'. You have two options here: you could add a custom host entry to the otrs container using when running it using extra_hosts:
on the docker-compose.yml
file:
extra_hosts:
- "mariadb: 1.2.3.4"
were 1.2.3.4 is the external db IP address. The other option would be to modify the code to check for new environment variables like OTRS_DB_SERVER
, OTRS_DB_PORT
and if they are set, use those instead of the harcoded mariadb container name (Take a look at run.sh and functions.sh). PR welcome :)
docker run -d -p "80:80" --name otrs -e OTRS_DB_SERVER=10.16.0.61 -e OTRS_DB_USER=mariadb -e OTRS_DB=mariadb -e OTRS_DB_PASSWORD=password -e OTRS_ROOT_PASSWORD=123 -e OTRS_INSTALL=yes juanluisbaptiste/otrs
docker logs: ERROR 2005 (HY000): Unknown MySQL server host '-p' (2) DB server still isn't up, sleeping a little bit ...
is my environment variable name wrong? thanks.
I said:
"The other option would be to modify the code to check for new environment variables like OTRS_DB_SERVER, OTRS_DB_PORT and if they are set, use those instead of the harcoded mariadb container name (Take a look at run.sh and functions.sh). PR welcome :)
You need to write that code your self, or use the first option.
oh,it's OTRS_DB_SERVER not OTRS_DB_HOST. I think something was wrong in README on the hub.docker.com,please check it
It is OTRS_DB_HOST:
[ -z "${OTRS_DB_HOST}" ] && OTRS_DB_HOST="mariadb"
is it able to use external database? (standalone, not docker) thanks.