My Docker Stack

If you’re using Hassio you can use snapshots exactly like on a Pi and also use all addons. I did find that I needed to manually add some of the addons but they all work 100%

I am super new to all this but I did think it important to mention that in my case, in order to get home assistant running in Docker using the network_mode: host method of networking, I did have to modify iptables before it worked.
I could not reach my HA on http://IPADDR:8123 until I put the following rule into iptables. I know its too coarse, but it works for now.
[docks@docko hass-config]$ sudo iptables -I INPUT -s 192.168.1.0/24 -j ACCEPT
I will tighten it up and do it better soon, now that I know that was the problem.
Cheers.

This is only if you actively installed and run a firewall on your docker host. iptables does not have any block rules by default in a normal default distro install.

I have a very similar setup although Im using an i5 NUC. I moved from Zone Minder to Kerberos.io for my cameras. I have found it less resource intensive than Zone Minder was although still pretty high. A couple of disadvantages are that each camera is a seperate container and therefore seperate web interface, also, each container really needs to be pointed at its own partition otherwise it will just chew up hard drive space.

OK I’m struggling to understand something and I’ll use Portainer as an example…

IF I create the container for portainer using the command line:

(Note I already created the volume - docker volume create portainer_data)
$ docker run -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer

I get no stack, portainer_data is the volume.

BUT If I use docker-compose…

version: '3'
services:
  portainer:
    container_name: portainer
    restart: unless-stopped
    image: portainer/portainer
    volumes:
      - portainer_data:/data
      - /var/run/docker.sock:/var/run/docker.sock
    ports:
      - "9000:9000"
volumes:
  portainer_data:

Then it creates a volume name-portainer_data and a stack called name

I just don’t understand why it does this?
I also don’t understand why it requires the bottom 2 lines?

Why do you have the extra volumes in your code below? You are already referencing the volume in your portainer container in the compose yaml

volumes:
  portainer_data:

Well that was one of my questions. 2 Reasons.

  1. Portainer shows it like that on their site
  2. Error message about volume (can’t remember exact message) not found or not defined. It would not create the container without it.

I don’t reccommend just copying if you don’t understand what it does. If you look at the original example shown at the first post of this thread it doesn’t need that. You map the folder in the portainer container info. Im guessing the way they do it is to create the folder but why can’t you just manual do that?

I did manually create the folder just like the instructions said to do!!!

I am also ASKING QUESTIONS because I WANT TO UNDERSTAND.

The first example is different to how portainer site shows it and flamingm0e seems to have mapped his folder differently - which is fine - I am just trying to understand why.

Globally placing volumes: allows you to create folders from the docker compose file. It just two different ways, one automatic and the other manual. As long as your container is mapped to the correct volume and doesn’t have errors either way is fine.

this is what I use, I use direct path to my local folder which then I can easily backup any docker config data at my main folder all docker data ‘/opt/docker/*’

portainer:
  image: portainer/portainer:latest
  container_name: portainer
  ports:
    - 9000:9000
  restart: always
  volumes:
    - /var/run/docker.sock:/var/run/docker.sock
    - /opt/docker/portainer/config:/data
  command: --no-auth -H unix:///var/run/docker.sock --no-analytics

another example below:

   dockermon:
     container_name: dockermon
     image: philhawthorne/ha-dockermon:arm
     ports:
       - 8126:8126
     volumes:
       - /var/run/docker.sock:/var/run/docker.sock
       - /opt/docker/dockermon/config:/config
     environment:
       - PUID=1000
       - GUID=1000
       - TZ=Europe/Brussels
     restart: always

I’ll check the link - thanks for that but as I said I had already created the volume. If I start from command line it uses it. If I start via docker-compose it creates a new one. I don’t understand why.

I was trying to follow configuration from the first post but I don’t know how to configure mqtt (what shall be the broker address?) platform for it. Could you show your settings in HA?

Don’t use the ‘volumes’ option. That is for mounting VOLUMES you have already created. It is not for creating bind mounts.

I use the IP of my NUC

docker run -itd --name=eclipse-mosquitto -p 1884:1883 -p 9002:9001 -v /home/finity/docker/mqtt/config/mosquitto.conf:/mosquitto/config/mosquitto.conf -v /home/finity/docker/mqtt/config/passwd:/mosquitto/config/passwd -v /home/finity/docker/mqtt/data:/mosquitto/data -v /home/finity/docker/mqtt/log:/mosquitto/log -e PGID=1000 -e PUID=1000 -e UMASK_SET=000 eclipse-mosquitto

mqtt:
  broker: 192.168.1.11
  port: 1884
  client_id: home-assistant-4
  username: !secret MQTT_user  
  password: !secret MQTT_password

I finally was able to setup Grafana. But it is creating new container with very strange names. Why?

did you give it a container name in your run command/compose file?

In the composefile i just had Grafana. The others just popped up. Maybe they are som plugins?

you have 3 grafana containers so it uses wanky names for them. One down the bottom and two at the top. I’m betting you’re using docker-compose? I get stacks created for no explicable reason when I do that as well.

To fix it, just delete the 2 grafana containers and load them again.

It’s bloody frustrating - I now know just enough to be dangerous!

Thanks. Worked. I am new to docker and just did my first compose file. So i am still learning.