Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker - can't setup docker on raspberry pi running LibreELEC #315

Open
4 tasks done
madmax2 opened this issue Aug 21, 2020 · 6 comments
Open
4 tasks done

Docker - can't setup docker on raspberry pi running LibreELEC #315

madmax2 opened this issue Aug 21, 2020 · 6 comments

Comments

@madmax2
Copy link

madmax2 commented Aug 21, 2020

I followed the guide to setup docker kodi addon on my raspberry pi (libreELEC)
but it still won't run.

Does anyone know what I can do to solve this problem?

What I have done..

  • Install the Docker engine
    If you want to run it on a LibreELEC system
    You can simply install the offical service addon Docker
    Note: Enable the feature Wait for network before starting kodi under Settings > LibreELEC > Network

  • Get the latest GoogleHomeKodi docker image
    docker pull omertu/googlehomekodi

  • docker run \
    --detach \
    --publish 8099:8099 \
    --restart always \
    -e KODI_PROTOCOL="http" \
    -e KODI_IP="192.168.0.2" \
    -e KODI_PORT="8080" \
    -e KODI_USER="kodi" \
    -e KODI_PASSWORD="password" \
    -e AUTH_TOKEN="myConnectionPassword" \
    --name googlehomekodi \
    omertu/googlehomekodi

  • or with the use of the config file:
    Create a copy of the kodi-hosts.config.js.dist file and name it kodi-hosts.config.js.
    Edit the file and make sure the kodiConfig and globalConfig sections match your environment.
    Run it
    docker run \
    --detach \
    --publish 8099:8099 \
    --restart always \
    -v YOUR_CONFIG_DIR:/storage/kodi-hosts.config.js. \
    --name googlehomekodi \
    omertu/googlehomekodi

@dazazbab
Copy link

did you port forward 8099 on your router?

@madmax2
Copy link
Author

madmax2 commented Aug 25, 2020

8099 and 8080, which is the WAN and LAN port in port forwarding rules?
I think there is some confusion there. (The readme needs to fix the portforwarding section to make it less confusing)

Is this part of the syntax correct?
-v YOUR_CONFIG_DIR:/storage/kodi-hosts.config.js. \

this is where my file is located on the pi.
/storage/kodi-hosts.config.js.

In you other answer

So I have edited en.json, server.js, and helpers.js when I was using glitch. When glitch messed up I switch to docker and tried to copy my edited files to the docker image and then run it. I never managed to get the it running.

I ended up copying my edited files into the docker container after it has run. Then I restart the container and it worked.

For server.js and helpers.js I used the command
docker cp [filepath] [container name]:/home/node/app/

For en.json I used the command
docker cp [filepath] [container name]:/home/node/app/broker/

To restart the container I used the command
docker restart [container name]

I figured out target path by going into the running container using the command
docker container exec -it [container name] sh

Where are these files?
Are they also located on a raspberry libreELEC - docker addon
or only when running linux with docker installed?

From the readme it just tell us to do one those things above in my first post..
I am not familar with the server,js, helper.js file you mention..
or the path e.g. docker cp [filepath] [container name]:/home/node/app/
I don't think that exists on the LibreELEC storage..

Even this command docker-compose for the second option to setup docker does not work on libreELEC pi
When I type this command, no such command exists..

  • with the use of docker-compose:
    create a file named docker-compose.yml with the following contents:

@dazazbab
Copy link

dazazbab commented Aug 25, 2020

8099 and 8080, which is the WAN and LAN port in port forwarding rules?
I think there is some confusion there. (The readme needs to fix the portforwarding section to make it less confusing)

I forwarded both 8080 and 8099 on my router. The way I understand it, port 8080 is for webserver access (README.md part A) while port 8099 is where the Docker will listen (README.md part B.3, step 5).

Is this part of the syntax correct?
-v YOUR_CONFIG_DIR:/storage/kodi-hosts.config.js. \

I didn't go with that option. I ran the container with the use of environment variables (README.md part B.3, step 3, option 1)

In you other answer
Where are these files?
Are they also located on a raspberry libreELEC - docker addon
or only when running linux with docker installed?

These files are both inside the Docker Image you pull from omertu/googlehomekodi and the Docker Container you ran from that Image. I learned that if you edited these files inside the Image you won't be able to run the container from the image. Both the Docker Image and Container are inside libreELEC.

From my trial and errors I found that the Docker addon needs a running Container to function. To run a Container you first need an Image.

I pulled the default Image from omertu/googlehomekodiand then ran the Container from it. I then copied my customized files into the Container.

The path [container name]:/home/node/app/ is inside the running Docker Container.

What I did was;

  1. pulled the default Docker Image (README.md part B.3 step 2)
    docker pull omertu/googlehomekodi
  2. ran the production-ready docker Image with the use of environment variables (README.md part B.3, step 3, option 1);
    docker run
    --detach
    --publish 8099:8099
    --restart always
    -e KODI_PROTOCOL="http"
    -e KODI_IP="YOUR_INTERNAL_KODI_IP_ADDRESS"
    -e KODI_PORT="YOUR_KODI_PORT"
    -e KODI_USER="YOUR_KODI_USER_NAME"
    -e KODI_PASSWORD="YOUR_KODI_PASSWORD"
    -e AUTH_TOKEN="YOUR_CONNECTION_PASSWORD"
    --name googlehomekodi
    omertu/googlehomekodi
  3. checked the name of my running Container
    docker container ls
  4. accessed the running Container to see where my edited files should go
    docker container exec -it [container name] sh
  5. copied my customized server.js, helpers.js, and en.json into the Docker Container using docker cp command (not in the README) and the paths I got from step 4

I needed step 3-5 because I changed contents in those 3 files and wanted to use them in googlehomekodi. Step 1 and 2 should be enough if you want to run googlehomekodi as default.

For me the README.md was straight forward. I ran to issues because I wanted to run a customized version of googlehomekodi. I ended up adding some extra steps to accomplish it.

I hope that helps you. The terms are a little confusing for me since I didn't have any experience with this, but like I said after a lot of trial and errors I got it to work.

Let me know if you have any other questions.

PS: I'm on libreELEC 9.2.4 on Raspberry Pi 4

@keydon
Copy link
Collaborator

keydon commented Sep 4, 2020

Sorry for my late response, I was busy with my life. But here is my help if still needed:

but it still won't run.

what does that even mean? does the run command throw an error? does the container start? what steps of the troubleshoot section do work, what steps dont?

Is this part of the syntax correct?
-v YOUR_CONFIG_DIR:/storage/kodi-hosts.config.js.

No this is WRONG!
Wherever there is something UPPERCASE in the Readme it needs to be replaced with values specific to your environment!
in other words replace the placeholder YOUR_CONFIG_DIR with the directory you keep your configuration files:
like in your case:

-v /storage:/config

though I would advice you NOT to mount the whole /storage directory into the container. consider moving your config files to a dedicated folder like /storage/googlehomekodi-config/

@madmax2
Copy link
Author

madmax2 commented Sep 8, 2020

what does that even mean? does the run command throw an error?

it runs, no errors that I can see

does the container start?

yes

what steps of the troubleshoot section do work, what steps don't?

step 3 - page does not load or ask for the token password when using my libreelec IP address e.g. 192.168.0.200:8099

I have port forward the docker rule as following so I think that is correct rule e.g.
Protocol = BOTH
WAN = 8080
LAN = 8099
Destination IP = 192.168.0.200

No this is WRONG!
Wherever there is something UPPERCASE in the Readme it needs to be replaced with values specific to your environment!
in other words replace the placeholder YOUR_CONFIG_DIR with the directory you keep your configuration files:
like in your case:

So just to be clear..

-Do I place the file kodi-hosts.config.js. into a directory e.g. /storage/config?
Or
-place kodi-hosts.config.js into directory /storage and rename filename of kodi-hosts.config.js to "config"

And then I type this command exactly as this
-v /storage:/config
OR just place file kodi-hosts.config.js into /storage
and run command like this
-v /storage:/kodi-hosts.config.js
This where I am confused about..


Do I need to run all of these commands in terminal one command at a time
or I can paste the entire lot and just press enter?

docker run \
   --detach \
   --publish 8099:8099 \
   --restart always \
   -v YOUR_CONFIG_DIR:/config \
   --name googlehomekodi \
   omertu/googlehomekodi

@keydon
Copy link
Collaborator

keydon commented Sep 8, 2020

no errors that I can see
step 3 - page does not load

If the container starts up correctly,it should load. Port-forwarding is not yet involved at this point.
please check the logs for errors with docker logs googlehomekodi and try to make sense of the error message yourself or paste it here if you are not sure.

This where I am confused about..

the right side, after the colon is not written in UPPERCASE, therefore it is NOT part of the placeholder and therefore should not be touched!
So place your file kodi-hosts.config.js into your hosts config-directory. i.e. /storage/my-cool-config
then use -v /storage/my-cool-config:/config to mount your hosts config-directory into the containers config-directory.

Do I need to run all of these commands in terminal one command at a time
or I can paste the entire lot and just press enter?

paste the entire lot and just press enter. it is one single command spread over multiple lines for readability.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants