larsks / docker-image-logitech-media-server

MIT License
33 stars 74 forks source link

Make ARM64 compatible Dockerfile #13

Open RyanRamchandar opened 7 years ago

RyanRamchandar commented 7 years ago

So that this can be run on ARM64 devices like the Pine64. https://www.pine64.org/

larsks commented 7 years ago

I don't have the ability to test this myself, but if you want to submit a pull request I am happy to take a look at it.

RyanRamchandar commented 7 years ago

It should be a one-line fix since we are pulling the _all Logitech Media Server package variant which should work cross platform.

If we change: FROM ubuntu:trusty

to: FROM multiarch/ubuntu-core:arm64-trusty

it builds fine, but when running it, docker logs ... gives this error and the container does not run:

======================================================================
http://172.17.0.4:9000/
======================================================================
The following modules failed to load: DBI EV XML::Parser::Expat HTML::Parser JSON::XS Digest::SHA1 YAML::XS Sub::Name
*******
NOTE:
If you're running some unsupported Linux/Unix platform, please use the buildme.sh 
script located here:
https://github.com/Logitech/slimserver-vendor/tree/public/7.9/CPAN
If 7.9 is outdated by the time you read this, Replace "7.9" with the major version
You should never need to do this if you're on Windows or Mac OSX. If the installers
don't work for you, ask for help and/or report a bug.
*******

Exiting..

I also tested multiarch/ubuntu-core:arm64-xenial but it throws a different error.

/entrypoint.sh: 10: exec: sudo: not found
/entrypoint.sh: 10: exec: sudo: not found
/entrypoint.sh: 10: exec: sudo: not found
/entrypoint.sh: 10: exec: sudo: not found
larsks commented 6 years ago

The sudo error is an easy fix (just install sudo). However, I've just updated the Dockerfile to an ubuntu:xenial base, which includes by default the runuser command, which is what the entrypoint uses now.

It looks like there is a multiarch/ubuntu-core:arm64-xenial image, so I'll try to take a look at that in the near future now that I have a free Pi in the house for testing.

RyanRamchandar commented 6 years ago

Here are the official arm64v8 images from Docker: https://hub.docker.com/u/arm64v8/

RyanRamchandar commented 6 years ago

I was able to get this working with FROM arm64v8/debian:stretch-slim and the latest 7.9.1 release which includes arm64v8 binaries. Only a 115 MB docker image too!

See https://github.com/Logitech/slimserver/issues/181#issuecomment-351787316

RaymondMouthaan commented 6 years ago

Hello @larsks & @RyanRamchandar,

I've been working on this project to support linux-amd64, linux-arm and linux-arm64. In such way that it supports manifest list, which makes life easier for users. Also the base image has been changed to reduce the final image size. From ubuntu:xenial to debian:stretch-slim, which reduces the compressed file size from approximately 150MB to 110MB.

Please consider raymondmm/logitech-media-server.

I've tested the linux-amd64 and linux-arm images on my Synology NAS and Raspberry PI 3 with docker version 18.03.1-ce by opening the webpage and it looks good, but I haven't been able to test with a real Squeezebox, because I have non available at the moment. Also I haven't been able to test the linux-arm64 image, because I haven't got an arm64 device available.

Could you both have a look at these images, if they work for you?

There is no need to explicitly use the tag for your architecture, just deploy as the example below:

docker run -d --init \
           -p 9000:9000 \
           -p 9090:9090 \
           -p 3483:3483 \
           -p 3483:3483/udp \
           -v /etc/localtime:/etc/localtime:ro \
           -v <local-state-dir>:/srv/squeezebox \
           -v <music-dir>:/srv/music \
           --name logitech-media-server \
           raymondmm/logitech-media-server

Docker checks the architecture by it self with the manifest list and pulls the latest required image for it. Ofcause you may use a tag to explicit pull a certain version.

Let me know what you think.

Greetz, Raymond

larsks commented 6 years ago

I think it would be neat if you were to submit these changes back as a pull request.

RaymondMouthaan commented 6 years ago

Yes sure, but it would be neat to know if the images work for you. If they do, then Ill refactor the project to your docker registry and do a PR to have it merged.

RyanRamchandar commented 6 years ago

@RaymondMouthaan Very nice!

This ran successfully on my arm64v8 processor (Allwinner A64). Specifically:

# uname -a
Linux umbrela-bridge 4.15.0-15-generic #16-Ubuntu SMP Wed Apr 4 14:00:16 UTC 2018 aarch64 aarch64 aarch64 GNU/Linux

Do you mind sharing your Dockerfiles? Also, what is the advantage of --init in your docker run?

RaymondMouthaan commented 6 years ago

@RyanRamchandar great you tested it successfully on arm64!

With that in mind I can do a PR of my GitHub project (where you can find all the files, like Dockerfile) to @larsks his project. This I will do tomorrow, since I am working on a different docker project now and its almost time for bed as well ;-)

Regarding --init, I just used it from the example of Lars, but for details you can check Stack Overflow. Also you can run the command without --init and see if that works too.

I'll keep you guys informed about the PR.

RyanRamchandar commented 6 years ago

@RaymondMouthaan great. Normally I don't run with --init.

I really like how you used the manifest-tool to simplify image tags. We also run across multiple archs and this would be helpful for us.

RaymondMouthaan commented 6 years ago

@RyanRamchandar, Well a couple of weeks ago I investigated the use of manifest tool and since then I do some PRs on different kind of projects, just because it makes life easier for end-users. One remake to be made is, that I am using the manifest tool of @estesp (Phil Estes), who wrote it and demonstrated it at docker con 2017. If I am right, docker staff implemented it into docker as part of the docker tools, but its still in experimental fase. This is the next step for me to investigate :-)

Glad I could help :-)

RaymondMouthaan commented 6 years ago

PR has been submitted :)

DOliana commented 5 years ago

@RaymondMouthaan would you be willing to publish a build to docker hub while the PR is under review? I was not able to build the image myself (I tried on a RPi, which I assume is the problem), but would like to try out LMS in docker on my RPi.

DOliana commented 5 years ago

@RaymondMouthaan: Never mind, I just did it myself - this way I learned something About travis, and docker hub :-). For anybody interested this preliminady Image can be found here: docker hub, GitHub