I’m trying to migrate from HAOS on my NUC to HA running in a Docker container. I get the container set up fine and managed to use my backup tar.gz file to restore most of the setup I was running on the OS. There is a problem when I edit the docker-compose.yaml to map USB device (sonoff zigbee stick).
I add the line exactly from the documentation (when I run ls -l /dev/serial/by-id it shows ttyUSB0):
devices:
# your usb device forwarding to the docker image
- /dev/ttyUSB0:/dev/ttyUSB0
Then when I save the docker-compose and run docker-compose up -d I get a long winded error message. If I remove the devices section and do the command again I get no errors.
evan@evan-NUC6CAYH:/opt$ docker-compose up -d
portainer is up-to-date
Recreating homeassistant ...
ERROR: for homeassistant 'ContainerConfig'
ERROR: for homeassistant 'ContainerConfig'
Traceback (most recent call last):
File "docker-compose", line 3, in <module>
File "compose/cli/main.py", line 81, in main
File "compose/cli/main.py", line 203, in perform_command
File "compose/metrics/decorator.py", line 18, in wrapper
File "compose/cli/main.py", line 1186, in up
File "compose/cli/main.py", line 1182, in up
File "compose/project.py", line 702, in up
File "compose/parallel.py", line 108, in parallel_execute
File "compose/parallel.py", line 206, in producer
File "compose/project.py", line 688, in do
File "compose/service.py", line 581, in execute_convergence_plan
File "compose/service.py", line 503, in _execute_convergence_recreate
File "compose/parallel.py", line 108, in parallel_execute
File "compose/parallel.py", line 206, in producer
File "compose/service.py", line 496, in recreate
File "compose/service.py", line 615, in recreate_container
File "compose/service.py", line 334, in create_container
File "compose/service.py", line 922, in _get_container_create_options
File "compose/service.py", line 962, in _build_container_volume_options
File "compose/service.py", line 1549, in merge_volume_bindings
File "compose/service.py", line 1579, in get_container_data_volumes
KeyError: 'ContainerConfig'
[4342] Failed to execute script docker-compose
Things I’ve tried:
- Used an old laptop to start with and got the same results
- Used my NUC with a fresh install of latest Ubuntu same results
- Different USB ports makes no difference
- I used a clean install of HA then edited the docker-compose in case my backup was causing errors but get the same error message
Here’s my docker-compose:
version: '3.0'
services:
portainer:
container_name: portainer
image: portainer/portainer-ce
restart: always
ports:
- "9000:9000/tcp"
environment:
- TZ=Europe/London
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /opt/portainer:/data
homeassistant:
container_name: homeassistant
image: "ghcr.io/home-assistant/home-assistant:stable"
volumes:
- /opt/homeassistant/config:/config
- /etc/localtime:/etc/localtime:ro
devices:
- /dev/ttyUSB0:/dev/ttyUSB0
restart: unless-stopped
network_mode: host
This amounts to my entire knowledge of docker. I use GPT to help me through but seem to have exhausted every troubleshooting step and ended up going down a very big rabbit hole before I gave up.