Page 1 of 1

Docker Container creates new Repository on each run

PostPosted:Wed Oct 02, 2019 3:40 pm
by kalle42
Hello,

I'm running OpenKM-CE in a docker container on Win10.

To save my changes to the repository I added a volume to the docker run call
Code: Select all
docker run -p 8080:8080 -v C:/users/kalle42/openkm/repository:/opt/openkm/repository openkm/openkm-ce
That worked well and I can see the database files and the uploaded documents in the datastore subfolder in the connected windows folder. After stopping the container all data stays in the connected windows container. But after running the container again, unfortunately all data was remove and a new repository was created.

I had a look to the OpenKM.cfg file
Code: Select all
root@c4fddfc92443:/opt/openkm# more OpenKM.cfg
# OpenKM Hibernate configuration values
hibernate.dialect=org.hibernate.dialect.H2Dialect
#hibernate.dialect=org.hibernate.dialect.HSQLDialect
#hibernate.dialect=org.hibernate.dialect.Oracle10gDialect
#hibernate.dialect=org.hibernate.dialect.SQLServerDialect
#hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
#hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
hibernate.hbm2ddl=none
But I think the "hibernate.hbm2ddl=none" property does no reach the initialization
Code: Select all
02-Oct-2019 12:27:28.052 INFO [localhost-startStop-1] org.springframework.web.context.ContextLoader.initWebApplicationContext Root WebApplicationContext: initialization completed in 10637 ms
2019-10-02 12:27:28,078 [localhost-startStop-1] INFO  com.openkm.core.Config - ** Application OpenKM has DTDs at /opt/openkm/webapps/OpenKM/WEB-INF/classes/dtd **
2019-10-02 12:27:28,086 [localhost-startStop-1] INFO  com.openkm.core.Config - ** Language profiles at /opt/openkm/webapps/OpenKM/WEB-INF/classes/lang-profiles **
2019-10-02 12:27:28,090 [localhost-startStop-1] INFO  com.openkm.core.Config - ** Reading config file /opt/openkm/OpenKM.cfg **
2019-10-02 12:27:28,102 [localhost-startStop-1] INFO  com.openkm.core.Config - LOAD - cloud.max.repository.size=0
2019-10-02 12:27:28,109 [localhost-startStop-1] INFO  com.openkm.core.Config - LOAD - cloud.max.users=0
2019-10-02 12:27:28,110 [localhost-startStop-1] INFO  com.openkm.core.Config - LOAD - cloud.mode=false
2019-10-02 12:27:28,110 [localhost-startStop-1] INFO  com.openkm.core.Config - LOAD - hibernate.create.autofix=true
2019-10-02 12:27:28,111 [localhost-startStop-1] INFO  com.openkm.core.Config - LOAD - hibernate.datasource=java:/comp/env/jdbc/OpenKMDS
2019-10-02 12:27:28,112 [localhost-startStop-1] INFO  com.openkm.core.Config - LOAD - hibernate.dialect=org.hibernate.dialect.H2Dialect
2019-10-02 12:27:28,113 [localhost-startStop-1] INFO  com.openkm.core.Config - LOAD - hibernate.hbm2ddl=create
2019-10-02 12:27:28,114 [localhost-startStop-1] INFO  com.openkm.core.Config - LOAD - hibernate.search.analyzer=org.apache.lucene.analysis.standard.StandardAnalyzer
2019-10-02 12:27:28,116 [localhost-startStop-1] INFO  com.openkm.core.Config - LOAD - hibernate.search.index.exclusive=true
2019-10-02 12:27:28,129 [localhost-startStop-1] INFO  com.openkm.core.Config - LOAD - hibernate.search.index.home=/opt/openkm/repository/index
2019-10-02 12:27:28,130 [localhost-startStop-1] INFO  com.openkm.core.Config - LOAD - hibernate.show_sql=false
2019-10-02 12:27:28,134 [localhost-startStop-1] INFO  com.openkm.core.Config - LOAD - hibernate.statistics=false
This is just an idea, maybe it's sth. else.
Help is appreciated, if someone has a clue, how I can configure the container that openKM connects to an existing repository, if there is one.
Furthermore I'm interested, if that is right way to save all transaction data, that can be created or changed a by users during a session.
Thank you.

Re: Docker Container creates new Repository on each run

PostPosted:Fri Oct 04, 2019 8:22 am
by pavila
Do you do "docker start" or "docker run" again?

Re: Docker Container creates new Repository on each run

PostPosted:Fri Oct 04, 2019 8:38 am
by kalle42
Sorry, I did not know yet, that there is a another way to "run" a docker container.
Usual "Getting Startet" advices do not go further then running the container.

Thinking on that, it makes sense to have this second option.

I will try later, but I think this was my problem. If not, I come back again ...

Thank you and excuse my inexperience,
Kalle

Re: Docker Container creates new Repository on each run

PostPosted:Fri Oct 04, 2019 10:05 am
by pavila
- "run" creates a new container.
- "start" starts the same container again.

I think you should read a Docker tutorial before anything else.

Re: Docker Container creates new Repository on each run

PostPosted:Fri Mar 20, 2020 3:30 pm
by bscott
I had the same problem with a new database being created on docker run.

I edited the OpenKM.cfg file in a running container changing hibernate.hbm2ddl=none to hibernate.hbm2ddl.auto=none.

I then created an image from that container with docker commit <running-container> <new-image>

That fixed the problem for me.

The image is on dockerhub at bscott26/openkm.

The standard openkm/openkm-ce should be run first to create the database.