MqDockerUp: A tool to monitor and update your docker containers from Home Assistant

Currently only one instance running is supported.
Ill soon rewrite the part where it checks for containers which stopped running, so that in future you should be able to run multiple instances.
Ill come back to you when its done.

1 Like

Good day, can you share some example automations for restart, stop, update, etc?
With these in place we can do away with watchtower

Im sorry to let you know that i removed the functionality for reestart, start, stop, pause.
First i want to reach stable ground before i work these features back in.

To Update a container you should see Update-Entities, those automatically change if an update is available. If there is an update you should be able to click on “install”.
image

https://lscr.io/ support is on my todo and will be the next supported registry.

Thank you. Can we call the update service with an mqtt service? I.e automation?

Yes if you send a mqtt message to the topic
mqdockerup/update

It must contain the containerId and the image in its payload

Thanks to a contribution lscr.io - images are now supported!

Hi @MichelFR,
Thanks for this, I love that it is not a rest api solution. Could you reenable the start, stop, restart functionalities?

Im working on it.

Amazing, thank you so much

1 Like

Great project! It was exactly what I was looking for!
So I no longer have to go to Portaneir to update images by hand.
Thank you very much

1 Like

/edit
It’s known issue i just read on github.
Thanks for working on it @MichelFR :+1:

I’m also using MqDockerUp recently and noticed that when i trigger a update from Home Assistant the network configuration on for my docker-compose files are not respected and every container is getting a new ip from the configured network configuration section instead of the assigned one.

I already have created a issue on github but maybe someone else knows what is going wrong? Implement network configuration on container update · Issue #191 · MichelFR/MqDockerUp · GitHub

    networks:
      ipvlan_custom:
        ipv4_address: 10.0.0.181

networks:
  ipvlan_custom:
    name: ipvlan_custom
    ipam:
      config:
        - subnet: 10.0.0.0/24
          gateway: 10.0.0.1

This is exactly what I have been looking for!

But I seem to be having trouble with containers that are stopped or exited in portainer. The dockers are removed from Mqtt as soon as they are stopped in portainer so the cards I set up showing the statuses of each container breaks in Home Assistant when they are stopped.

Not sure if I am doing something wrong?

1 Like

Hi. This is really a great project.

However, in my use case, I currently have a problem: I have multiple applications running via docker-compose which use a mariadb (image: linuxserver/mariadb). Since you use image name & image tag as topic name, all mariadb-containers publish on the same topic. Thus, only one container is shown in homeassistant. Would it be possible to change the topic name to the container name or add a unique id to the topic?

Thanks in advance.

Just wanted to say this works really really well. My current setup is that I run everything on a Synology NAS in Docker, including home assistant, Eclipse MQTT zwave etc in separate containers.

Installing was as easy as deploying the mqdockerup container including the right settings for MQTT. After spinning up the container everything worked. Entities per container are automatically added to home assistant and when an update is available, you get a notification trough the built in home assistant updating system. Very well integrated and no hassle to setup. Clicking the update button updates the container by downloading the newest image and spinning up the container again.

With me not every container worked, some gave an error and crashed mqdockerup, but having fixed the syntax for starting those up (e.g. moving from mount points to -v volumes helped), it all works very well.

Then I created a dashboard that allows me to track everything on a page:

Thanks!

2 Likes

Is there any possibility of extending this to encompass external hosts, @MichelFR ? I run Docker containers on other hosts that I’d like to monitor.

1 Like

@MichelFR Looks like an awesome project!

I am however having difficulties installing it.

I know how to setup a docker with a compose file, but am puzzled by the full process described i the read me.

Is the standalone application required?

I read some quick instuctions on how to use npm, and cloning repository, but I am unsure if it’s required on top of the docker and if there are instructions as to where to setup this clone.

My dockers are running on a Synology NAS.

Here’s the log:

[email protected] start
ts-node src/index.ts


| / | __ | _ \ ___ | | _____ _ _| | | | __
| |/| |/ ` | | | |/ _ \ / | |/ / _ \ '| | | | ’ \
| | | | (
| | |
| | (
) | (__| < __/ | | |
| | |) |
|
| ||_, |/ _/ _||____|| _/| ./
|
| |
|
Starting MqDockerUp V1.5.0 …
18.02.2024 17:36:38 [info] Connected to the database.
18.02.2024 17:36:38 [error] MQTT client connection error: connect ECONNREFUSED 127.0.0.1:1883
18.02.2024 17:36:38 [error] MqDockerUp stopped due to an error
18.02.2024 17:36:38 [error] object
18.02.2024 17:36:38 [error] Error: connect ECONNREFUSED 127.0.0.1:1883
at TCPConnectWrap.afterConnect [as oncomplete] > (node:net:1555:16)

I did configure my MQTT server’s IP in the compose file, so I’m not sure why it tries 127.0.0.1.

If I try the standalone application, I get :

[email protected] start
ts-node src/index.ts


| / | __ | _ \ ___ | | _____ _ _| | | | __
| |/| |/ ` | | | |/ _ \ / | |/ / _ \ '| | | | ’
| | | | (
| | |
| | (
) | (__| < __/ | | |
| | |) |
|
| ||_, |/ _/ _||____|| _/| ./
|
| |
|
Starting MqDockerUp V1.5.6 …

18.02.2024 17:30:37 [error] Error while listening to docker events: c
18.02.2024 17:30:37 [error] SQLITE_CANTOPEN: unable to open database
18.02.2024 17:30:37 [info] Connected to the database.
18.02.2024 17:30:37 [info] MQTT client successfully connected
18.02.2024 17:30:37 [info] Checking for removed containers…
18.02.2024 17:30:37 [error] MqDockerUp stopped due to an error
18.02.2024 17:30:37 [error] object
18.02.2024 17:30:37 [error] Error: connect ENOENT //./pipe/docker_eng
at PipeConnectWrap.afterConnect [as oncomplete] (node:net:1595:16)

Sorry for the Noob question if that’s obvious. :sweat_smile:

Fantastic project!!!

I have all installed, and I want to ask if there is someone who has already do a card with custom auto-entities and a “group card” with all the entity values together for each docker.

I’m trying to, but I don’t get it.

Thanks!!!

@Pepeto
I have one that also includes my HACS update entities:
image

type: custom:auto-entities
card:
  type: entities
filter:
  include:
    - entity_id: update.*update*
  exclude: []
sort:
  method: state
  reverse: true

Scroll three posts to see my other dashboard, let me know if you want the code for that as well.

1 Like

@B4dC4rd
Strange looks like it cannot connect to MQTT indeed, check your compose settings.
For the second part: Looks like it cannot connect to your docker.

This is the compose I use at my Synology NAS at the moment. If that works, no need to change any other settings after that step, will automatically work in HA as well.
Change the following values:

  • YOUR_MQTT_IP: IP to your MQTT
  • YOUR_NAS_VOLUME: Link to the dir where you want to store your MQ Docker Up data, I got something like: /volume1/homes/yourusername/docker/mqdockerup/data
version: '3.9'

services:
  mqdockerup:
    image: micrib/mqdockerup:latest
    restart: always
    environment:
      MAIN_INTERVAL: "60m"
      MQTT_CONNECTIONURI: "mqtt://YOUR_MQTT_IP:1883"
      ACCESSTOKENS_GITHUB: ""
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock # This is required to access the docker API	
      - YOUR_NAS_VOLUME:/app/data:/app/data/ # This is required to store the data (database.db)
    container_name: mqdockerup

exactly, same here.