Installation in Docker image, access with VS

  • Platform information:
    • DockerHost: Raspberry Pi 3 (Hypriot: https://blog.hypriot.com/)
    • Workstation: Windows 10
    • openHAB version: 2.4 as Docker Image

Hi,
in the past I used Openhabian on a Raspberry Pi. Now I wante to move it into a docker container.
Right now I have set up Hypriot on a Raspberry and installed Openhab like this (from https://hub.docker.com/r/openhab/openhab/):

docker run
–name openhab
–net=host
-v /etc/localtime:/etc/localtime:ro
-v /etc/timezone:/etc/timezone:ro
-v openhab_addons:/openhab/addons
-v openhab_conf:/openhab/conf
-v openhab_userdata:/openhab/userdata
-e “EXTRA_JAVA_OPTS=-Duser.timezone=Europe/Berlin”
-d
–restart=always
openhab/openhab:2.4.0

In Portainer I see the running image and I can access the Openhab Page in my browser.
But now I want to copy my textfiles (rules, things, …) and all this stuff into the according docker volume.
What is the best solution? Do I have to configure a samba server manually on the RP or is there a better solution?

Best regards
Andi

I don’t know if this works on RPi’s yet, but there is a Remote SSH extension to OH that will use an SSH connection to access files directly on your RPi. See https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-ssh-explorer and pay attention to the documentation as it requires you to set up ssh on your Windows machine in a certain way.

Beyond that then yes, you will need to create a Samba share and mount that share as a drive to your Windows machine (apparently it breaks if you don’t mount it as a drive) and access the files through the share.

1 Like

To make it work with RPi you need to use “VSCode - Insiders” and it works well.

1 Like

Thanks for the answers.
I configured a samba server but right now i dont get the permissions right. I shared the volume path ("/var/lib/docker/volumes/") and I can mount it in windows with the root user. But I only can add and modify in this folder not the subfolders. I can access and see all the other files as well but i cant copy my stuff into the according folders.

Probably it’s just one line in the samba config. Maybe some can help :slight_smile:

[global]
workgroup = WORKGROUP
security = user
encrypt passwords = yes
client min protocol = SMB2
client max protocol = SMB3

[Samba-Shares]
comment = Samba-Freigabe
path = /home/shares/
read only = no

[Docker-Volumes]
comment = Docker-Freigabe
path = /var/lib/docker/volumes/
read only = no

Okay my problem is solved. I rewrote the permission with:
“sudo chmod -R 777 /var/lib/docker/volumes/”

Docker seems fine after my changes. I was not sure if the container would start. But right now it seems fine.

Thanks again.