Docker Migration
From LogicalDOC Community Wiki
Jump to navigationJump to search
Sometimes you want to migrate your running Docker container to another more recent image. This How-To describe a plan to migrate a LogicalDOC Docker installation to another container, please note that this activity is delicate and may lead to data loss.
Assumptions
- Both the current container and the new one are the same version.
- Both the current container and the new one use the same database engine
Definitions
- logicaldoc: represents the name of the current container of the installation to migrate
- logicaldoc_new: represents the name of the new container
Step 1: Backup of the relevant files and folders from current container
- Extract the relevant files and folders with these commands:
$ docker cp logicaldoc:/LogicalDOC/conf conf $ docker cp logicaldoc:/LogicalDOC/repository repository
Step 2: Stop the current container
docker stop logicaldoc
Step 3: Run the new container
It is really important to install the same version of LogicalDOC as the old system and also provide the same database connection parameters and port mappings.
- Assuming your release is the 8.9.3, this could be a sample command to run the new container:
$ docker run -d --name=logicaldoc_new -p 8080:8080 --env LDOC_USERNO=<YOUR_LICENSE_CODE> --env DB_ENGINE=mysql --env DB_HOST=logicaldoc-db --link logicaldoc-db logicaldoc/logicaldoc:8.9.3
- Wait the new contained to complete the installation, check you are able to log into LogicalDOC as user admin like you used to do in the old container.
Step 4: Restore the relevant file in the new contanier
- Now, with the new container up and running, restore the files backed but from the old system
$ docker cp conf/. logicaldoc_new:/LogicalDOC/conf $ docker cp repository/. logicaldoc_new:/LogicalDOC/repository
Step 4: Rename the containers
- These instructions will rename the containers so that the new one will replace the old one
$ docker rename logicaldoc logicaldoc_old $ docker rename logicaldoc_new logicaldoc r