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.

Supporting multiple files in docker container

See original GitHub issue

I am having trouble supporting multiple files inside the swaggerapi/swagger-ui docker container.

Here is my docker compose:

  swaggerui:
    image: swaggerapi/swagger-ui
    ports:
      - "7000:8080"
    environment:
      - SWAGGER_JSON=/swagger/swagger.yml
    volumes:
      - ./Swagger:/swagger

I would expect this to serve swagger.yml out of the /swagger directory that is mounted.

docker exec -it -name- ls swagger I can see all my files here, swagger.yml, user.swagger.yml, etc

But this is not the root of the nginx web server running in the container:

    location / {
      alias            /usr/share/nginx/html/;

Looks like swagger.yml is copied over to /user/share/nginx/html/. This means that my files I want to reference in my swagger.yml are not available to be served by nginx.

This doesn’t seem like it should be the default behavior, how can I support loading in the other files found in my mounted volume? Perferably without having to modify my swagger.yml to have a strange path I would only use in docker (we are using it only for local). It should also use the volume as a source so I can make changes locally.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

28reactions
adamjgrantcommented, Mar 22, 2019

Here’s what I ended up doing, combining the knowledge from above:

docker run -p 80:8080 \                                                                                                                                 
  -e URLS_PRIMARY_NAME=FIRST \                                                                                                                             
  -e URLS="[ \                                                                                                                                           
    { url: 'docs/first.yml', name: 'FIRST' } \                                                                                                               
    , { url: 'docs/second.yml', name: 'SECOND' } \                                                                                                             
  ]" \                                                                                                                                                   
  -v `pwd`:/usr/share/nginx/html/docs/ \                                                                                                                 
  swaggerapi/swagger-ui   
6reactions
calebicklercommented, Oct 8, 2018

To solve the dependency problem nginx could be updated to serve all .yml and .json files from a mount

Read more comments on GitHub >

github_iconTop Results From Across the Web

Run multiple services in a container
Run multiple services in a container. A container's main running process is the ENTRYPOINT and/or CMD at the end of the Dockerfile ....
Read more >
Copy multiple local files to docker container
Docker cp works perfectly fine when we are inside the directory whose contents we need to copy in bulk into the container. Apparently,...
Read more >
Defining your multi-container application with docker- ...
To use multiple override files, or an override file with a different name, you can use the -f option with the docker-compose command...
Read more >
Copying Files To And From Docker Containers
The docker cp command does have some limitations. First, we cannot use it to copy between two containers. It can only be used...
Read more >
Connect to multiple containers - Visual Studio Code
If you want to extend your Docker Compose file for development, you should use a single docker-compose.yml that extends both services (as needed)...
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