Edit files in a dockered Openhab environment (how best to do this)?

Slowly I am migrating from a RPi4 Openhab(ian) towards a dockered Openhab environment on a NUC,
At the moment I have a system that consist of:
Openhab(ian)+Influxdb+Grafana+MQTT with bindings of interest DSRM and Deconz.
Because the old system is still running I do this according to the CTE-method to find what kind of hick-ups are along the way.

So far so good and mostly i can find good examples on the internet but I did not find the proper links yet to edit my files of e.g “influxdb.persist” in other words the complete “conf”-folder. In the old situation I was able to do this with Visual Studio (and I believe as preparation the installation of Samba, amount, etc)

I found a tedious 3-step solution which is mentioned specific for docker:

  1. copy file container to host
  2. edit file
  3. copy file host to container

Does someone has a more most simple solution? :grin:

to avoid questions about CTE = Compare, Trial and Error

Not to come across as rude, but did you read the Docker installation instructions? Both here and on dockerhub it should be made very clear that you need to create folders or Docker volumes and mount those from the host into the container. If you fail to do this, every time you recreate that container, all your changes will be lost. When you do this, the container and the host will share the same conf and userdata folders so any change made there is seen by both.

Note, you should be doing the same with InfluxDB or else you’ll lose your whole database when you change the container.

@rlkoshak Thanks for your reaction, you are not rude because you never know what I read or what was my interpretation was of that reading. I have created volumes and to let the system testify for that:

wj4nuc@nuc5pygh:~$ docker volume ls
local     7e057ecfd24e789f7c4b0a6df28becd21ccb1ae49aec28a44099e31ea60fc7e1
local     eb3d9c510d9d5f918a70263561d96c8f73b9ea2105828183e3fcaa81c75205e3
local     influxdb-storage
local     openhab_openhab_addons
local     openhab_openhab_conf
local     openhab_openhab_userdata

So back to my original question in different words:

How can I add a new persistence in “influxdb.persist” in an easy way?

How did you create the volumes? It’s possible to bind the volume to a directory of your choosing when you create it. In that case, just go to that directory and edit the files there.

If not, I think it puts the volumes in /var/lib/docker/volumes. I don’t use Docker volumes but just mount a host folder into the container, but I’d imagine you’d find some folder under there named “openhab_openhab_conf”. You can edit the files from there.

1 Like

Hi, your right I was able to find my conf data in the folder


disadvantage was also that it was only accessible by root (sudo -i)
Moved those files inside my project (/opt/openhab) with a decent backup/restore steps and in between a new docker compose.

Thanks for your replies.

I would assume you have:

  • a Client (macOS/Windows/Linux/…) with your VS Code installation
  • a (maybe headless?) NUC as Docker Host
  • some Docker Container running on the host
  • some Docker Volumes to persist relevant data on the host

Than maybe use the Remote Development using SSH plugin to keep VS Code as your dev environment and have the plugin ssh into your NUC?

1 Like

@fex, thanks, all correct (NUC even protected key)

I was exploring that today but got a little bit stuck like do i need the Docker Desktop for Windows or is the Docker extension in Visual Code Studio enough, do I need an Azure account (but do not want to do anything with VM).

So far I setup a new working Windows PowerShell towards this headless NUC.
However as soon as I did something inside Visual Studio code with “Remote - SSH” I did something wrong, the other 13,344,108 minus one likely did a better job and after that even my PowerShell was not working anymore.

Try tomorrow a second time with perhaps a better RTFM.

You are running the Docker Container on the NUC, so your Windows Client running VS Code does not need any Docker Tools / Plugins. Docker should be installed on the NUC.
Your Windows Client only needs the Remote via SSH Plugin for VS.

An Azure account shouldn’t come into play at all - that’s Microsoft’s Cloud solution and should have nothing to do with what you do locally??

1 Like

All true, but confused because it was not working, thanks for limiting my combinations. In the end it just appeared to be a stupid error in the ssh-command. With a fresh start this morning and your feedback it is now up-and-running, can even throw away my Samba balls on my Pi :laughing:

For reference and perhaps help to others:

  1. after you gained successful access with PowerShell to your NUC/Linux-device like RPi
  2. the command inside VS-code - Remote Explorer is:
ssh -i ~/.ssh/~/.ssh/id_ed25519 your_user@your_host_name_or_IP
1 Like