1 year ago

#199362

test-img

Rafal Zarajczyk

Unable to discover Chromecasts from docker container

I have the following script in python (using pychromecast):

#> cat chromecasts.py

import pychromecast
print(pychromecast.get_chromecasts())

When I run it locally, it works fine and discovers my TV with Chromecast built-in:

#> python chromecasts.py

([Chromecast('unknown', port=8009, cast_info=CastInfo(services={ServiceInfo(type='mdns', data='BRAVIA-4K-UR3-629460a23bba681edd7c4121e0f1abf0._googlecast._tcp.local.')}, uuid=UUID('629460a2-3bba-681e-dd7c-4121e0f1abf0'), model_name='BRAVIA 4K UR3', friendly_name='SONY KD-49XH8505', host='192.168.86.138', port=8009, cast_type='cast', manufacturer='Sony'))], <pychromecast.discovery.CastBrowser object at 0x107b1c2e0>)

But when I encapsulate it inside Docker container...

#> cat Dockerfile

FROM python:3

RUN pip install pychromecast

COPY . .

CMD ["python", "chromecasts.py"]

#> docker build -t rzarajczyk/chromecasts:latest .

... and run it...

#> docker run -it --rm --network=host rzarajczyk/chromecasts:latest

([], <pychromecast.discovery.CastBrowser object at 0x7f82c91d8af0>)

I get nothing. Even though I have --network=host switch. Please help! What can be wrong and how can I debug the problem?

Edit: my host environment is MacOS, but I have also run it on QNAP Container Station - with the same result.

python

docker

chromecast

mdns

zeroconf

0 Answers

Your Answer

Accepted video resources