Starting with docker-compose


I installed hassio in a docker, i love home assistant but i’m stuck with forwarding devices.
My problem is i got 2 usb dongles (zigbee and zwave)

The problem i got is that, if i use in the config file /dev/ttyACM0 and /dev/ttyACM1
When i reboot sometimes the usb dongles exchange number so it doesn’t work anymore.
So i wanna use /dev/serial/by-id/ to be sure that it can’t change

From my research i understood that i should use docker-compose file to set what and how devices are forward to the docker.

But i don’t understood how to start with this.
Should I just create the file and it will automagically work ?
If so can i just define the home assistant config ? or i need to define every addons ?

I’m afraid of breaking my installation with bad configuration.

So how can I easily forward devices to home assistant, without breaking anything ?

Thank you for your help


I dont use but I do use docker compose and serial id. All I needed to do was pass the serial id folder location though to the docker container. This is the hass part of my compose file.

    container_name: homeassistant
    restart: unless-stopped
    image: homeassistant/home-assistant
      - /dev/ttyUSB0:/dev/ttyUSB0
      - /dev/ttyUSB1:/dev/ttyUSB1
      - /dev/ttyACM0:/dev/ttyACM0
      - ${USERDIR}/docker/homeassistant:/config
      - /etc/localtime:/etc/localtime:ro
      - ${USERDIR}/docker/shared:/shared
      - /dev/serial/by-id/:/dev/serial/by-id/
    network_mode: host
    privileged: true
      - PUID=${PUID}
      - PGID=${PGID}
      - TZ=${TZ}
1 Like

Thank you very much for your answer

I don’t use hassio directly i also use docker but without the docker compose and that’s my problem i don’t understand how to start with docker compose.

the config you gave me, should I just copy it in a docker-compose.yaml file and that’s it ? (i don’t have this file)

can i get the config used right now ? (i guess it’s the default one but not sure)

thank you for your time

I used two guides to help me to understand how to use Docker compose DigitalOcean and smart home beginner. Have a read through both of them and you will be up and running in no time.

1 Like

I’ll look at it thanks

With hassio you don’t have access to docker compose.

You don’t need docker compose either. You can just modify your run command that the script installs in systemd

Cool didn’t know that (glad to avoid docker compose if i don’t need to)
so i can just had --devices=/dev/serial/by-id/*** to the command ?
but can you tell me where is that file ?

thank you

There is a school of thought in the very large clustering situations (FAANG+M -type companies, Lyft, Indeed, etc) that use a “Gitops” mentality: the config is checked into version-control as much as possible.

The non-obvious benefit of docker-compose is that you’ve got your complete config to launch the docker container in one place. In 6 months when you’ve forgotten the config (or in my case, 2 weeks) you may need to go digging for it; me, I just re-run the “docker-compose up -d”.

Version-controlling it means “oh, crap, what did I break? revert to yesterday”.

You don’t need to explain much to anyone, it’s just “yeah, I use docker-compose. the compose file is version-controlled to catch my changes”. The skills you build doing this convey elsewhere. It’s good and common practice.

… also, like @michaelmcarthur above, if someone else needs help, you have the current config right there, and can help others.

Send me a PM if you want more, I’ve kinda distracted this channel a bit (sorry).

… but go with the “docker-compose”. Edit the example above to suit your environment, and kick it off. If you’re unsure, post your config here, or to me in a PM, I’ll build you one if it helps you get started.

Thank you
in that case i need to confirm something:
with docker compose do you need to manually configure every new addons ?
that’s the reason i’m kind of afraid of docker compose because if that’s mean i can’t install addons from hassio anymore it’s a big step back ?
and the maintenance of docker-compose vs nothing to do because the addons interface manage it for you … i feel like i’m getting into something more complicate.
I will do it if i need to, but i’ll be glad to keep my system as easy as possible (easy to operate and to maintain)

thank you

you’re correct: the “docker-compose” route is really the non-hassio route. The “add-ons” are all orchestrated by the hassio-supervisor, so non-hassio is non-addons.

“docker-compose” is really “better than remembering a complex ‘docker run -d’ command”; running a docker command also gets you homeassistant, not hassio, so no add-ons.

The best-of-both-worlds would be a docker-compose config to run the hassio-supervisor, using it to pull and install your first hassio image. Essentially, the hassio-supervisor becomes your docker-manager, replacing docker-compose, but I’m sure you could use a docker-compose argument to record your commands for hassio-supervisor, if you knew them. THAT is the direction I’d prefer to go personally, but when I have time to investigate.

You should have a look at the script you ran to install it.

It’s a systemd file

Actually i did but didn’t see it … i look again :slight_smile:
BTW: I used this
and so the script is :

From my understanding it’s the supervisor wich handle home assistant and so the config to modify should be inside the supervisor. Am I right ?

seem interesting idea but I don’t clearly understand what you mean.

Actually i don’t run any docker -run command the supervisor handle everything for me

Yep sorry about that but if you follow along the code, you see the home assistant docker container is already privileged which means it should see every device connected.

1 Like

yes home assistant see the device but not the /dev/serial/by-id/ folder only the device directly as /dev/ttyACM0
my problem is similar as :

specially :

so do you think the solution could be to open a feature request ? or maybe add :
{‘bind’: ‘/dev/serial/by-id’, ‘mode’: ‘rw’},
to at line 74 ?

thanks for your time :blush:

I would suggest a feature request but there’s probably already one out there for it.

Modifying that Python file would require you to build the docker image every update.

Hey Micheal, thanks for posting, I’ve been searching on how to do that myself.
Would you mind posting a few examples of how you have this configured in your configuration.yaml file?
is it just as easy as entering:
device: /dev/serial/by-id/the_name-of_your_device


You’re totally right there is a few that i didn’t see before …

I guess i’ll have to wait :frowning_face:

thanks again for your help
thanks you too @chickenandporn

It’s really that easy. I moved from a raspberry pi non docker to a server running docker and it worked straight away. This is my zwave config.

  usb_path: /dev/serial/by-id/usb-0658_0200-if00
  device_config: !include zwave_device_config.yaml
1 Like

it finally works…
the crazy parts is that i just tried again and now it knows about /dev/serial/by-id
i now have the supervisor in version 143 so i guess it’s fixed in that version

thanks again everyone who tried to help me :slight_smile:

1 Like