sphinx-doc / sphinx-autobuild

Watch a Sphinx directory and rebuild the documentation when a change is detected. Also includes a hot-reload web server.
MIT License
523 stars 75 forks source link

Can't reach server running inside Docker container #68

Closed ggalmazor closed 5 years ago

ggalmazor commented 5 years ago

Hi! I'm wrapping my sphinx dev environment inside a Docker container to make it portable and easier to use for other users and I'm interested on adding sphinx-autobuild into it.

Up to now, I was able to run a python -m http.server inside the container and access it from my host machine, no problem.

I've made some tries with sphinx-autobuild and the building part works great but I can't access the web server, even though I've EXPOSEd the port I'm using in my Dockerfile and I'm binding a host port to it, as with the http.server module.

It seems that the server the sphinx-autobuild module is starting isn't getting my hosts requests.

Any idea on how to run it on debug mode, or have some logs to look further into this issue?

iicky commented 5 years ago

@ggalmazor

I ran into this same issue - the trick for me was to change the host from 127.0.0.1 to 0.0.0.0. Here is my CMD in my Dockerfile (I am running on port 8181):

CMD ["sphinx-autobuild", "--host", "0.0.0.0", "--port", "8181", "docs/source", "docs/build"]
ggalmazor commented 5 years ago

Thanks, @iicky!

Honestly, I had solved the issue somehow. I'll review what I did and leave feedback here :) (might as well be just what you've commented)

iicky commented 5 years ago

@ggalmazor Awesome, keep me posted - definitely excited about having this tool!

ggalmazor commented 5 years ago

@iicky

Yup, it was --host 0.0.0.0 what I did.

I also had to add --poll because automatic change detection doesn't work well on Windows, but it didn't affect our Linux and macOS users.

ggalmazor commented 5 years ago

I guess we can close the issue now :)