Appdaemon docker tutorial questions

Hi @quadportnick I’ve put this here as I can’t find a thread for your Github appdaemon docker tutorial.

I have it all running successfully and I’ve adapted your instructions to move everything I can to docker containers including Hass. I discovered I accidentally had two instances of Hass running after trying to create container backups before upgrading due to slow internet. I have fixed my problem and hope to avoid it happening again by installing docker compose. Perhaps I am missing something very basic and obvious in all the compose tutorials I have read over the last week but can you tell me

  1. where to look for or where I can create the docker-compose.yml if it matters. (Debian)

  2. How do I translate the instructions for config listed here, (Github appdaemon docker tutorial) into the compose file format? An example would be great and enough for me to work with.

    docker run --rm -it -p 5050:5050
    -e HA_URL=""
    -e HA_KEY=""
    -e DASH_URL=“http://:5050$HOSTNAME
    quadportnick/appdaemon:latest

It doesn’t really matter where you put the docker-compose.yaml file, but, if that file references say a Dockerfile it’s best to keep all of those things relative. All said, I tend to create a ‘root’ folder for all my docker stuff, and subfolders for conf dirs and git/Dockerfiles and such like that, so I keep docker-compose files at the ‘root’ of each ‘grouping’, and they serve as my documentation.

PS Your example is the ‘test’ command so you want the one that’s lower down without the --rm -it stuff

YAML would look something like this

services:
  appdaemon:
    image: quadportnick/appdaemon:latest
    container_name: appdaemon
    restart: always
    network_mode: bridge
    ports:
      - 5050:5050
    volumes:
      - local_conf_folder:/conf
    environment:
      - HA_URL="HA_URL"
      - HA_KEY="HA_KEY"
      - DASH_URL="DASH_URL"

Hopefully by release we will have that being home-assistant/appdaemon :slight_smile:

Thank you.

So does that mean when I run docker-compose up it will just search my user home directory for the docker-compose.yaml or should I be navigating to the directory before issuing the command - that is, I currently have all my docker persistent volumes and so on at /home/hass/docker/ so if I put the docker-compose.yaml there do I need to…

cd /home/hass/docker/
sudo docker-compose up

And I assume my other containers are just listed under services in the yaml like…

services:
  appdaemon:
    image: quadportnick/appdaemon:latest
    container_name: appdaemon
    ...etc
  home-assistant:
    image: homeassistant/home-assistant:latest
    container_name: home-assistant
    ...etc

That all seems very straight forward, except for network_mode: bridge is that something that needs to be added in because of docker-compose?

And one last noob question before I go to bed - where do the images get stored when they are ‘pulled’. They do not seem to be in my home directory.

If you just type docker-compose up it needs to be in the current directory

the network_mode bridge is default, but I tend to declare it because sometimes I use host mode.

The images are munged into /var/lib/docker somewhere. It’s not a single monolithic image, its going to be made up of layers. You might notice this when pulling an image, you see a number of pieces being downloaded. If you have lots of images from the same place that use the same base docker, you will see some space/download efficiencies because of the common layers…

You can list all your images with docker images -a, and remove with docker rmi [id] where id is the full name or the unique ID, it will track if a container is using that image so you cant pull out the rug by accident.

1 Like

Thanks again, much appreciated - I think it’s all starting to gel now.

I’m working on getting this up and running using Docker on Synology and I’m getting the below error message. I’ve tried several different options and Google but haven’t been able to find answer.

I had the same problem. Not Synology though.

For me it was a problem with copy pasting between the guide, my windows PC using atom and then putty to the linux system it runs on. I wasn’t able to quite work it out but did make it work. If you look at the last line in your picture you can see that the final line (the image you want to use) is being split away and issued as a separate command.

I figure it’s something to do with line breaks and windows/linux transfer in the copy paste. I got it working by copying the first test command I copied from the wiki and adjusting that to the proper command with the persistent config lines included. I never found the rogue character or whatever it was and I’ve since moved to using docker compose where possible.

After a while of messing around with it I was able to get it up and running by moving the last line up one line. After that worked perfectly.

Still playing around with it but here is what I have so far…