klausmeyer / docker-registry-browser

🐳 Web Interface for the Docker Registry HTTP API V2 written in Ruby on Rails.
https://hub.docker.com/r/klausmeyer/docker-registry-browser/
MIT License
512 stars 54 forks source link

No Java Script Runtime in Container #434

Closed klicki closed 3 years ago

klicki commented 3 years ago

The docker container seems to miss a few components:

Puma starting in single mode...
* Puma version: 5.3.2 (ruby 3.0.2-p107) ("Sweetnighter")
*  Min threads: 5
*  Max threads: 5
*  Environment: production
*          PID: 1
! Unable to load application: ExecJS::RuntimeUnavailable: **Could not find a JavaScript runtime.** See https://github.com/rails/execjs for a list of available runtimes.
/usr/local/bundle/gems/execjs-2.7.0/lib/execjs/runtimes.rb:58:in `autodetect': Could not find a JavaScript runtime. See https://github.com/rails/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)
klausmeyer commented 3 years ago

Hi @klicki

thanks for reporting that issue.

Could you please tell me when exactly you get this error and with which version of the docker image? I've just tried to spin up the latest version and it was working fine for me.

$ docker image inspect klausmeyer/docker-registry-browser:latest | grep -E 'Id|Created'
        "Id": "sha256:a46deff084a07d4c7ab2def7194db116d293e71c6bed840603b469d611205a61",
        "Created": "2021-07-28T07:32:40.291480933Z",

Looks like the automated builds haven't worked for about two months so the latest tag isn't really up to date - but that's another topic I have to check.

Thanks, Klaus

klicki commented 3 years ago

Hi, I'm back in the office now. Thanks for the friendly reply.

I started the container the recommended way: sudo docker run ... klausmeyer/docker-registry-browser which shows: "Id": "sha256:a46deff084a07d4c7ab2def7194db116d293e71c6bed840603b469d611205a61", "Created": "2021-07-28T07:32:40.291480933Z",

What does Could not find a JavaScript runtime. mean for me? For now the container doesn't start. :(

klicki commented 3 years ago

BTW: The output above is from docker logs.

klausmeyer commented 3 years ago

Thanks for the answer.

What does Could not find a JavaScript runtime. mean for me?

I'm really wondering why you get this error (looks like even with the same version of the image as I tried it).

The JavaScript runtime should be only required when building the image and I'm including nodejs for that.

Not sure if it helps but I've fixed the automated builds in the meantime and there is a newer image available so maybe you could give it a try with docker pull klausmeyer/docker-registry-browser:latest and then do the docker run [...] again.

klicki commented 3 years ago

I used the latest image: "Id": "sha256:cba3ffba7d5457b968fed4225a67836e85b6655e5331f510c93223f67b4b233a", "Created": "2021-09-17T21:27:58.241114658Z",

The message remains the same:

! Unable to load application: ExecJS::RuntimeUnavailable: Could not find a JavaScript runtime. See https://github.com/rails/execjs for a list of available runtimes. /usr/local/bundle/gems/execjs-2.7.0/lib/execjs/runtimes.rb:58:in autodetect': Could not find a JavaScript runtime. See https://github.com/rails/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable) from /usr/local/bundle/gems/execjs-2.7.0/lib/execjs.rb:5:in' from /usr/local/bundle/gems/execjs-2.7.0/lib/execjs.rb:4:in `

'

This is confusing, at least for me.

klausmeyer commented 3 years ago

This is confusing, at least for me.

Also for me ... I just tried with the latest tag as well and it's working fine.

Could you share a few details about on what system you're trying to run the image?

$ cat /etc/os-release
$ uname -a
$ docker version

Also interesting for me would be the output of:

$ docker run --rm -u root klausmeyer/docker-registry-browser:latest sh -c "apk update && apk add file && which node && file \$(which node)"
klicki commented 3 years ago

More data:

cat /etc/os-release

PRETTY_NAME="Debian GNU/Linux 10 (buster)" NAME="Debian GNU/Linux" VERSION_ID="10" VERSION="10 (buster)"

uname -a

Linux tool-server 4.19.0-10-amd64 #1 SMP Debian 4.19.132-1 (2020-07-24) x86_64 GNU/Linux

docker version

Client: Docker Engine - Community Version: 19.03.12 API version: 1.40 Go version: go1.13.10 Git commit: 48a66213fe Built: Mon Jun 22 15:45:50 2020

The "docker run ..." command creates a -bash: $: Kommando nicht gefunden.

Maybe you have mounted the Java Runtime and I didn't?

klausmeyer commented 3 years ago

More data: [...]

That's all looking good so far.

The "docker run ..." command creates a -bash: $: Kommando nicht gefunden.

It looks like if you'd have included the $ at the start of line when copy & pasting the command.

Could you please try without?

docker run --rm -u root klausmeyer/docker-registry-browser:latest sh -c "apk update && apk add file && which node && file \$(which node)"

This is what I get on a Debian 10 machine (although with newer docker - but that shouldn't make a difference):

fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/community/x86_64/APKINDEX.tar.gz
v3.14.2-44-g417ec972c6 [https://dl-cdn.alpinelinux.org/alpine/v3.14/main]
v3.14.2-42-gf168ad374f [https://dl-cdn.alpinelinux.org/alpine/v3.14/community]
OK: 14939 distinct packages available
(1/2) Installing libmagic (5.40-r1)
(2/2) Installing file (5.40-r1)
Executing busybox-1.33.1-r3.trigger
OK: 76 MiB in 51 packages
/usr/bin/node
/usr/bin/node: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-musl-x86_64.so.1, stripped

The /usr/bin/node should be the JavaScript runtime - so I'm really wondering why it is complaining on your end about it being missing. That file should be shipped within the docker image.

klicki commented 3 years ago

😳 Sorry for the $, how embarrasing...

docker run --rm -u root klausmeyer/docker-registry-browser:latest sh -c "apk update && apk add file && which node && file \$(which node)"

fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/main/x86_64/APKINDEX.tar.gz fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/community/x86_64/APKINDEX.tar.gz v3.14.2-44-g417ec972c6 [https://dl-cdn.alpinelinux.org/alpine/v3.14/main] v3.14.2-42-gf168ad374f [https://dl-cdn.alpinelinux.org/alpine/v3.14/community] OK: 14939 distinct packages available (1/2) Installing libmagic (5.40-r1) (2/2) Installing file (5.40-r1) Executing busybox-1.33.1-r3.trigger OK: 76 MiB in 51 packages /usr/bin/node /usr/bin/node: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-musl-x86_64.so.1, stripped

klausmeyer commented 3 years ago

Not a problem :) That's also looking good - I'm getting out of ideas what to check.

There might be anything blocking the node binary to be executed inside the container. You could test it like this:

docker run --rm -u root klausmeyer/docker-registry-browser:latest node -e "console.log(42);"

Things you could check on your docker host:

klicki commented 3 years ago

docker run --rm -u root klausmeyer/docker-registry-browser:latest node -e "console.log(42);"

42

Daemon Log

no red flags

Syslog

Just a few complaints about docker0

Sep 20 15:56:43 tool-server kernel: [9685365.933192] docker0: port 2(vethf717224) entered disabled state Sep 20 15:56:43 tool-server kernel: [9685365.940162] device vethf717224 left promiscuous mode

I'm running out f options, too. It is not possible to reboot the server or things like that, because some software with customer relevance is running.

Other containers like https://github.com/fossology/fossology work like a charm. Maybe I can find a different server and have better luck there, but due to the project situation we are rather tight with resources. ;-)

klicki commented 3 years ago

Thank you very much so far! I'll let you know if I'm stumbling over a solution.

Carsten