swagger-api / swagger-ui

Swagger UI is a collection of HTML, JavaScript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API.
https://swagger.io
Apache License 2.0
26.63k stars 8.96k forks source link

Docker container does not start because `node` cannot be found #10195

Closed MartijnVdS closed 3 weeks ago

MartijnVdS commented 3 weeks ago

Q&A (please complete the following information)

Describe the bug you're encountering

Start the swagger-ui docker container for 5.18.0 with default settings does not work and immediately quits with an error.

To reproduce...

Steps to reproduce the behavior:

  1. Run docker run --rm -ti swaggerapi/swagger-ui:v5.18.0
  2. See error message:
$ docker run --rm -ti swaggerapi/swagger-ui:v5.18.0
Unable to find image 'swaggerapi/swagger-ui:v5.18.0' locally
v5.18.0: Pulling from swaggerapi/swagger-ui
Digest: sha256:ddff5bb2d8580b999f3ee5a05ec46dedcf6dbb6c9f46f2f0250497c41b7de539
Status: Downloaded newer image for swaggerapi/swagger-ui:v5.18.0
/docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf
10-listen-on-ipv6-by-default.sh: info: Enabled listen on IPv6 in /etc/nginx/conf.d/default.conf
/docker-entrypoint.sh: Sourcing /docker-entrypoint.d/15-local-resolvers.envsh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
20-envsubst-on-templates.sh: Running envsubst on /etc/nginx/templates/default.conf.template to /etc/nginx/conf.d/default.conf
/docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/40-swagger-ui.sh
/docker-entrypoint.d/40-swagger-ui.sh: line 8: node: not found

Expected behavior

I expect the docker image to work in its default configuration.

Screenshots

Previous versions work correctly:

$ docker run --rm -ti swaggerapi/swagger-ui:v5.17.14
Unable to find image 'swaggerapi/swagger-ui:v5.17.14' locally
v5.17.14: Pulling from swaggerapi/swagger-ui
Digest: sha256:cb968cc70260c6027b44f227d054a0f12381736e9ab628ef6b6070a19fdf2172
Status: Downloaded newer image for swaggerapi/swagger-ui:v5.17.14
/docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf
10-listen-on-ipv6-by-default.sh: info: Enabled listen on IPv6 in /etc/nginx/conf.d/default.conf
/docker-entrypoint.sh: Sourcing /docker-entrypoint.d/15-local-resolvers.envsh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
20-envsubst-on-templates.sh: Running envsubst on /etc/nginx/templates/default.conf.template to /etc/nginx/conf.d/default.conf
/docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/40-swagger-ui.sh
/docker-entrypoint.sh: Configuration complete; ready for start up
2024/11/05 15:20:30 [notice] 1#1: using the "epoll" event method
2024/11/05 15:20:30 [notice] 1#1: nginx/1.26.0
2024/11/05 15:20:30 [notice] 1#1: built by gcc 13.2.1 20231014 (Alpine 13.2.1_git20231014) 
2024/11/05 15:20:30 [notice] 1#1: OS: Linux 6.6.51-0-virt
2024/11/05 15:20:30 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576
2024/11/05 15:20:30 [notice] 1#1: start worker processes
2024/11/05 15:20:30 [notice] 1#1: start worker process 56
2024/11/05 15:20:30 [notice] 1#1: start worker process 57
2024/11/05 15:20:30 [notice] 1#1: start worker process 58
2024/11/05 15:20:30 [notice] 1#1: start worker process 59
MartijnVdS commented 3 weeks ago

According to the documentation, running it in a container like this without further configuration is supposed to work: https://swagger.io/docs/open-source-tools/swagger-ui/usage/installation/

MartijnVdS commented 3 weeks ago

Could this be related: https://github.com/swagger-api/swagger-ui/pull/10192

jortkoopmans commented 3 weeks ago

Just made the same report, also pointing to that commit. Note that also latest image is affected.

Exagone313 commented 3 weeks ago

Caused by d849b746b69f6ff0e8d3702927b3bc546e01401c

Seems like a breaking change to me.

airtonzanon commented 3 weeks ago

Having the same issue, any best practices to how to deal with it or it's a mistake?

carlosmesquita commented 3 weeks ago

Caused by d849b74

Seems like a breaking change to me.

Yes, that is for sure the cause. Removing node basically breaks usage of swagger-ui in containers.

javac9 commented 3 weeks ago

Same problem here, hope it gets fixed soon

char0n commented 3 weeks ago

Hi everybody,

My fault. I've tested locally and I could execute node even without the explicit install. Obviously I did something wrong. Fix release is comming.

char0n commented 3 weeks ago

Full remediation in https://github.com/swagger-api/swagger-ui/releases/tag/v5.18.1