question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to serve local file with docker

See original GitHub issue

I am following the instructions to set up a docker container with a local API docs file, with an api.yaml file in the local repo in the folder $HOME/my-app, and launching the container as follows:

docker run -p 80:8080 -e SWAGGER_JSON=/docs/api.yaml -v $HOME/my-app:/docs swaggerapi/swagger-ui

However, it returns in a 404 ("GET /docs/api.yaml HTTP/1.1" 404 126).

It’s not clear what I’m doing wrong and any help would be appreciated.

Thanks for reading.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:6
  • Comments:11

github_iconTop GitHub Comments

35reactions
AirDurcommented, Jul 18, 2019

I used this and it works :

version: “3.3” services: swagger-ui: image: swaggerapi/swagger-ui container_name: “swagger-ui” ports: - “80:8080” volumes: - ./docs/api.yaml:/api.yaml environment: SWAGGER_JSON: /api.yaml

To be honest, the doc is unclear about SWAGGER_JSON environment variable.

19reactions
66303commented, Feb 27, 2020

thanks @AirDur here is docker run command

docker run -p 80:8080 -e SWAGGER_JSON=/api.yaml -v /<absolute_path>/api.yaml:/api.yaml swaggerapi/swagger-ui

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Serve Static Files with Nginx and Docker - Sabe.io
Let's learn how to serve a static website and static files using an Nginx instance running inside a Docker container.
Read more >
halverneus/static-file-server - Docker Image
Tiny, simple static file server using environment variables for configuration. Install from any of the following locations:.
Read more >
Serve static files from docker via nginx - A basic example
Our target is to create a simple HTML file, simple JS, CSS files. Host it inside a docker container. Serve it to outside...
Read more >
The smallest Docker image to serve static websites | Florin Lipan
This will launch the server in foreground ( -f ), listening on port 3000 ( -p ), serving all files inside the current...
Read more >
Docker Tutorial - Running A File Server | Web Server - YouTube
Creating File Server using docker filePlaylist: Docker Tutorial in English: ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found