My Docker Stack

Mine requires a docker-compose pull before it pulls the latest. Not sure why yours would be different

I successfully , partially implemented a full docker stack of all the stuff I need. I used a very old laptop with ssd drive and ubuntu server, made some tweaks to your docker-compose, took out some stuff I did not need. I keep portainer separate from the stack.

I also added watchtower to my docker container and today it automatically updated hass to .76 Right now, I have my real RPI3 systems with USB Zwave device. and this one on the laptop. I just order my nuc hardware before I got to far down the stack. My docker-compose and all that should come right over ok

I did shut down my hassio, plug in my usb zwave and tested it, soo much faster restart time and reaction than the pi even on antiquated hardware. That convined me to pull the trigger on the nuc.

I also played with a zoneminder on docker but I think I am running out of resource for 3 cameras I have. For the most part I have it working

Just regarding the docker-compose pull
do I need to specify a ā€˜serviceā€™ eg portainer for it to pull the latest version? Does that mean I need to do this for every container?

I guessā€¦ what is the procedure to update images? Is there a global update at all?
Do you do down, pull and then up -d for every image?

If youā€™re using a docker-compose file, docker-compose pull will attempt to pull the newest images for all the services defined in your file. You could limit it to a single service by specifying it, ie docker-compose pull homeassistant. Now I just do docker-compose pull to get the updated images followed by docker-compose up -d which recreates only those containers for which a new image has been pulled. Very simple!

So do you do a down command first, then pull and then up -d?
Itā€™s doing my head in!

Iā€™m about to install Debian on a NUC and then docker and then hassio and restore a snapshot. Then I want to add a few other images.

So docker-compose from what I can see is an alternative to specifying a start-up string for home assistant specifying ports etc and will also make it auto run on a restartā€¦ However I think I can do all that in the docker run command?

Itā€™s not all that intuitive or clear TBH and Iā€™m in way over my head and out of my comfort zone.

Iā€™m also thinking with hassio I wonā€™t need to specify the addon containers in the docker-compose as hassio will deal with them. Is that right?

When I do mine, I run

docker-compose pull

first so it gets the latest versions of all containers in my docker-compose.yaml, then I run

docker-compose down

and finally

docker-compose up -d

This minimizes the downtime of my stack versus waiting for everything to upgrade when running docker-compose down and then docker-compose pull. Basically PULL, DOWN, UP is less downtime than DOWN, PULL, UP.

@DavidFW1960
If you also install portainer, you can recreate an individual container in there and tell it to pull the latest, i find that easier than using a full compose file pull.

Docker-compose can also specify the ORDER in which everything starts up. If you need home assistant up before node red, but you need the database up before home assistant you specify all of that.

Not to mention do you really want to run the entire docker run line every time you need to stop it, update, and start it again?

Well no not particularly although a script would do it wouldnā€™t itā€¦

In all seriousness though, I am asking for advice as I have absolutely no clue and I donā€™t even know what I donā€™t know. I have had a bit of a play with docker on my Pi (worked fine on a Pi3B but on a Pi1B not so much)

Anyway the NUC is here now and after working out how to finally get into the BIOS setup so I could enable USB boot itā€™s away nowā€¦

So Iā€™ll avoid the command line by using docker-compose. Thanks also to @aidbish & @atomicpapa for the advice as well. Explains a few things.

Looking at the docker docs it was seeming like Iā€™d only need compose if I wanted a really complex setup with a swarm and stack and who knows what else lol!

Thatā€™s essentially what docker compose is. A script.

@DavidFW1960, docker-compose is the most convenient approach. it will start everything automatically in the order you choose. There are many variables you can use and the documentation is extensive, but understanding the key 5 or 6 things around it will get you going.

for insstance if you want the latest image you need to add :latest to the image entry like so:
image: homeassistant/home-assistant:latest
If you dont type anything after the image name it will pull the latest by default.

but letā€™s say theres a ā€œstableā€ image version; you just do:
image: homeassistant/home-assistant:stable

If you want a container to start after another one starts you add:
depends_on:
- influxdb

set up the docker and add docker compose.
https://docs.docker.com/install/linux/docker-ce/debian/


after that you need to set up a service file in systemd to auto start.

get those things done and comeback for the docker-compose-app.service.app file.

Let me know what containers youā€™re planning to install and if I have them I can share my docker-compose

Thatā€™s really helpful thanks.

So Iā€™ve installed Debian 4 times now I think and stupidly chose disk encryption which meant it was continually asking me for my password for the encryption.

Also had a couple of goes as I tried different GUIā€™s for Debianā€¦ ehā€¦ pass

Then also had a brain freeze and took a while to work out that you donā€™t get sudo in debian if you set a root passwordā€¦

Anywayā€¦ Debian installed and docker was a piece of cake after than and I then installed the dependencies for Home Assistant and installed the docker image of Hassio as well and it was up and running almost right away.

Just need to see now if it auto restarts as if it does I need to know what to do to switch to composeā€¦

OK Yeah. Itā€™s loading the container automatically for Hassio and Supervisor. How do I stop that from happening?

@DavidFW1960
First not sure why you went for Debian. I understand some of ā€œpuristā€ arguments but if youā€™re a novice like me Ubuntu is the easiest/safest way. Thereā€™s tons of support and write ups on almost any subject.

Even the installation is simple: download the iso, usb and go. I did Debian once and you only get a partial image, rest online; takes forever!

Anyway, Hass.io creates its own systemd file in /etc/systemd/system. It starts the supervisor and it then starts HA. The only way to stop that I think itā€™s to disable the systemd file. But donā€™t see the benefit.

If youā€™re going hass.io then I donā€™t think you need compose as youā€™ll find most of what you need in the add on repository and once you install the add on hass takes care of it.

Yeah thanks for that. Came to the same conclusion myself. Iā€™ll just use compose for a few other things Iā€™m going to use.

Debian was strongly recommended in chat on discord as being more stable and much easier to upgrade than Ubuntu. I was told Ubuntu for features but Debian for stability. Before that I was going for Ubuntu. Certainly I had a few challenges but due to my inexperience - but I installed the whole thing about 4 times in an hour due to some of my own missteps and pitfalls I didnā€™t know about. I donā€™t know why it took forever for you but I canā€™t complain about that.

Anyway, Hassio is installed with minimal issues - I lost some of the addons from non standard repos that I need to add and setup again but thatā€™s a job for tomorrow (fired the Pi up because I need to copy their settings). All good though. Also going to install Portainer.

All right
Good itā€™s working

There are no dependencies on the host system when running Docker. Thatā€™s one of the key points to using Docker.

And for another opinionā€¦

I thought about using docker-compose and came up with a (I thinkā€¦) working docker-compose file but TBH, I havenā€™t ever used it.

I installed Portainer as the first container. From there on after adding the containers thru the command line the first time I just use Portainer for everything else. You can start, stop, pull the latest container and update all from within Portainer on a per-container basis.

Most of the other containers I use, aside from HA, donā€™t update or need to have anything done with them that often. I find that, for me, cycling all my containers up & down just to update one container is excessive. I never need to open a terminal to do any of it.

And there may be times I DONā€™T WANT to pull an update on a certain container.

Using Portainer to manipulate my containers is the solution I like best. I like having finer control over exactly what Iā€™m doing. But then again, thatā€™s why Iā€™m using a non-Hassio version of home assistant, too.

1 Like

Yep, a big +1 for portainer for me

Ok, I think I am seeing the light with Docker. I have been reading up on it a bit and am thinking of moving from my hassbian install over to docker.

A few questions:

I have a spare computer that I am planning to test Docker on, how easy is it to move to another piece of physical hardware with docker? Assuming I want to go this route I would want to go the NUC route or some other low powered solution. I want to move off a Pi for speed/reliability.

Can a samba share be setup with the home assistant instance? I have been doing this since the beginning with HA and am just comfortable with it.

@flamingm0e which NUC are you using? Seems to have plenty of horsepower with an i3, however i3s range in power quite a bit, can you post the NUC or processor you are using?

Quick question for all of you, why not use watchtower to auto update your containers to the latest image? That is what I have done.

Also if you set up mapped volumes for the containers and set samba up on the host pointing to your mapped volumes you donā€™t expose anything in the container and makes backing up your configuration easier.

Transferring docker is easy if you have setup the mapped volumes. Setup your new os, install docker and docker compose, copy over your mapped volumes and compose file, and start up containers.

1 Like