Unable to access any files on http://<openhabhost>:<port>/static

I am running a docker container 2.5.M1.
I have migrated all of my files and configs from an Opehabian install which worked reasonably trouble free.
Main issues were:
missing libraries (ffmpeg), the exec binding (permissions and file path changes) and getting configs redirected to new docker containers for InfluxDB / mosquitto etc.

Irrespective, I am very happy with the progress so far, but have come across a bit if a problem.

I am presenting openhab on port 8888 - so my port number os not the default (I am not sure if this is related, just thought I would include it in case there is some ugly hard mapping)

When I attempt to access any content in the /static folder (i.e. http://openhabhost:8888/static) I getan error message:
## HTTP ERROR 404

Problem accessing /static. Reason:

Not Found

[Powered by Jetty:// 9.4.12.v20180830](http://eclipse.org/jetty)

When I access this in my old instance, I get:

# openHAB user provided static content

Serve your own static html pages or resources from here. Files stored in the openHAB configuration subfolder html will be available through the HTTP server of openHAB, e.g. http://device-address:8080/static/image.png.

Resources for sitemap elements (image, video,...) can also be provided though this folder.

It seems that this is rendering incorrectly - and I have no idea if this is due to a config I copied over from my openhabian install, or something related to the port change.

Any ideas?

Killed the other container on 8080 and spun a new openhab with config pointing to use 8080 - same error.
Suspect this is not related to the port.

As a matter of interest, other web interfaces like Habpanel seem to load (but since /static is not available, my css does not get honoured)

Could you share your Dockerfile (and if used your docker-compose.yaml) and an ls -al of the html directory? My guess it is related to the volume mapping of the container for this directory or a file access issue.

Sure - here it is (for now) simple docker create and docker start after that:

docker create \
        --name openhab \
        -e PUID=9001 \
        -e PGID=9001 \
        --net=host \
        -v /etc/localtime:/etc/localtime:ro \
        -v /etc/timezone:/etc/timezone:ro \
        -v /home/docker/openhab/conf:/openhab/conf \
        -v /home/docker/openhab/userdata:/openhab/userdata \
        -v /home/docker/openhab/addons:/openhab/addons\
        -e "OPENHAB_HTTP_PORT=8888" \
        -e "OPENHAB_HTTPS_PORT=9999" \
        -e "USER_ID=9001" \
        -e "GROUP_ID=9001" \
        --restart=unless-stopped \
        openhab/openhab:2.5.0.M1

Do note that seemingly everything else is behaving as expected (except for example, if I go to http://dockerhost:8888 it also throws the error above, but if I include http://dockerhost:8888/start/index it does as expected.

Suspect it’s a jetty thing.

I tried changing to the default port and dropping other containers that were on 8080 - no luck

nearly forgot
> user@dockerhost:/home/docker/openhab/conf/html$ ls -la
> total 324
> drwxrwxr-x 11 openhab openhab 4096 Jun 4 18:54 .
> drwxrwxr-x 14 openhab openhab 4096 Jun 3 13:27 …
> drwxrwxr-x 2 openhab openhab 4096 Jun 3 13:27 css
> -rw-r–r-- 1 openhab openhab 156762 Jun 4 18:59 frontdoor.jpg
> drwxrwxr-x 3 openhab openhab 4096 Jun 3 13:27 habpanel
> -rwxrwxr-x 1 openhab openhab 4873 Jun 3 14:09 habpanelviewer.css
> -rwxrwxr-x 1 openhab openhab 2881 Jun 3 13:47 HideHeader.html
> drwxrwxr-x 2 openhab openhab 4096 Jun 3 13:27 icons
> drwxrwxr-x 2 openhab openhab 4096 Jun 3 13:27 images
> -rwxrwxr-x 1 openhab openhab 451 Jun 3 13:47 index.html
> drwxrwxr-x 2 openhab openhab 4096 Jun 3 13:27 js
> -rwxrwxr-x 1 openhab openhab 42055 Jun 3 13:47 keypad.css
> drwxrwxr-x 2 openhab openhab 4096 Jun 3 13:27 matrix-theme
> -rwxrwxr-x 1 openhab openhab 2647 Jun 3 13:47 myStyle.css
> -rwxrwxr-x 1 openhab openhab 1462 Jun 3 13:47 overrides.html
> -rwxrwxr-x 1 openhab openhab 147 Jun 3 13:47 rainbow.css
> -rwxrwxr-x 1 openhab openhab 28473 Jun 3 13:47 rainbow.css.bak
> -rwxrwxr-x 1 openhab openhab 282 Jun 3 13:47 readme.txt
> -rwxrwxr-x 1 openhab openhab 3521 Jun 3 13:47 spotify-auth.html
> drwxrwxr-x 2 openhab openhab 4096 Jun 3 13:27 spotify-playlister
> -rwxrwxr-x 1 openhab openhab 12981 Jun 3 13:47 test.jpg
> drwxrwxr-x 2 openhab openhab 4096 Jun 3 13:27 wallpaper
> drwxrwxr-x 6 openhab openhab 4096 Jun 3 13:27 weather-underground-icons

and
> user@dockerhost:/home/docker/openhab/conf/html$ id openhab
> uid=9001(openhab) gid=9001(openhab) groups=9001(openhab)

OK - no more love.
Was wondering if the authors of Openhabian can tell me whether they amended anything in user data (e.g Jetty.xml)

Might try start the container with an empty volume mount and copy over the configuration files etc from /etc ? Think this will help?

Rebuilt from scratch and attempted another restore, same problem.

Eventually got this fixed by being selective on what I restored - suspect the culprit lives in /user data/etc

It’s working properly now for me

Hi Allen,

Sorry to bump this “old” topic :wink:

How did you fix the missing ffmpeg library in docker OH?

// install ffmpeg for the frontdoor image grab code and adb for driving firesticks:

docker exec openhab apt-get update && apt-get install -y ffmpeg && apt install -y android-tools-adb
2 Likes

Also remember to commit this to your image at the end:

//Commit changes to container image
docker commit openhab

1 Like

This fixes it, thanks!!

No probs Arie