modem7/docker-rickroll

Only works on 8080

Opened this issue · 3 comments

If I run this on any other port - I've been using 1987 since that's the song's release year - I get a 500 error.

Works:

rickroll:
image: modem7/docker-rickroll
container_name: Rickroll
ports:
- 8080:8080
environment:
- TITLE="not-really-roll" # Changes the title of the webpage
- PORT=8080

Does not work:

rickroll:
image: modem7/docker-rickroll
container_name: Rickroll
ports:
- 1987:1987
environment:
- TITLE="not-really-roll" # Changes the title of the webpage
- PORT=1987

I've tried digging into this myself and have stumbled a lot. nginx errors don't seem to make it to the docker logs (maybe because /var/log/nginx is -> /dev/stderr ? maybe error level setting in nginx.conf ? ) but I suspect it has to do with the proxy setup, or maybe it's due to the nginx.conf file including configs from /etc/nginx/conf.d, which has a default.conf file which may be overriding / messing with the primary nginx.conf settings.

I may be able to do some further troubleshooting (if I manage to get a docker build environment up)... If I figure it out I'll send a PR.

Recommend removing

include /etc/nginx/conf.d/*.conf;

Even after changing

    access_log    /var/log/nginx/access.log  main;
    include       /etc/nginx/conf.d/*.conf;
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

to (needed for the healthcheck config)

    access_log    /var/log/nginx/access.log  main;
    include       /etc/nginx/conf.d/health-check.conf;
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

The issue is still there.

I looked at netstat, and changing the port does indeed make nginx listen on that port, so that's working as intended:

docker exec -it Rickroll /bin/sh
/ $ netstat -tulpn | grep :1987
tcp        0      0 0.0.0.0:1987            0.0.0.0:*               LISTEN      1/nginx: master pro
/ $

The logs are redirected to console as is, but for some reason, it doesn't like changing ports.

This is the log entry I get:

192.168.0.100 - - [31/Jul/2024:23:34:26 +0000] "GET /favicon.ico HTTP/1.1" 500 579 "[http://192.168.50.254:1987/video.mp4"](http://192.168.50.254:1987/video.mp4%22) "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36" "-"

It may be due to how I decided to reroute the container to the video rather than a page etc.

Only thing I've found so far is: nginxinc/docker-nginx-unprivileged#164 but I don't think it relates to this issue.

I'm currently quite swamped at work, so it's unlikely I'll be able to put much effort into resolving this issue for the foreseeable, but if you figure it out, I'm happy to review, test and merge a PR.

It may be due to how I decided to reroute the container to the video rather than a page etc.

Yea I think this is it. Somehow nginx is trying to swap to 8080 for the video itself... not sure why.

I don't have an environment right now to try things but hopefully I will soon. If I can figure it out I'll share.