# openHAB-cloud Docker (docker-compose) Setup

**URL:** <https://community.openhab.org/t/openhab-cloud-docker-docker-compose-setup/28147>\
**Category:** openHAB Cloud\
**Tags:** myopenhab, openhabcloud1\
**Created:** [May 10, 2017, 8:45am UTC](https://community.openhab.org/t/openhab-cloud-docker-docker-compose-setup/28147 "2017-05-10T08:45:06Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![MARZIMA](https://community.openhab.org/user_avatar/community.openhab.org/marzima/32/45456_2.png) [@MARZIMA](https://community.openhab.org/u/MARZIMA)\
**Post date:** [May 10, 2017, 8:45am UTC](https://community.openhab.org/t/openhab-cloud-docker-docker-compose-setup/28147/1 "2017-05-10T08:45:06Z")

</div>

Hi all,

we have added docker-compose functionality to the openHAB-cloud.  
You can find instructions in the updated [README](https://github.com/openhab/openhab-cloud/blob/master/README.md).

At the moment there is SSL missing, but we are on it to add Lets Encrypt support to it among other improvements.  
It will be added soon and is listed as Limitations:

- Lets Encrypt SSL is missing in the images and will be added soonThe nginx configuration at
- /etc/nginx\_openhabcloud.conf will be reused

Looking foward for your feedback.  
Thanks & BR  
Mehmet

---

<div class="post-metadata">

**Author:** ![MARZIMA](https://community.openhab.org/user_avatar/community.openhab.org/marzima/32/45456_2.png) [@MARZIMA](https://community.openhab.org/u/MARZIMA)\
**Post date:** [May 10, 2017, 8:52am UTC](https://community.openhab.org/t/openhab-cloud-docker-docker-compose-setup/28147/2 "2017-05-10T08:52:55Z")

</div>

For Quick setup install docker, just clone the openhab-cloud repo, adjust the configs according your URL and the README and hit

` docker-compose up -d`

in the root of the openhab-cloud.

BR Mehmet

---

<div class="post-metadata">

**Author:** ![setterlee](https://community.openhab.org/user_avatar/community.openhab.org/setterlee/32/72241_2.png) [@setterlee](https://community.openhab.org/u/setterlee)\
**Post date:** [May 18, 2017, 1:01pm UTC](https://community.openhab.org/t/openhab-cloud-docker-docker-compose-setup/28147/3 "2017-05-18T13:01:55Z")

</div>

this look great… testing right now…! Thanks

---

<div class="post-metadata">

**Author:** ![Borre\_Tharaldsen](https://community.openhab.org/user_avatar/community.openhab.org/borre_tharaldsen/32/42193_2.png) [@Borre\_Tharaldsen](https://community.openhab.org/u/Borre_Tharaldsen)\
**Post date:** [August 2, 2017, 1:06pm UTC](https://community.openhab.org/t/openhab-cloud-docker-docker-compose-setup/28147/4 "2017-08-02T13:06:15Z")

</div>

I get problems with nginx.  
 ![image](https://community-openhab-org.s3-eu-central-1.amazonaws.com/original/2X/b/bae3500cca7e5becaf81dab39fe517cbcbcabb5f.png)

I have problems to understand what you should do in which config files  
Can you help me?

---

<div class="post-metadata">

**Author:** ![MARZIMA](https://community.openhab.org/user_avatar/community.openhab.org/marzima/32/45456_2.png) [@MARZIMA](https://community.openhab.org/u/MARZIMA)\
**Post date:** [August 2, 2017, 5:44pm UTC](https://community.openhab.org/t/openhab-cloud-docker-docker-compose-setup/28147/5 "2017-08-02T17:44:01Z")

</div>

Of Course! Therefor we are here..

What is the problem? Did you follow the steps in the readme?  
Can you provide more infos, like OS, detailled logs etc

---

<div class="post-metadata">

**Author:** ![Borre\_Tharaldsen](https://community.openhab.org/user_avatar/community.openhab.org/borre_tharaldsen/32/42193_2.png) [@Borre\_Tharaldsen](https://community.openhab.org/u/Borre_Tharaldsen)\
**Post date:** [August 2, 2017, 9:08pm UTC](https://community.openhab.org/t/openhab-cloud-docker-docker-compose-setup/28147/6 "2017-08-02T21:08:59Z")

</div>

I try follow the docker setup for MyOpenHab. I was confused chapter Configuration in the Docker installation. I am new to Docker, so I was wondering if I had to change the host for mogodb and rdis. How do I find the actual host?  
And what happen with t nginx startup? I get errors. I don’t know nginx either and I have problems to understand what modification I have to do with the setup file for this. Can you please expalin more detailed?  
I have installed docker on windows 10

---

<div class="post-metadata">

**Author:** ![Borre\_Tharaldsen](https://community.openhab.org/user_avatar/community.openhab.org/borre_tharaldsen/32/42193_2.png) [@Borre\_Tharaldsen](https://community.openhab.org/u/Borre_Tharaldsen)\
**Post date:** [August 7, 2017, 1:45pm UTC](https://community.openhab.org/t/openhab-cloud-docker-docker-compose-setup/28147/7 "2017-08-07T13:45:24Z")

</div>

I “solve” this. There was a port conflict. I am already using port 80. So I map port 80 to port 85. Would that be any problem?

---

<div class="post-metadata">

**Author:** ![Borre\_Tharaldsen](https://community.openhab.org/user_avatar/community.openhab.org/borre_tharaldsen/32/42193_2.png) [@Borre\_Tharaldsen](https://community.openhab.org/u/Borre_Tharaldsen)\
**Post date:** [August 7, 2017, 1:48pm UTC](https://community.openhab.org/t/openhab-cloud-docker-docker-compose-setup/28147/8 "2017-08-07T13:48:39Z")

</div>

I also get this “bcrypt” error. How can i fix that in the Docker image?  
I suppose I have to start the images without the command, but that’s not easy. Any tips?  
 ![image](https://community-openhab-org.s3-eu-central-1.amazonaws.com/original/2X/1/1079d6411535ca880577b948d88aad76873821ed.png)

---

<div class="post-metadata">

**Author:** ![MARZIMA](https://community.openhab.org/user_avatar/community.openhab.org/marzima/32/45456_2.png) [@MARZIMA](https://community.openhab.org/u/MARZIMA)\
**Post date:** [September 10, 2017, 4:14am UTC](https://community.openhab.org/t/openhab-cloud-docker-docker-compose-setup/28147/9 "2017-09-10T04:14:12Z")

</div>

this was fixed already

---

<div class="post-metadata">

**Author:** ![scantineau](https://community.openhab.org/user_avatar/community.openhab.org/scantineau/32/18773_2.png) [@scantineau](https://community.openhab.org/u/scantineau)\
**Post date:** [July 9, 2018, 10:37am UTC](https://community.openhab.org/t/openhab-cloud-docker-docker-compose-setup/28147/10 "2018-07-09T10:37:32Z")

</div>

Is it possible to use an existing certificate on host ?

I’m using the docker image on my Synology NAS and I’m already using a Let’s Encrypt certificate on my NAS.

---

<div class="post-metadata">

**Author:** ![Richard](https://community.openhab.org/user_avatar/community.openhab.org/richard/32/3819_2.png) [@Richard](https://community.openhab.org/u/Richard)\
**Post date:** [October 31, 2018, 11:27pm UTC](https://community.openhab.org/t/openhab-cloud-docker-docker-compose-setup/28147/11 "2018-10-31T23:27:43Z")

</div>

Hi Marzima,

Thank you for creating this dockerized version.

I am correct the config.json should be in root folder (thus openhab-cloud/) and not in the openhab-cloud/deployment/?

I adapted the config.json as stated in the README file, so this means WITH user and password for mongodb?  
I have it now as followed:

```auto
    "mongodb": {
        "hosts": ["mongodb"],
        "db": "openhab",
        "user": "",
        "password": ""
    },
    "redis": {
        "host": "redis",
        "port": "6379",
        "password": "password"
    },

```

Or did I take the readme to literately?

Anywho, I get errors from the mongodb container with the exit code 100.

> Error while connecting from openHAB-cloud to mongodb: MongoError: getaddrinfo ENOTFOUND mongodb mongodb:27017

and

> Error while connecting from openHAB-cloud to mongodb: MongoError: connect EHOSTUNREACH 172.22.0.4:27017

docker ps gives me: ![Knipsel](https://community-openhab-org.s3.dualstack.eu-central-1.amazonaws.com/original/3X/4/c/4cd2b533cb53c10f5d02d629001362aa5cbebad8.png)

So, as you see, most probably it has to do with the config.json  
Hope you can help to give me a nice containerized openhab-cloud expierence! Thanks

---

<div class="post-metadata">

**Author:** ![Matz666](https://community.openhab.org/letter_avatar_proxy/v4/letter/m/6de8d8/32.png) [@Matz666](https://community.openhab.org/u/Matz666)\
**Post date:** [November 6, 2018, 6:48pm UTC](https://community.openhab.org/t/openhab-cloud-docker-docker-compose-setup/28147/12 "2018-11-06T18:48:43Z")

</div>

I have the same Problem.

Fresh VM with Ubuntu 16.04.

Docker-compose runs fine.

After all the container with mongodb restarts all the Time.

Please fix the Container.

THANKS

---

<div class="post-metadata">

**Author:** ![MARZIMA](https://community.openhab.org/user_avatar/community.openhab.org/marzima/32/45456_2.png) [@MARZIMA](https://community.openhab.org/u/MARZIMA)\
**Post date:** [November 8, 2018, 5:06am UTC](https://community.openhab.org/t/openhab-cloud-docker-docker-compose-setup/28147/13 "2018-11-08T05:06:46Z")

</div>

I think you should give a pw and user.  
I will double check it..

BR Mehmet

---

<div class="post-metadata">

**Author:** ![ppkettu](https://community.openhab.org/user_avatar/community.openhab.org/ppkettu/32/26978_2.png) [@ppkettu](https://community.openhab.org/u/ppkettu)\
**Post date:** [December 12, 2018, 10:47pm UTC](https://community.openhab.org/t/openhab-cloud-docker-docker-compose-setup/28147/14 "2018-12-12T22:47:30Z")

</div>

Same here.

I checked

```csv
docker-compose logs mongodb

```

exception in initAndListen: IllegalOperation: Attempted to create a lock file on a read-only directory: /data/db, terminating

---

<div class="post-metadata">

**Author:** ![William](https://community.openhab.org/user_avatar/community.openhab.org/william/32/72499_2.png) [@William](https://community.openhab.org/u/William)\
**Post date:** [December 19, 2018, 3:35pm UTC](https://community.openhab.org/t/openhab-cloud-docker-docker-compose-setup/28147/15 "2018-12-19T15:35:32Z")

</div>

Hi,  
If I read the documentation correctly , we need to first setup mongodb and redis images first before running the OpenhabCloud docker image.

Isn’t it possible to have just 1 docker image, with everything already pre-configured (mongodb, redis, nginx) ?

In my mind, the idea of docker was to avoid dependencies, and having to use multiple images defeats this purpose.  
Correct me if I am wrong of course.

And thanks again for all your work.

---

<div class="post-metadata">

**Author:** ![SpaceMaster85](https://community.openhab.org/letter_avatar_proxy/v4/letter/s/ad7895/32.png) [@SpaceMaster85](https://community.openhab.org/u/SpaceMaster85)\
**Post date:** [March 21, 2019, 11:30pm UTC](https://community.openhab.org/t/openhab-cloud-docker-docker-compose-setup/28147/16 "2019-03-21T23:30:32Z")

</div>

I had also problems to install openhab cloud correctly.  
MongoDB showed the same error.

I found the solution in an open issue in the repo:  
With the fixed docker-compose file it is just start and play 😉  
After everything started up modify the config files direct in the volume or copy your nginx and openhab config via _docker cp_ to the correct places in the volume.  
Thank you very much @Luca_Calcaterra!!!

> <https://github.com/openhab/openhab-cloud/issues/234#issuecomment-475439023>
>
> Hi,
> 
> doing the tests I was not able to make the services work properly through… docker with docker-compose. With actual docker-compose.yaml (my actual config is ubuntu 18.04 and docker 18.09.1) mongodb not working because say me missing /data/db (even if i create dir as suggested) and nginx proxy not forward to app-1 because it's volume not shared.
> 
> Now with the following config seems to work, if it can help someone... :
> 
> 
> \`\`\`\`yaml
> 
> version: '3'
> services:
> app-1:
> container\_name: app-1
> image: docker.io/openhab/openhabcloud-app
> working\_dir: /opt/openhabcloud
> volumes:
> - app-1:/opt/openhabcloud
> networks:
> - ohcloud-network
> links:
> - mongodb
> - redis
> ports:
> - "3000"
> depends\_on:
> - mongodb
> - redis  
> restart: always     
> mongodb:
> container\_name: mongodb
> image: bitnami/mongodb:latest
> ports:
> - "27017:27017"
> \# command: mongod --smallfiles --bind\_ip\_all
> networks:
> - ohcloud-network
> volumes:
> - /tmp:/bitnami # change /tmp to data dir what you want
> \# - /data/configdb
> restart: always
> redis:
> container\_name: redis
> image: bitnami/redis:latest
> networks:
> - ohcloud-network
> ports:
> - "6379"
> environment:
> - REDIS\_PASSWORD=123\_openHAB
> restart: always
> nginx:
> container\_name: nginx
> image: docker.io/openhab/openhabcloud-nginx
> volumes:
> - app-1:/opt/openhabcloud
> networks:
> - ohcloud-network
> ports:
> - "80:8081"
> - "443:8443"
> links:
> - app-1:app-1
> volumes:
> app-1:
> networks:
> ohcloud-network:
> driver: bridge

---

<div class="post-metadata">

**Author:** ![MARZIMA](https://community.openhab.org/user_avatar/community.openhab.org/marzima/32/45456_2.png) [@MARZIMA](https://community.openhab.org/u/MARZIMA)\
**Post date:** [March 24, 2019, 8:44pm UTC](https://community.openhab.org/t/openhab-cloud-docker-docker-compose-setup/28147/17 "2019-03-24T20:44:46Z")

</div>

I will take a look and fix it

---

<div class="post-metadata">

**Author:** ![Newtt](https://community.openhab.org/letter_avatar_proxy/v4/letter/n/8491ac/32.png) [@Newtt](https://community.openhab.org/u/Newtt)\
**Post date:** [June 3, 2019, 8:43pm UTC](https://community.openhab.org/t/openhab-cloud-docker-docker-compose-setup/28147/18 "2019-06-03T20:43:54Z")

</div>

The docker is still not working… did you fix it ? still the same read lock error among others. Moreover, the doc is not really reflecting files in the repo… could you please update it ?

---

<div class="post-metadata">

**Author:** ![MARZIMA](https://community.openhab.org/user_avatar/community.openhab.org/marzima/32/45456_2.png) [@MARZIMA](https://community.openhab.org/u/MARZIMA)\
**Post date:** [July 3, 2019, 4:03pm UTC](https://community.openhab.org/t/openhab-cloud-docker-docker-compose-setup/28147/19 "2019-07-03T16:03:35Z")

</div>

Yes, I will care for it. I am planing to fix it this weekend.

BR Mehmet

---

<div class="post-metadata">

**Author:** ![ggriesse](https://community.openhab.org/user_avatar/community.openhab.org/ggriesse/32/18740_2.png) [@ggriesse](https://community.openhab.org/u/ggriesse)\
**Post date:** [August 22, 2019, 12:38pm UTC](https://community.openhab.org/t/openhab-cloud-docker-docker-compose-setup/28147/20 "2019-08-22T12:38:05Z")

</div>

Hi

As per the readme it says if i wish to make changes to the config.json i need to do the following to the docker-compose file … however i cant find those lines in the file .. where do i make this change ?

As per readme below …

_If you want to customize the openhab-cloud app or change e.g. configurations within `config.json` , you need to switch to the local build of the node app. Adjust the build stratgy in the `docker-compose.yml` and replace the `image` section of `docker-compose.yml` with the following lines, to not use the official docker hub images anymore and switch to your local sources as base for the app-1 image:_

_```_

- context: ./\*
- dockerfile: ./docker/node/Dockerfile\*  
_```_

[Next page](https://community.openhab.org/t/openhab-cloud-docker-docker-compose-setup/28147.md?page=2)
