-
Notifications
You must be signed in to change notification settings - Fork 189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SwaggerUI is not working in Docker, but works locally. Only the SwaggerUI throws a 404 Not Found
#527
Comments
I am experiencing the same issue |
That is weird indeed 😮 But based only on this message it is really hard to tell what is going wrong and where. 🤔 I tried to build the
cargo build --release --target=x86_64-unknown-linux-musl
FROM alpine:3.17
RUN mkdir /opt/app
COPY target/x86_64-unknown-linux-musl/release/todo-axum /opt/app
EXPOSE 8080
CMD [ "/opt/app/todo-axum" ]
If you build in debug mode then utoipa-swagger-ui needs the Also not that you have correct target. that Hope these helps. |
Okay, that explains a lot .... you are totally right, it's working with a release build. :) I created the build in debug mode, and it seems like that the Maybe it makes sense that we pinpoint that "issue" out in the Readme, thank you very much! <3 |
I've created a small documentation change to pinpoint it better in the README. Maybe it will help out. :3 |
Yeah, actually there is slight hint towards this in utoipa-swagger-ui README.md but it is not obivous to the eye. |
Ah yeah, now I see what you mean. It wasn't quite obvious to me and two other people. So spending hours investigating that issue could be solved by pinpointing it out. :) |
True 🙂 |
Relates to #268 |
Okay, I know this sounds weird ... but: The SwaggerUI is not working inside of Docker. ^^"
Let me explain what I did. When I write down everything like in the example for
axum
and I start the application withcargo run
, I can see theswagger-ui
and also see the/docs/openapi.json
file.Now the interesting part, when I compile the code inside docker and provide it inside docker only the
swagger-ui
endpoint (/docs
in this example) is returning a404 Not Found
. But the interesting thing is, all other endpoints are working... Including the/docs/opanapi.json
endpoint.So, only the
swagger-ui
isn't working inside Docker. ^^"I thought "maybe it's a compiled problem", so I copied the locally build binary (which worked on the machine and showed the swagger-ui) into the docker container, started it and "boom", no swagger-ui. ^^"
It's so weird that every endpoint is working, also the
openapi.json
endpoint (which shows the full generated openapi json), but only theswagger-ui
HTML-Page is not working. There is really no difference inside the Docker container and my local machine (like I said, I copied the binary to prove my assumption).I also tried bigger OS containers like
ubuntu
and smaller ones likealpine
, in all containers every endpoint is working, except theswagger-ui
. :(Does someone have an idea what I could test/think of? I'm getting out of ideas. ^^"
The text was updated successfully, but these errors were encountered: