Migrating from 3.4 on debian to 4.0 docker

Hello all,
since longer I plan to migrate my OH 3.4 installation to docker. With the new release I would like to combine the two steps, migrating to 4.0 and also migrating to docker.
Are there any success stories in doing so and what are the basic steps?
First migrate to docker or first migrate to 4.0?
Any recommendations?

Thanks and best regards

1 Like

I’d recommend doing it exactly as you describe. Migrate first to Docker and then migrate to OH 4. It’s super easy to control the version running. That’s how I would do it.

1 Like

Thanks for your opinion. I will try and report.

One more question: will the neccessary data migration be executed when the openhab 4.0 container starts with the 3.4 data? I think that is mandatory.

Yes, when the entrypoint.sh script runs in the container, it compares the version of the configs mounted to the container to the default configs that come with the container. If the versions are different, it performs the same steps that apt/yum does when upgrading software installed through a package manager.


Part 1 successfully done. Not everything worked as expected. Although every configuration was copied some things had to be changed. Scripting languages for rules have to be installed seperately and the configuration for my eps had to be modified. Now I will let it run for some time and if no more glitches occure I will start second step and migrate to 4.0.
I will report.

1 Like

You probably ran into having to update the paths in the /userdata/config files ? I.e. openhab-distro#860. Was there anything else?

I followed How to migrate from installed to dockerized Openhab? Not possible? - #4 by JamieTemple. First I created a new openhab container, let it start and initialize, stopped it again and populated with my config files and jsondb as described in above mentioned post.
Script languages had to be installed as some rules did not work. And my esp binding (nut) had to be reconfigured as the new contained could not connect to ip of dockerhost but to localhost as the containers network is configured as “host”.
All in all it was straight forward, I expected more trouble as my system was OH2 in the beginning, then OH3 and runs for something like 6 years.


Today I made step 2: migration from 3.4.4 to 4.0.2
All in all its very easy with not a single fault, at least with my configuration.
I made a full backup of my openhab docker volume with all configurations. Just to have it if anything fails.
As I use docker-compose with portainer I edited compose file to change the docker image to openhab/openhab:4.0.2. That’s all. Starting new container made a full upgrade of my configuration. I got some hints, that former items without unit will be converted. So I had to add some metadata and everything is fine again.
Openhab developers made a really good job. Thanks for all.

1 Like

Dear joga,

thanks for you story.

Could you please explain your steps from OH 3.4.4 within docker (Raspi 4 : buster?) to OH 4.x (bullseye?) more in detail?

I have a system, like:
Raspi 4, 4 GB, Buster
OH 3.4.4 within Docker
Interface to KNX
Interface to deconz (Conbee II) on separate Raspi

It is better to change at first Buster to Bullseye on Raspi or to build a new Raspi with bullseye and than migrate/copy all docker container (OH 3.4.4, etc.) to the new Raspi?

1 Like

Hi hobaka,

I’m sorry, but I can’t tell anything about upgrading docker itself. I use docker within my Qnap NAS and did only upgrade openhab from 3.4.4 to 4.0.1.
From my point of view you also have to do two steps, the order of them depends. One is to upgrade your system where you can find help in debian forum. The second is to upgrade openhab. For that step you only have to refer the new openhab container in the docker file and recreate the container. The configuration will be migrated during container start. To be safe you should make a backup before starting the new container.
There are lot of hints regarding rules: in my special case I had not much to do: I had installed the different JS runtimes as I have different rules working, some with blockly, some within rule files. For me it is another task to migrate all rules to a single scripting language.
Blockly rule have to be opened and saved again without any change. That way they will be migrated to work within OH4.
Beside some items with units this was the only thing I had to do. All in all it took me little more than an hour until my new upgraded container was running.