Skip to content
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

403 When running README command #7

Closed
Izhaki opened this issue Feb 21, 2020 · 4 comments
Closed

403 When running README command #7

Izhaki opened this issue Feb 21, 2020 · 4 comments

Comments

@Izhaki
Copy link

Izhaki commented Feb 21, 2020

$ docker run -v out:/static -p 8080:80 flashspys/nginx-static
2020/02/21 09:46:30 [error] 8#8: *1 directory index of "/static/" is forbidden, client: 172.17.0.1, server: localhost, request: "GET / HTTP/1.1", host: "localhost:8080"
2020/02/21 09:46:30 [error] 8#8: *1 open() "/static/favicon.ico" failed (2: No such file or directory), client: 172.17.0.1, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "localhost:8080", referrer: "http://localhost:8080/"

Going to http://localhost:8080/ throws 403.
Going to http://localhost:8080/index.html throws 404

$ ls out/index.*
out/index.html

This happens when trying to troubleshoot 404 on docker compose.

docker-compose:

version: '3'
services:
  axl:
    image: flashspys/nginx-static
    ports:
      - 8080:80
    volumes:
      # We serve the out folder (relative to the compose file)
      - ../out:/static
  cypress:
    image: 'cypress/included:3.8.3'
    entrypoint: cypress run --project packages/axl
    depends_on:
      - axl
    environment:
      # pass base url to test pointing at the web application
      - CYPRESS_baseUrl=http://axl:80/
      - CYPRESS_snapshots=false
    # share the current folder as volume to avoid copying
    working_dir: /e2e
    volumes:
      # Cypress must run from the folder that has its plugins node_modules
      # Which in the case of this mono-repo is root. So we map the root to the working dir
      - ../../../:/e2e

When up this we get:

axl_1      | 2020/02/20 16:20:22 [error] 7#7: *3 open() "/static/progplus-pools" failed (2: No such file or directory), client: 172.23.0.3, server: localhost, request: "GET /progplus-pools HTTP/1.1", host: "axl"
@Izhaki
Copy link
Author

Izhaki commented Feb 21, 2020

Seems to have been an issue with out in out:/static. Needed to provide the full path:

docker run -v /Users/izhaki/Development/tools/packages/axl/out:/static -p 8080:80 flashspys/nginx-static

@flashspys
Copy link
Collaborator

Correct, when using docker run you have to use absolute paths, see moby/moby#4830

flashspys added a commit that referenced this issue Feb 21, 2020
Make clear, that docker run only accepts absolute paths. Reported in #7
@flashspys
Copy link
Collaborator

For future readers, you should check if your files are really mounted in your container. To check this, simply docker exec -it <container id> sh into your container and ls /static

@Izhaki
Copy link
Author

Izhaki commented Feb 21, 2020

The compose issues turned to be our own making - simply requesting files that are not there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants