If I remove the stuff about the colors it does not give that error:
But it still terminates:
(composer) martinvw@elbrus:~/src/docker-compose/openhab2$ docker-compose up
Starting openhab2_openhab_1 ...
Starting openhab2_openhab_1 ... done
Attaching to openhab2_openhab_1
openhab_1 | + set -euo pipefail
openhab_1 | Starting with openhab user id: 9001
openhab_1 | + IFS='
openhab_1 | '
openhab_1 | + NEW_USER_ID=9001
openhab_1 | + echo 'Starting with openhab user id: 9001'
openhab_1 | + id -u openhab
openhab_1 | + case ${OPENHAB_VERSION} in
openhab_1 | ++ ls -A /openhab/userdata
openhab_1 | + '[' -z 'cache
openhab_1 | config
openhab_1 | etc
openhab_1 | logs
openhab_1 | tmp' ']'
openhab_1 | ++ ls -A /openhab/conf
openhab_1 | + '[' -z 'html
openhab_1 | icons
openhab_1 | items
openhab_1 | persistence
openhab_1 | rules
openhab_1 | scripts
openhab_1 | services
openhab_1 | sitemaps
openhab_1 | sounds
openhab_1 | things
openhab_1 | transform' ']'
openhab_1 | + chown -R openhab:openhab /openhab
openhab_1 | + exec gosu openhab ./start.sh
openhab_1 | Launching the openHAB runtime...
openhab_1 |
openhab_1 | __ _____ ____
openhab_1 | ____ ____ ___ ____ / / / / | / __ )
openhab_1 | / __ \/ __ \/ _ \/ __ \/ /_/ / /| | / __ |
openhab_1 | / /_/ / /_/ / __/ / / / __ / ___ |/ /_/ /
openhab_1 | \____/ .___/\___/_/ /_/_/ /_/_/ |_/_____/
openhab_1 | /_/ 2.2.0-SNAPSHOT
openhab_1 | Build #1034
openhab_1 |
openhab_1 | Hit '<tab>' for a list of available commands
openhab_1 | and '[cmd] --help' for help on a specific command.
openhab_1 | Hit '<ctrl-d>' or type 'system:shutdown' or 'logout' to shutdown openHAB.
openhab_1 |
openhab_1 | openhab@main()> WARNING: EventAdmin: Event Task Processing Interrupted. Events may not be recieved in proper order.
openhab2_openhab_1 exited with code 0
But sometimes without error
(composer) martinvw@elbrus:~/src/docker-compose/openhab2$ docker-compose up
Starting openhab2_openhab_1 ...
Starting openhab2_openhab_1 ... done
Attaching to openhab2_openhab_1
openhab_1 | + set -euo pipefail
openhab_1 | + IFS='
openhab_1 | '
openhab_1 | + NEW_USER_ID=9001
openhab_1 | + echo 'Starting with openhab user id: 9001'
openhab_1 | + id -u openhab
openhab_1 | Starting with openhab user id: 9001
openhab_1 | + case ${OPENHAB_VERSION} in
openhab_1 | ++ ls -A /openhab/userdata
openhab_1 | + '[' -z 'cache
openhab_1 | config
openhab_1 | etc
openhab_1 | logs
openhab_1 | tmp' ']'
openhab_1 | ++ ls -A /openhab/conf
openhab_1 | + '[' -z 'html
openhab_1 | icons
openhab_1 | items
openhab_1 | persistence
openhab_1 | rules
openhab_1 | scripts
openhab_1 | services
openhab_1 | sitemaps
openhab_1 | sounds
openhab_1 | things
openhab_1 | transform' ']'
openhab_1 | + chown -R openhab:openhab /openhab
openhab_1 | + exec gosu openhab ./start.sh
openhab_1 | Launching the openHAB runtime...
openhab_1 |
openhab_1 | __ _____ ____
openhab_1 | ____ ____ ___ ____ / / / / | / __ )
openhab_1 | / __ \/ __ \/ _ \/ __ \/ /_/ / /| | / __ |
openhab_1 | / /_/ / /_/ / __/ / / / __ / ___ |/ /_/ /
openhab_1 | \____/ .___/\___/_/ /_/_/ /_/_/ |_/_____/
openhab_1 | /_/ 2.2.0-SNAPSHOT
openhab_1 | Build #1034
openhab_1 |
openhab_1 | Hit '<tab>' for a list of available commands
openhab_1 | and '[cmd] --help' for help on a specific command.
openhab_1 | Hit '<ctrl-d>' or type 'system:shutdown' or 'logout' to shutdown openHAB.
openhab_1 |
openhab_1 | openhab@main()> openhab2_openhab_1 exited with code 0
This looks strange especially because it exits with code 0, meaning happy AFAIK and the other error is also found in particular when people state that they get that error when shutting down Karaf.
I think it may be something to do with jline and the way docker treats tty terminals. I had the same error and have now managed to work around it by (a) removing the dumb terminal environment as above and (b) adding a -t (which you already seem to have) in my docker run command.
Here’s my full docker run command, in case there is anything else in there that may be playing a part (e.g. privileged?):
EDIT: Sorry, just re-read your original post and realised that you had it working with the docker run command and not the compose file. The problem you are having in the compose file is that you don’t have the -t argument. Try adding the line tty: true into your compose file.