Docker Script/ Container

This is a collection of wishes and needs for the next versions of Z-Way/Z-Cloud/Z-Box
Post Reply
chrisgla
Posts: 5
Joined: 24 Apr 2020 21:22

Docker Script/ Container

Post by chrisgla »

Seen multiple threads about Z-Way on Docker and there are multiple containers, but can't see any that have all the persistence links clear or a build script.

Does anyone have a build script or recent container (x86) with persistence?
PerH
Posts: 11
Joined: 03 Nov 2020 17:38

Re: Docker Script/ Container

Post by PerH »

I'm learning Docker right now, and want to learn how to make an image. If someone could tell me which folders needs to be persistent, i could try an make one? Thinking of an ubuntu docker with 3.1.3.
PerH
Posts: 11
Joined: 03 Nov 2020 17:38

Re: Docker Script/ Container

Post by PerH »

EDIT: got the solution from @poltos. this image works fine, and is published on dockerhub.

So, I made the docker, but i'm struggling with transferring my system to it.

I tried to copy the /config/ folder to the docker volume, but that doesn't contain info about logon details or room configuration. Can someone help me with getting all necessary info in to run it in the docker?

dockerfile:

Code: Select all

#version of container: 0.1.0
FROM ubuntu:20.04
ENV TZ=Europe/Oslo

#add repository and update the container
#Installation of nesesary package/software for this containers...
RUN DEBIAN_FRONTEND="noninteractive" apt-get update && DEBIAN_FRONTEND="noninteractive" apt-get install -y -q wget \
                                          libarchive13 \
                                          libxml2 \
                                          sharutils \
                                          tzdata \
                                          gawk \
                                          libc-ares2 \
                                          libavahi-compat-libdnssd-dev \
                                          libwebsockets15 \
                                          libcurl4 \
                                          && apt --fix-broken install && wget https://storage.z-wave.me/z-way-server/z-way-3.1.3_amd64.deb && dpkg -i z-way-*.deb

CMD ["/bin/bash"]

ENV LD_LIBRARY_PATH=/opt/z-way-server/libs
ENV PATH=/opt/z-way-server:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

VOLUME ["/opt/z-way-server/config/zddl"]

VOLUME ["/opt/z-way-server/automation/storage"]

# to allow access from outside of the container  to the container service
# at that ports need to allow access from firewall if need to access it outside of the server.
EXPOSE 8083

WORKDIR /opt/z-way-server

# Use baseimage-docker's init system.
CMD ["z-way-server"]
docker compose:

Code: Select all

version: "3.9"
services:
  Z-Way:
    container_name: Z-Way
    restart: always
    image: perhu/z-way-server-3-1-3:latest
    networks:
      HAnett:
        ipv4_address: 192.168.0.2
    ports:
      - "8083:8083"
    volumes:
      - type: volume
        source: Z-Way-zddl
        target: /opt/z-way-server/config/zddl
      - type: volume
        source: Z-Way-storage
        target: /opt/z-way-server/automation/storage
    devices:
      - "/dev/serial/by-id/usb-0658_0200-if00:/dev/serial/by-id/usb-0658_0200-if00" #your device here
    environment:
      - ZWAY_VERSION=3.1.3
networks:					#I set up a network for the dockers to communicate, with static IPs
    HAnett:
        name: HAnett
        driver: bridge
        ipam:
            config:
                - subnet: 192.168.0.0/16
                  gateway: 192.168.0.254
volumes:
  Z-Way-zddl:
    name: Z-Way-zddl
  Z-Way-storage:
    name: Z-Way-storage
User avatar
PoltoS
Posts: 6242
Joined: 26 Jan 2011 19:36

Re: Docker Script/ Container

Post by PoltoS »

VOLUME ["/opt/z-way-server/config/zddl"]
should be
VOLUME ["/opt/z-way-server/config/zddx"]
User avatar
PoltoS
Posts: 6242
Joined: 26 Jan 2011 19:36

Re: Docker Script/ Container

Post by PoltoS »

Do you think it is worth to make a deb package with Docker? How would you like to see this if we integrate it?
SweetGenius
Posts: 2
Joined: 25 Jul 2020 07:00

Re: Docker Script/ Container

Post by SweetGenius »

I would love to see a downloadable Docker Image compatible with Docker running on Synology NAS or complete instructions with a docker run command or different versions of docker compose file.
Thanks
PerH
Posts: 11
Joined: 03 Nov 2020 17:38

Re: Docker Script/ Container

Post by PerH »

Sorry, haven't looked into this forum in a while. (which means z-way works well! ;-) )

you are offcourse right about zddx, and i did fix it in my own files.. its just replacing the "l" with an "x" in the files.

I have all my automation components in docker now, and i find it so much easier to maintain! A lot of the HA SW providers are offering official dockers now, so i think taht would be a great addition for z-way.

The one i have works great now, but mabye an alpine build would be better? Mainly thinking of image size, which is fairly large with ubuntu, and size matters on some more bare-bone platforms.

adding my updated dockerfile and compose, as i've added timezone bind. I also changed to docker-compose version 3.7 in hope that the synology users can use it:

dockerfile:

Code: Select all

#version of container: 0.1.0
FROM ubuntu:20.04
ENV TZ=Europe/Oslo

#add repository and update the container
#Installation of nesesary package/software for this containers...
RUN DEBIAN_FRONTEND="noninteractive" apt-get update && DEBIAN_FRONTEND="noninteractive" apt-get install -y -q wget \
                                          libarchive13 \
                                          libxml2 \
                                          sharutils \
                                          tzdata \
                                          gawk \
                                          libc-ares2 \
                                          libavahi-compat-libdnssd-dev \
                                          libwebsockets15 \
                                          libcurl4 \
                                          && apt --fix-broken install && wget https://storage.z-wave.me/z-way-server/z-way-3.1.3_amd64.deb && dpkg -i z-way-*.deb

CMD ["/bin/bash"]

ENV LD_LIBRARY_PATH=/opt/z-way-server/libs
ENV PATH=/opt/z-way-server:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

VOLUME ["/opt/z-way-server/config/zddx"]

VOLUME ["/opt/z-way-server/automation/storage"]

# to allow access from outside of the container  to the container service
# at that ports need to allow access from firewall if need to access it outside of the server.
EXPOSE 8083

WORKDIR /opt/z-way-server

# Use baseimage-docker's init system.
CMD ["z-way-server"]
docker-compose:

Code: Select all

version: "3.7"
services:
  Z-Way:
    container_name: Z-Way #or what you want to call it
    restart: always
    image: perhu/z-way-server-3-1-3:latest
    networks:
      HAnett:  #or whatever you internal docker network is called
        ipv4_address: 192.168.0.2  #this volume gets this IP in the internal network
    ports:
      - "8083:8083" #UI port
    volumes: 
      - type: bind    #timezone sync
        source: /etc/localtime
        target: /etc/localtime
      - type: volume
        source: Z-Way-zddx #Device info storage (i think)
        target: /opt/z-way-server/config/zddx
      - type: volume
        source: Z-Way-storage #application settings
        target: /opt/z-way-server/automation/storage
    devices:
      - "/dev/serial/by-id/usb-0658_0200-if00:/dev/serial/by-id/usb-0658_0200-if00" #your device here
    environment:
      - ZWAY_VERSION=3.1.3
    logging:
        driver: "json-file"
        options:
            max-file: "5"
            max-size: 10m
networks: #I set up a network for the dockers to communicate, with static IPs
    HAnett:
        name: HAnett
        driver: bridge
        ipam:
            config:
                - subnet: 192.168.0.0/16 #subnet of choice
                  gateway: 192.168.0.254 #gateway ip (this can be used to reach ser2net devices on host)
volumes:
  Z-Way-zddx:
    name: Z-Way-zddx
  Z-Way-storage:
    name: Z-Way-storage
Post Reply