snowboard icon indicating copy to clipboard operation
snowboard copied to clipboard

no port exposed in docker container when running `mock` or `html`, and docs not accessible

Open daredevil82 opened this issue 4 years ago • 2 comments

I have a file, falcon.apib that I want to run with the http or mock commands. Execution is done via

docker run -v $(PWD)/docs:/docs --rm quay.io/bukalapak/snowboard http /docs/falcon.apib

(latest docker image, I triple-checked that)

But no port is exposed from the container:

docker ps
CONTAINER ID        IMAGE                         COMMAND                  CREATED             STATUS              NAME               PORTS
04f1b49da49d        quay.io/bukalapak/snowboard   "/app/packages/snowb…"   35 seconds ago      Up 34 seconds       nice_aryabhata      

The end result is when I run the above docker command, the following output is produced:

docker run -v $(PWD)/docs:/docs --rm quay.io/bukalapak/snowboard http /docs/falcon.apib
- Parsing input: /docs/falcon.apib
✔  Input parsed: /docs/falcon.apib in 232 ms.
ℹ 「wds」: Project is running at http://localhost:8088/
ℹ 「wds」: webpack output is served from /
ℹ 「wds」: Content not from webpack is served from /doc/dist
ℹ 「wdm」: Hash: afd0e01bd68d681d3479
Version: webpack 4.42.1
Time: 6529ms
Built at: 04/20/2020 5:10:35 PM
        Asset      Size  Chunks                          Chunk Names
    index.css  3.48 KiB    main  [emitted]               main
index.css.map   5.2 KiB    main  [emitted] [dev]         main
   index.html  2.39 KiB          [emitted]
     index.js   1.8 MiB    main  [emitted]        [big]  main
 index.js.map  1.77 MiB    main  [emitted] [dev]         main         
...
...
ℹ 「wdm」: Compiled successfully.                                  

I get this site cannot be reached, localhost refused to connect when going to locahost:8088. This is with no other container mapped to 8088.

daredevil82 avatar Apr 20 '20 17:04 daredevil82

Hi @daredevil82, thanks for raising the issue. I've updated Dockerfile to expose ports explicitly in https://github.com/bukalapak/snowboard/commit/d09dc6250bbb0c95d574b807a4955c575a4a5f17. Also, since http subcommand by default listens to localhost you need to set flag -b to 0.0.0.0:8088, so please retry with:

docker run -v $(PWD)/docs:/docs -p 8088:8088 --rm quay.io/bukalapak/snowboard http -b 0.0.0.0:8088 /docs/falcon.apib

Please let me know the result on your side.

subosito avatar Apr 23 '20 00:04 subosito

I had the same issue and this worked for me:

docker run -p 8080:8080/tcp -it --rm -v $PWD:/doc quay.io/bukalapak/snowboard mock -b :8080 api.apid

jknight avatar Jun 18 '20 19:06 jknight