Docker Upgrade to OpenHAB 2.1.0 Hangs on Start

Something odd has been happening in my attempts to upgrade OpenHAB to 2.1.0. I run my environment in Docker on a Ubuntu 16.04 LTS server. I flushed out userdata/tmp and userdata/cache, but the startup hangs when trying to bind a port for the Karaf SSH console:

2017-07-15 17:16:10.389 [DEBUG] [org.eclipse.osgi                    ] - FrameworkEvent STARTLEVEL CHANGED - org.eclipse.osgi
2017-07-15 17:16:10.389 [DEBUG] [org.apache.karaf.main.Main          ] - Start level change complete.
2017-07-15 17:16:10.395 [DEBUG] [org.apache.karaf.shell.ssh          ] - ServiceEvent REGISTERED - {org.apache.sshd.SshServer}={service.id=102, service.bundleid=26, service.scope=singleton} - org.apache.karaf.shell.ssh
2017-07-15 17:16:10.396 [INFO ] [ll.impl.action.osgi.CommandExtension] - Registering commands for bundle org.apache.karaf.shell.ssh/4.0.8
2017-07-15 17:16:10.409 [DEBUG] [che.sshd.common.io.nio2.Nio2Acceptor] - Creating Nio2Acceptor
2017-07-15 17:16:10.410 [DEBUG] [che.sshd.common.io.nio2.Nio2Acceptor] - Binding Nio2Acceptor to address /127.0.0.1:8101

Nothing else is using port 8101, so I’m very confused as to why Karaf is freezing at this point. Nothing changes if I leave it alone for an hour, and neither restarting the container nor restarting the host fix the issue. Yet, I can still roll back to 2.0.0-amd64 if I flush the userdata/cache and userdata/tmp folders, so I’m guessing something changed in 2.1.0?

Here’s my docker-compose.yml file, just in case it helps:

services:
   openhab-app:
      container_name: openhab-app
      devices:
         - "/dev/ttyACM0:/dev/ttyACM0"
      environment:
         OPENHAB_HTTPS_PORT: '8443'
         OPENHAB_HTTP_PORT: '8080'
         USER_ID: '1033'
      image: openhab/openhab:2.1.0-amd64
      network_mode: "host"
      restart: always
      volumes:
         - /etc/localtime:/etc/localtime:ro
         - /etc/timezone:/etc/timezone:ro
         - openhab_app_addons:/openhab/addons
         - openhab_app_conf:/openhab/conf
         - openhab_app_java:/openhab/.java
         - openhab_app_userdata:/openhab/userdata
version: '3.2'
volumes:
   openhab_app_addons:
      external: true
   openhab_app_conf:
      external: true
   openhab_app_java:
      external: true
   openhab_app_userdata:
      external: true

Has anyone else been successful upgrading using Docker?

Nevermind, I solved the problem. When you upgrade to a later version of the Docker container, you need to do the following:

  1. Set your userdata volume to a different location (in my environment I changed the NFS volume to point to a folder named userdata-2.1)
  2. Pull and run your updated container. Stop it once it is running and all the bindings have been installed.
  3. Delete the jsondb, openhabcloud and persistence folders from your new userdata folder, as well as the uuid file.
  4. Copy the files/folders from the old userdata folder to the new one. Only copy over objects you deleted in the previous step.
  5. Restart the container. All should be working now.