Kodi Community Forum

Full Version: how to: run Kodi in a Docker container with audio and video
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
For all you Docker fans, I've recently published a project which allows you to run a fully-functional Kodi installation in a Docker container with audio and video. I would love to hear your feedback, either here in this thread or via GitHub.

https://github.com/ehough/docker-kodi

There are quite a few headless Kodi Docker images, but as far as I know this is the first working attempt to provide a "headful" Kodi image that provides audio (ALSA or PulseAudio) and video (with optional hardware acceleration). I've been operating it on my HTPC for the past 4 or 5 months and it's been working wonderfully.

I hope you find it as useful as I have. Please let me know what you think!
Intrigued by this. Would using Kodi in a container limit the exposure/damage that a rogue kodi addon could do, like deleting media or wiping system folders etc? and/or simplify upgrades?

Also, will controller input (e.g. bluetooth xbox controller, working perfectly with the ubuntu host) & kodi-retroplayer cores work inside the container?

Trying to understand the motivation to dockerize kodi, I am new to docker overall but keep hearing about it. On the other hand, I am increasingly using flatpaks for apps in my linux desktop (and also discovering flatpak's limitations, such as no OpenCL for apps etc)
Hi and sorry for the delayed response. Thanks for your interest and great questions. I'll do my best to reply but invite any other voices to chime in.
 
Quote:Would using Kodi in a container limit the exposure/damage that a rogue kodi addon could do, like deleting media or wiping system folders etc? and/or simplify upgrades?
Using Docker arguably reduces the attack surface as most of the host system's files, processes, and devices are hidden from Kodi and its add-ons. I give the Kodi container read-only access to my media library, full write access to just the Kodi home directory, and drop all Linux capabilities. So IMHO, yeah it's safer than an out-of-the box Kod install. To be fair, it also takes more setup than a typical Kodi on Linux installation.
 
Quote:Also, will controller input (e.g. bluetooth xbox controller, working perfectly with the ubuntu host) & kodi-retroplayer cores work inside the container?
Can't think of a reason that either bluetooth or retroplayer wouldn't work. It might take some extra packages in the container (i.e. a custom Dockerfile) and/or providing the container with access to something from the host's /dev. I'm happy to discuss this further.
 
Quote:Trying to understand the motivation to dockerize kodi, I am new to docker overall but keep hearing about it. On the other hand, I am increasingly using flatpaks for apps in my linux desktop (and also discovering flatpak's limitations, such as no OpenCL for apps etc)
Personally, I run a bunch of services (file sharing, backups, etc) on my HTPC, and my goal is to run as much as I can in Docker containers as each app can have its own dependencies, is easy to upgrade, and is isolated from everything else running on the system. Based on my limited knowledge of flatpak, and similar techologies like snap and appimage, it seems that Docker is a little more low-level. Docker also has a massive user base (see AWS ECS and Kubernetes) and will be around for the long term.
Hi, it's great attempt. I really need to try it. I hate that usually Debian is so late after official package.
Also having two (or more) version at once and switching between them would be quite easy.
I usually use only stable version, and have no place to try test one. No it can be easy as a piece of cake.
What about CPU usage?
(2018-10-07, 13:32)Marx1 Wrote: [ -> ]What about CPU usage?

Docker containers impose no processing overhead, so CPU usage is virtually (exactly?) identical to running Kodi outside of Docker.
I see this thread is very popular, and also very small.
I am relatively new to docker and followed the basic guide here. That works pretty good. 
However I don't get the hang exactly of what's going on with this X11 and the audio and video. 
I would love to have my kodi also in docker. 
Would it be an idea to have a step by step guide to make it a bit more foolproof?
Well, I have it working. It even feels faster then the normal one. Now I only need to get the sound working. I installed Ubuntu desktop 18.10 on a lattepanda alpha. 
Not sure how to get it working.

-> 
sudo x11docker 
--xorg 
--vt 7 
--alsa="PCH" 
--wm none 
--gpu 
--homedir /media/data/kodi/home 
-- -v /media/data/complete:/media:ro -- 
erichough/kodi

Next up : docker compose and CEC. Thanks. Really love that this works in docker!!
I am out of data right now, but I want to try to make use LibreELEC and Kodi inside of a LXD(LXC) container because it has GPU passthru. We should put together a Tips and Tricks Guide. I need another couple USB Discs anyways. I will go to the library and document how to make images all day. So, LibreELEC with Kodi in a LXD container and OpenWRT in a Docker container. I think we can use Kubernetes to simplify deploying these containers, so that they are properly networked, etc. I am still kind of learning, but it is starting to make more sense.
https://kubernetes.io/docs/tutorials/kubernetes-basics/deploy-app/deploy-intro/
I think we can really get somewhere with RetroPlayer and Kubernetes.
NM, libretro are containers. Blush
I still have to compile w/retroplayer. Last post I swear.
Ubuntu supports nested virtualization.
https://www.youtube.com/watch?v=yR09wu0YbFA
Lets make it sexy. Asterisk can be the solution for voice command over IoT devices, which is the argument for running containers on bare metal.
https://justus.berlin/
https://wiki.asterisk.org/wiki/pages/viewpage.action?pageId=29395573
https://konghq.com/faqs/
friendly request, please don't use our forum as your personal diary.
(2018-04-06, 20:13)k2eric Wrote: [ -> ]For all you Docker fans, I've recently published a project which allows you to run a fully-functional Kodi installation in a Docker container with audio and video. I would love to hear your feedback, either here in this thread or via GitHub.

https://github.com/ehough/docker-kodi
 

This is a fantastic idea, thank you - I am just trying to move all my services to docker and Kodi was the one I was most scared about.

Specifically, I have it today installed directly on a server which is connected via HDMI to a TV. Whatever is displayed by Kodi goes onto the TV. 
Would your docker image allow for such a setup?
(2019-04-17, 18:58)WoJWoj Wrote: [ -> ]Specifically, I have it today installed directly on a server which is connected via HDMI to a TV. Whatever is displayed by Kodi goes onto the TV. 
Would your docker image allow for such a setup? 
Absolutely! In fact that's its exact intended purpose. If you are running Kodi on Linux already, then there's no reason that you shouldn't be able to migrate over to Docker. Go ahead and give it a spin, and if you run into any trouble please feel free to open a GitHub issue (or report back here) and we'll do our best to help you out.
(2019-04-17, 20:32)k2eric Wrote: [ -> ]
(2019-04-17, 18:58)WoJWoj Wrote: [ -> ]Specifically, I have it today installed directly on a server which is connected via HDMI to a TV. Whatever is displayed by Kodi goes onto the TV. 
Would your docker image allow for such a setup? 
Absolutely! In fact that's its exact intended purpose. If you are running Kodi on Linux already, then there's no reason that you shouldn't be able to migrate over to Docker. Go ahead and give it a spin, and if you run into any trouble please feel free to open a GitHub issue (or report back here) and we'll do our best to help you out. 
Wonderful, thank you. I will not break everything right before vacations but once we are past them I will jump in and no matter what post a feedback. Thanks again!
Hi, I tried to install the latest built found in docker 17.05 on synology discstation 1618+. Suddenly the program stopped with following message:

2019-07-08 16:05:08      stdout   ---> Kodi does not appear to be running. Exiting.
2019-07-08 16:05:08      stdout   Something is probably wrong
2019-07-08 16:05:08      stdout   /usr/bin/kodi --standalone  has exited in an unclean state 3 times in the last 0 seconds.
2019-07-08 16:05:08      stdout   Error: /usr/lib/x86_64-linux-gnu/kodi/kodi-gbm not found
2019-07-08 16:05:08      stdout   Error: /usr/lib/x86_64-linux-gnu/kodi/kodi-gbm not found
2019-07-08 16:05:08      stdout   Error: /usr/lib/x86_64-linux-gnu/kodi/kodi-gbm not found
2019-07-08 16:05:08      stdout   ---> starting Kodi with command: kodi-standalone
 
Could you help me out? Or isn’t it possible to use it on DSM. Thanks in advance.
(2018-10-06, 07:57)k2eric Wrote: [ -> ] 
Quote:I give the Kodi container read-only access to my media library

Shouldn't Kodi be able to write media NFO files to your media library during media library updates?
(2019-09-11, 00:05)JumboMumbo Wrote: [ -> ]Shouldn't Kodi be able to write media NFO files to your media library during media library updates? 

I personally haven't found a need for that, but it's totally OK to mount your media library as read-write if you'd like.
Pages: 1 2