Docker Script/ Container

This is a collection of wishes and needs for the next versions of Z-Way/Z-Cloud/Z-Box
iotgregg
Posts: 3
Joined: 20 Aug 2021 04:52

Re: Docker Script/ Container

Post by iotgregg »

Hi
I'm very much a docker noob so I tried to start my image from the example posted above and changed the zway server to download the raspberrypi version of the zway server. However I not able to get the image to build. Any help would be appreciated. I have been looking for a current docker image for the zway server but this seems to be the most recent image I could find.

The error I am seeing is:

Code: Select all

[+] Building 47.5s (6/7)
 => [internal] load build definition from Dockerfile                                                                                                                                                                                                                      0.0s
 => => transferring dockerfile: 32B                                                                                                                                                                                                                                       0.0s
 => [internal] load .dockerignore                                                                                                                                                                                                                                         0.0s
 => => transferring context: 2B                                                                                                                                                                                                                                           0.0s
 => [internal] load metadata for docker.io/library/ubuntu:20.04                                                                                                                                                                                                          11.3s
 => [auth] library/ubuntu:pull token for registry-1.docker.io                                                                                                                                                                                                             0.0s
 => CACHED [1/3] FROM docker.io/library/ubuntu:20.04@sha256:82becede498899ec668628e7cb0ad87b6e1c371cb8a1e597d83a47fac21d6af3                                                                                                                                              0.0s
 => ERROR [2/3] RUN DEBIAN_FRONTEND="noninteractive" apt-get update && DEBIAN_FRONTEND="noninteractive" apt-get install -y -q wget                                           libarchive13                                           libxml2                              36.0s
------
 > [2/3] 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.4_armhf.deb && dpkg -i z-way-*.deb:
#5 0.628 Get:1 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]
#5 0.830 Get:2 http://archive.ubuntu.com/ubuntu focal InRelease [265 kB]
#5 1.862 Get:3 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
#5 2.214 Get:4 http://archive.ubuntu.com/ubuntu focal-backports InRelease [101 kB]
#5 2.559 Get:5 http://archive.ubuntu.com/ubuntu focal/universe amd64 Packages [11.3 MB]
#5 31.90 Get:6 http://archive.ubuntu.com/ubuntu focal/main amd64 Packages [1275 kB]
#5 34.97 Get:7 http://archive.ubuntu.com/ubuntu focal/restricted amd64 Packages [33.4 kB]
#5 35.05 Get:8 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 Packages [177 kB]
#5 35.49 Reading package lists...
#5 35.96 E: Release file for http://security.ubuntu.com/ubuntu/dists/focal-security/InRelease is not valid yet (invalid for another 3d 8h 22min 8s). Updates for this repository will not be applied.
#5 35.96 E: Release file for http://archive.ubuntu.com/ubuntu/dists/focal-updates/InRelease is not valid yet (invalid for another 3d 8h 22min 33s). Updates for this repository will not be applied.
#5 35.96 E: Release file for http://archive.ubuntu.com/ubuntu/dists/focal-backports/InRelease is not valid yet (invalid for another 3d 8h 23min 10s). Updates for this repository will not be applied.
------
executor failed running [/bin/sh -c 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.4_armhf.deb && dpkg -i z-way-*.deb]: exit code: 100
The docker file I am trying build:

Code: Select all

#version of container: 0.1.0
FROM ubuntu:20.04
ENV TZ=America/Los_Angeles

#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.4_armhf.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"]

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

VOLUME ["/opt/z-way-server/htdocs/smarthome/user/"]

# 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"]
tnemele
Posts: 1
Joined: 26 Aug 2021 17:33

Re: Docker Script/ Container

Post by tnemele »

Hi!
Would you like to use docker on a raspberry pi?
Try this docker file: https://github.com/Z-Wave-Me/docker-z-way-raspberry-pi
I ran this Dockerfile on raspberry pi.
If you want to use docker with ubuntu: https://github.com/Z-Wave-Me/docker-z-way-ubuntu
Tell me how you would like to configure docker, what functions you need and I will help you
iotgregg
Posts: 3
Joined: 20 Aug 2021 04:52

Re: Docker Script/ Container

Post by iotgregg »

Hi Tnemele!

Stumbled onto that dockerfile as well and was able to build the image on my windows machine. Then push it my docker repo but it failed to install on my Pi not being to correctly locate the start.sh file based on the error message I saw. Was only able to build the image after removing the app-get and update commands so I may be missing things.

This is the Dockerfile I was able to build but did not succeed in installing:

Code: Select all

FROM balenalib/rpi-raspbian

WORKDIR /opt/z-way-server

RUN wget -q -O - https://storage.z-wave.me/RaspbianInstall |bash
COPY start.sh .
RUN chmod a+x start.sh

EXPOSE 8083

CMD /opt/z-way-server/start.sh
What I am looking in a dockerfile is:
  1. Be able to build the image on a windows 10 machine
  2. Run n a Raspberry Pi 3 running Raspian Lite
  3. Be able to select the version of zway server
  4. Have the container autorestart
  5. Be able to access the config files of the Zway sever in persistent volume(s)
Thank you for any help or advice!
-Gregg
PerH
Posts: 16
Joined: 03 Nov 2020 17:38

Re: Docker Script/ Container

Post by PerH »

@poltos:

I have an issue with the z-way container filling op disk space over time, and I have restricted "logging" in my docker to 2x5 mb. Any clue to what's filling space? I see that the communication logs are quite extensive, could that be whats accumulating?

As to the guys above, i'd recommend using existing containers and docker-compose to to start with, if you're new to docker.
Making new containers (dockerfile) is a bit more difficult, and requires a bit more understanding about docker.

That being said, it's great if more people contribute to make good docker images, so go for it! :)
User avatar
PoltoS
Posts: 6574
Joined: 26 Jan 2011 19:36

Re: Docker Script/ Container

Post by PoltoS »

Looks like logrotate is missing in the docker script
PerH
Posts: 16
Joined: 03 Nov 2020 17:38

Re: Docker Script/ Container

Post by PerH »

Which docker script? the compose file?
User avatar
PoltoS
Posts: 6574
Joined: 26 Jan 2011 19:36

Re: Docker Script/ Container

Post by PoltoS »

You need to add logrotate to the https://github.com/Z-Wave-Me/docker-z-way-raspberry-pi

We will do that soon
harre
Posts: 20
Joined: 24 Nov 2020 02:22

Re: Docker Script/ Container

Post by harre »

I like my docker-compose images to have a volume for the persistant data so I can just re-create the container from scratch but keep my configuration intact.

For a mariadb container I have this row:
volumes:
- ${PWD}/mariadb:/var/lib/mysql

So for us we could do something like this:
- ${PWD}/config/dir1:/foo/bar
- ${PWD}/config/dir2:/foo/baz
...
and for logs I prefer them on the host for easy access, something like this:
- ${PWD}/log/z-way-server.log:/var/log/z-way-server.log

If you do like this you can just make the logrotate on the host instead :)

If you otherwise want the logrotate to work in the container you need to do something like this in a post-install script after the container has been created, you can see how it is setup when the arch-aur package is built:
https://github.com/saez0pub/archlinux-zway

PS. It's not required but quite nice to share the Dockerfile of the image you have uploaded to dockerhub so people can see how it is built and/or even improve it by sending you a PR
Post Reply