Docker container always stops after some seconds

Hi there, I’m Tom and new to the forum. Using HA since a year now and moved my HA to Docker on Raspi (Raspian Jessie) beginning of October. Everything was running fine and stable, but after a reboot of the Raspi yesterday I ran into trouble. The container stops after some seconds. Docker itself looks fine, started the hello-world container which is running fine.

This is the Docker log

    pi@homeassistant:/usr/local/lib $ docker logs home-assistant
    starting version 3.2.5
    Traceback (most recent call last):
      File "/usr/local/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
      File "/usr/local/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
      File "/usr/local/lib/python3.6/site-packages/homeassistant/__main__.py", line 397, in <module>
    sys.exit(main())
      File "/usr/local/lib/python3.6/site-packages/homeassistant/__main__.py", line 371, in main
    args = get_arguments()
      File "/usr/local/lib/python3.6/site-packages/homeassistant/__main__.py", line 103, in get_arguments
    import homeassistant.config as config_util
      File "/usr/local/lib/python3.6/site-packages/homeassistant/config.py", line 15, in <module>
    from homeassistant import auth
      File "/usr/local/lib/python3.6/site-packages/homeassistant/auth/__init__.py", line 10, in <module>
    from homeassistant import data_entry_flow
      File "/usr/local/lib/python3.6/site-packages/homeassistant/data_entry_flow.py", line 6, in <module>
    from .core import callback, HomeAssistant
      File "/usr/local/lib/python3.6/site-packages/homeassistant/core.py", line 45, in <module>
    from homeassistant.util import location
      File "/usr/local/lib/python3.6/site-packages/homeassistant/util/location.py", line 10, in <module>
    import requests
      File "/usr/local/lib/python3.6/site-packages/requests/__init__.py", line 115, in <module>
    from .api import request, get, head, post, patch, put, delete, options
      File "/usr/local/lib/python3.6/site-packages/requests/api.py", line 13, in <module>
    from . import sessions
      File "/usr/local/lib/python3.6/site-packages/requests/sessions.py", line 27, in <module>
    from .adapters import HTTPAdapter
      File "/usr/local/lib/python3.6/site-packages/requests/adapters.py", line 42, in <module>
    from urllib3.contrib.socks import SOCKSProxyManager
      File "/usr/local/lib/python3.6/site-packages/urllib3/contrib/socks.py", line 27, in <module>
    import socks
      File "<frozen importlib._bootstrap>", line 971, in _find_and_load
      File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
      File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
      File "<frozen importlib._bootstrap_external>", line 674, in exec_module
      File "<frozen importlib._bootstrap_external>", line 779, in get_code
      File "<frozen importlib._bootstrap_external>", line 487, in _compile_bytecode
    ValueError: bad marshal data (unknown type code)
    starting version 3.2.5
    Traceback (most recent call last):
      File "/usr/local/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
      File "/usr/local/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
      File "/usr/local/lib/python3.6/site-packages/homeassistant/__main__.py", line 397, in <module>
    sys.exit(main())
      File "/usr/local/lib/python3.6/site-packages/homeassistant/__main__.py", line 371, in main
    args = get_arguments()
      File "/usr/local/lib/python3.6/site-packages/homeassistant/__main__.py", line 103, in get_arguments
    import homeassistant.config as config_util
      File "/usr/local/lib/python3.6/site-packages/homeassistant/config.py", line 15, in <module>
    from homeassistant import auth
      File "/usr/local/lib/python3.6/site-packages/homeassistant/auth/__init__.py", line 10, in <module>
    from homeassistant import data_entry_flow
      File "/usr/local/lib/python3.6/site-packages/homeassistant/data_entry_flow.py", line 6, in <module>
    from .core import callback, HomeAssistant
      File "/usr/local/lib/python3.6/site-packages/homeassistant/core.py", line 45, in <module>
    from homeassistant.util import location
      File "/usr/local/lib/python3.6/site-packages/homeassistant/util/location.py", line 10, in <module>
    import requests
      File "/usr/local/lib/python3.6/site-packages/requests/__init__.py", line 115, in <module>
    from .api import request, get, head, post, patch, put, delete, options
      File "/usr/local/lib/python3.6/site-packages/requests/api.py", line 13, in <module>
    from . import sessions
      File "/usr/local/lib/python3.6/site-packages/requests/sessions.py", line 27, in <module>
    from .adapters import HTTPAdapter
      File "/usr/local/lib/python3.6/site-packages/requests/adapters.py", line 42, in <module>
    from urllib3.contrib.socks import SOCKSProxyManager
      File "/usr/local/lib/python3.6/site-packages/urllib3/contrib/socks.py", line 27, in <module>
    import socks
      File "<frozen importlib._bootstrap>", line 971, in _find_and_load
      File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
      File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
      File "<frozen importlib._bootstrap_external>", line 674, in exec_module
      File "<frozen importlib._bootstrap_external>", line 779, in get_code
      File "<frozen importlib._bootstrap_external>", line 487, in _compile_bytecode
    ValueError: bad marshal data (unknown type code)

I updated the HA container, Raspian is up to date.

Thanks for any help!

can you post your docker command? Or your docker-compose.yml if you’re using that?

I used it as suggested in the installation guide

docker run -d --name="home-assistant" -v /home/pi/homeassistant:/config -v /etc/localtime:/etc/localtime:ro --net=host homeassistant/raspberrypi3-homeassistant

For the following attempts I used

docker start home-assistant```

I would remove and re-pull the home-assistant container… some google-fu says that that error is corrupted byte code.

If your container is named home-assistant and you use the standard homeassistant/home-assistant image it would be something like:

$ docker stop home-assistant
$ docker rmi home-assistant
$ docker rmi homeassistant/home-assistant

Then run your docker command again

you could first try:

$ docker stop home-assistant
$ docker rmi home-assistant

then issue the docker run command again.

Edit: the idea here is to go back to the fresh docker image

OK - I’ll try it now

If that doesn’t work then do it again but also remove the downloaded image:

$ docker stop home-assistant
$ docker rmi home-assistant
$ docker rmi homeassistant/raspberrypi3-homeassistant

then issue the docker run command again - this time it re-pull the docker container from docker hub

had to use the -f option to delete, now it’s downloading, takes a while since line is not the fastest

Great! It worked! Thank you very much for the help :slight_smile: